Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow control of --check-bounds command option #46

Merged
Merged
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ branding:
color: 'gray-dark'

inputs:
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.'
default: 'true'
Expand Down Expand Up @@ -48,7 +51,7 @@ runs:
JULIA_PKG_SERVER: ""
- run: |
# The Julia command that will be executed
julia_cmd=( julia --check-bounds=yes --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 }}),);Pkg.test(; kwargs...)' )
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 }}"
Expand Down
9 changes: 8 additions & 1 deletion kwargs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@ import Pkg
include(joinpath(@__DIR__, "autodetect-dependabot.jl"))

function kwargs(; coverage::Bool,
force_latest_compatible_version::Union{Bool, Symbol})
force_latest_compatible_version::Union{Bool, Symbol},
julia_args::Union{Cmd, AbstractVector{<:AbstractString}}=``)
IanButterworth marked this conversation as resolved.
Show resolved Hide resolved
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 != ``
@warn("The `julia_args` option requires at least Julia 1.6", VERSION, julia_args)
end
IanButterworth marked this conversation as resolved.
Show resolved Hide resolved

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
Expand Down