mirror of
https://github.com/julia-actions/julia-runtest.git
synced 2026-02-12 02:56:55 +08:00
Add test_arg input and populate to test_args in test() (#73)
This commit is contained in:
committed by
GitHub
parent
d0c4f093ba
commit
e16476132f
32
README.md
32
README.md
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user