Add test_arg input and populate to test_args in test() (#73)

This commit is contained in:
Sebastian Schlenkrich
2024-07-23 13:20:19 +02:00
committed by GitHub
parent d0c4f093ba
commit e16476132f
4 changed files with 46 additions and 2 deletions

View File

@@ -87,6 +87,38 @@ If you only want to add this prefix on certain builds, you can [include addition
This will add the prefix `xvfb-run` to all builds where the `os` is `ubuntu-latest`.
### Pass Arguments to Test Suite
You can pass arguments from the workflow specification to the test script via the `test_args` parameter.
This is useful, for example, to specify separate workflows for fast and slow tests.
The functionality can be incorporated as follows:
```yaml
# ...
steps:
# ...
- uses: julia-actions/julia-runtest@v1
with:
test_args: 'only_fast_tests'
# ...
```
The value of `test_args` can be accessed in `runtest.jl` via the `ARGS` variable. An example for `runtest.jl` is given below.
```julia
using Test
# ...
if @isdefined(ARGS) && length(ARGS) > 0 && ARGS[1] == "only_fast_tests"
# run only fast tests
include("only_fast_tests.jl")
else
# do something else
end
```
### Registry flavor preference