Compare commits

...

9 Commits
v1.5 ... v1.7.0

Author SHA1 Message Date
Ian Butterworth
161c97cbc5 Allow control of --check-bounds command option (#46)
* allow control of bounds-check command option

* tryfix

* Update action.yml

Co-authored-by: Sascha Mann <git@mail.saschamann.eu>

* Update action.yml

Co-authored-by: Sascha Mann <git@mail.saschamann.eu>

* tryfix

* alternative bash if else approach

* another approach

* use julia_args approach

* add julia_args to kwargs func

* fix

* move julia_args to before return

* guard against v1.0

* add warning

* Update kwargs.jl

Co-authored-by: Sascha Mann <git@mail.saschamann.eu>

* handle the default state and improve error message

* Update kwargs.jl

Co-authored-by: Chris Foster <chris42f@gmail.com>

* Update kwargs.jl

Co-authored-by: Sascha Mann <git@mail.saschamann.eu>
Co-authored-by: Chris Foster <chris42f@gmail.com>
2021-12-22 15:00:07 +01:00
Mosè Giordano
a5f2948fcb Fix setup-julia example in README (#45)
The `julia-arch` option isn't actually used to choose the architecture of Julia in the `setup-julia` step.
2021-06-26 12:01:34 -04:00
Fons van der Plas
61e4ed0228 README: add syntax highlighting (#43) 2021-05-27 22:47:58 +02:00
Fons van der Plas
c78ce59639 README: explain .github/workflows/ folder (#44)
* README: explain .github/workflows/ folder
2021-05-27 22:47:46 +02:00
Dilum Aluthge
8d8f445e06 Make sure that the Pkg.test function accepts the force_latest_compatible_version kwarg (#40) 2021-04-10 01:52:23 -04:00
Dilum Aluthge
eda4346d69 Add the force_latest_compatible_version input, and add the "auto-detect Dependabot/CompatHelper" functionality (#20)
Co-authored-by: Sascha Mann <git@mail.saschamann.eu>
2021-03-31 23:56:56 +02:00
Dilum Aluthge
07b45fecd2 Alphabetize the list of inputs in action.yml (#38) 2021-03-29 21:50:49 -04:00
Dilum Aluthge
f8a636d3f0 Fix two small typos (#34) 2021-02-07 12:46:47 +01:00
Sascha Mann
b32c73084a [Docs] use @v1 instead of @latest (#33) 2021-01-05 00:41:49 +01:00
6 changed files with 88 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2018-2020 GitHub, Inc., David Anthoff and contributors
Copyright (c) 2018-2021 GitHub, Inc., David Anthoff and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -8,7 +8,7 @@ Julia needs to be installed before this action can run. This can easily be achie
And example workflow that uses this action might look like this:
```
```yaml
name: Run tests
on: [push, pull_request]
@@ -27,13 +27,16 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
arch: ${{ matrix.julia-arch }}
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
```
You can add this workflow to your repository by placing it in a file called `test.yml` in the folder `.github/workflows/`. [More info here](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions).
### Prefixing the Julia command
In some packages, you may want to prefix the `julia` command with another command, e.g. for running tests of certain graphical libraries with `xvfb-run`.

View File

@@ -7,8 +7,8 @@ branding:
color: 'gray-dark'
inputs:
inline:
description: 'Value passed to the --inline flag. Options: yes | no. Default value: yes.'
check_bounds:
description: 'Value determining which bounds checking setting to use. Options: yes | no | auto. Default value: yes.'
default: 'yes'
coverage:
description: 'Value determining whether to test with coverage or not. Options: true | false. Default value: true.'
@@ -16,13 +16,19 @@ inputs:
depwarn:
description: 'Value passed to the --depwarn flag. Options: yes | no | error. Default value: yes.'
default: 'yes'
project:
description: 'Value passed to the --project flag. The default value is the repository root: "@."'
default: '@.'
force_latest_compatible_version:
description: 'If true, then, for each [compat] entry in the active project, only allow the latest compatible version. If the value is auto and the pull request has been opened by Dependabot or CompatHelper, then force_latest_compatible_version will be set to true, otherwise it will be set to false. Options: true | false | auto. Default value: auto.'
default: 'auto'
inline:
description: 'Value passed to the --inline flag. Options: yes | no. Default value: yes.'
default: 'yes'
prefix:
description: 'Value inserted in front of the julia command, e.g. for running xvfb-run julia [...]'
default: ''
required: false
project:
description: 'Value passed to the --project flag. The default value is the repository root: "@."'
default: '@.'
runs:
using: 'composite'
@@ -45,7 +51,7 @@ runs:
JULIA_PKG_SERVER: ""
- run: |
# The Julia command that will be executed
julia_cmd=( julia --color=yes --check-bounds=yes --inline=${{ inputs.inline }} --depwarn=${{ inputs.depwarn }} --project=${{ inputs.project }} -e 'using Pkg; Pkg.test(coverage=${{ inputs.coverage }})' )
julia_cmd=( julia --color=yes --depwarn=${{ inputs.depwarn }} --inline=${{ inputs.inline }} --project=${{ inputs.project }} -e 'import Pkg;include(joinpath(ENV["GITHUB_ACTION_PATH"], "kwargs.jl"));kwargs = Kwargs.kwargs(;coverage = :(${{ inputs.coverage }}),force_latest_compatible_version = :(${{ inputs.force_latest_compatible_version }}), julia_args = ["--check-bounds=${{ inputs.check_bounds }}"]);Pkg.test(; kwargs...)' )
# Add the prefix in front of the command if there is one
prefix="${{ inputs.prefix }}"

View File

@@ -37,9 +37,9 @@ function main(; n = 10, max_delay = 120)
delays = ExponentialBackOff(; n = n, max_delay = max_delay)
try
retry(add_general_registry; delays = delays)()
@info("Successfully add the General registry")
@info("Successfully added the General registry")
catch ex
msg = "I was unable to added the General registry. However, the build will continue."
msg = "I was unable to add the General registry. However, the build will continue."
@error(msg, exception=(ex,catch_backtrace()))
end

25
autodetect-dependabot.jl Normal file
View File

@@ -0,0 +1,25 @@
module AutodetectDependabot
function _get_possible_branch_names()
possible_branch_names = [
get(ENV, "GITHUB_BASE_REF", ""),
get(ENV, "GITHUB_HEAD_REF", ""),
get(ENV, "GITHUB_REF", ""),
]
return possible_branch_names
end
function _chop_refs_head(branch_name::AbstractString)
replace(branch_name, r"^(refs\/heads\/)" => "")
end
function _is_dependabot_branch(branch_name::AbstractString)
return startswith(branch_name, "dependabot/julia") || startswith(branch_name, "compathelper/")
end
function is_dependabot_job()
possible_branch_names = _get_possible_branch_names()
return any(_is_dependabot_branch.(_chop_refs_head.(possible_branch_names)))
end
end # module

41
kwargs.jl Normal file
View File

@@ -0,0 +1,41 @@
module Kwargs
import Pkg
include(joinpath(@__DIR__, "autodetect-dependabot.jl"))
function kwargs(; coverage::Bool,
force_latest_compatible_version::Union{Bool, Symbol},
julia_args::AbstractVector{<:AbstractString}=String[])
if !(force_latest_compatible_version isa Bool) && (force_latest_compatible_version != :auto)
throw(ArgumentError("Invalid value for force_latest_compatible_version: $(force_latest_compatible_version)"))
end
kwargs_dict = Dict{Symbol, Any}()
kwargs_dict[:coverage] = coverage
if VERSION >= v"1.6.0"
kwargs_dict[:julia_args] = julia_args
elseif julia_args == ["--check-bounds=yes"]
# silently don't add this default julia_args value as < 1.6 doesn't support julia_args, but it's the default state
else
println("::warning::The Pkg.test bounds checking behavior cannot be changed before Julia 1.6. VERSION=$VERSION, julia_args=$julia_args")
end
if VERSION < v"1.7.0-" || !hasmethod(Pkg.Operations.test, Tuple{Pkg.Types.Context, Vector{Pkg.Types.PackageSpec}}, (:force_latest_compatible_version,))
(force_latest_compatible_version != :auto) && @warn("The `force_latest_compatible_version` option requires at least Julia 1.7", VERSION, force_latest_compatible_version)
return kwargs_dict
end
if force_latest_compatible_version == :auto
is_dependabot_job = AutodetectDependabot.is_dependabot_job()
is_dependabot_job && @info("This is a Dependabot/CompatHelper job, so `force_latest_compatible_version` has been set to `true`")
kwargs_dict[:force_latest_compatible_version] = is_dependabot_job
else
kwargs_dict[:force_latest_compatible_version] = force_latest_compatible_version::Bool
end
return kwargs_dict
end
end # module