From 7c60df1a90bbc07bf09ea897ccee39316618b69e Mon Sep 17 00:00:00 2001 From: Olivier Cots Date: Fri, 20 Nov 2026 19:47:36 +0100 Subject: [PATCH] ci(coverage): the ModelingToolkit extension covered, with +ModelingToolkit (T4 of #449) test_args take +: the default environments and this one, so that the coverage names no other environment. Coverage.yml runs +ModelingToolkit; it needs the test_args input of CTActions' coverage.yml (control-toolbox/CTActions#178). Co-Authored-By: Claude Opus 5.5 --- .github/workflows/Coverage.yml | 3 +++ test/README.md | 4 +++- test/common/selection.jl | 12 ++++++++++-- test/runtests.jl | 3 ++- test/suite/core/test_runner.jl | 8 ++++++++ 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Coverage.yml b/.github/workflows/Coverage.yml index b569a5672..faa6eec91 100644 --- a/.github/workflows/Coverage.yml +++ b/.github/workflows/Coverage.yml @@ -10,6 +10,9 @@ jobs: uses: control-toolbox/CTActions/.github/workflows/coverage.yml@main with: use_ct_registry: true + # the default environments and the opt-in ModelingToolkit (its extension is covered + # only there); not GPU, which needs a device + test_args: "+ModelingToolkit" secrets: codecov-secret: ${{ secrets.CODECOV_TOKEN }} SSH_KEY: ${{ secrets.SSH_KEY }} diff --git a/test/README.md b/test/README.md index 8aecb9b52..70643d808 100644 --- a/test/README.md +++ b/test/README.md @@ -37,6 +37,7 @@ test/ using Pkg Pkg.test() # core and every environment Pkg.test(; test_args=["JuMP"]) # core and one environment +Pkg.test(; test_args=["+ModelingToolkit"]) # every environment and an opt-in one Pkg.test(; test_args=["core"]) # core only Pkg.test(; test_args=["cron"]) # slow tests (cron/), every environment Pkg.test(; test_args=["OptimalControl", "convergence"]) # suite and convergence report @@ -49,7 +50,8 @@ Pkg.test(; test_args=["ModelingToolkit", "cron", "problem=beam,chain", "budget=3 `test_args` is a list of: - environment names: run those only; none given runs every environment except the opt-in - ones (`OPT_IN` in `runtests.jl`); + ones (`OPT_IN` in `runtests.jl`); `+` adds one to them (the coverage workflow runs + `+ModelingToolkit`, so that the ModelingToolkit extension is covered); - `cron`: run `cron//test_*.jl` instead of `suite//test_*.jl` (what the cron workflows run); - `convergence`: run `suite//test_*.jl` and then `cron//test_*.jl`, that is the diff --git a/test/common/selection.jl b/test/common/selection.jl index 7cf0ed92d..f11abc800 100644 --- a/test/common/selection.jl +++ b/test/common/selection.jl @@ -37,14 +37,22 @@ Split the command-line `args` into the environments to run and the file patterns Names of `available` environments (and `core`) are environment names; the rest are patterns. With no environment name, every available environment except the `opt_in` ones runs; naming only `core` runs no environment (`core` always runs in-process). +`+` adds an available environment to the default ones: `+ModelingToolkit` is every +environment run by default and ModelingToolkit (the coverage, which names no other). """ function select_environments(args, available, opt_in; core::AbstractString="core") + added = String[chopprefix(a, "+") for a in args if startswith(a, "+")] + unknown = setdiff(added, available) + isempty(unknown) || throw( + ArgumentError("unknown environments $(join(("+" * u for u in unknown), ", "))") + ) + args = filter(a -> !startswith(a, "+"), args) named = filter(a -> a == core || a in available, args) patterns = String[a for a in args if !(a in named)] environments = if isempty(named) - String[e for e in available if !(e in opt_in)] + String[e for e in available if !(e in opt_in) || e in added] else - String[e for e in named if e in available] + String[e for e in available if e in named || e in added] end return environments, patterns end diff --git a/test/runtests.jl b/test/runtests.jl index 9a708f7e5..5c226b6ba 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -15,6 +15,7 @@ # # julia --project -e 'using Pkg; Pkg.test()' # core + all environments # julia --project -e 'using Pkg; Pkg.test(; test_args=["JuMP"])' # core + one environment +# julia --project -e 'using Pkg; Pkg.test(; test_args=["+ModelingToolkit"])' # + an opt-in one # julia --project -e 'using Pkg; Pkg.test(; test_args=["cron"])' # slow tests (cron/ dirs) # julia --project -e 'using Pkg; Pkg.test(; test_args=["convergence"])' # suite + cron/ dirs # julia --project -e 'using Pkg; Pkg.test(; test_args=["robustness"])' # robustness/ dirs @@ -23,7 +24,7 @@ # julia --project -e 'using Pkg; Pkg.test(; test_args=["ModelingToolkit", "cron", "problem=beam,chain", "budget=3600"])' # # `test_args` is a list of: environment names (none given: every environment except the -# opt-in ones below), the word `cron` (run `cron//test_*.jl` instead of +# opt-in ones below; `+` adds one to them), the word `cron` (run `cron//test_*.jl` instead of # `suite//test_*.jl`), the word `convergence` (run both: the convergence report, # off by default, #360) or the word `robustness` (run `robustness//test_*.jl` only: # the robustness report of the monthly cron, #378), and file patterns (`*` and `?` allowed, with or without diff --git a/test/suite/core/test_runner.jl b/test/suite/core/test_runner.jl index 68b337c4f..c3f26af5f 100644 --- a/test/suite/core/test_runner.jl +++ b/test/suite/core/test_runner.jl @@ -26,6 +26,14 @@ function test_runner() # `core` alone: no other environment (it always runs in-process) Test.@test sel(["core"]) == (String[], String[]) Test.@test sel(["core", "JuMP"]) == (["JuMP"], String[]) + # `+name`: the default environments and this one + Test.@test sel(["+ModelingToolkit"]) == + (["JuMP", "ModelingToolkit", "OptimalControl"], String[]) + Test.@test sel(["+ModelingToolkit", "*solve*"]) == + (["JuMP", "ModelingToolkit", "OptimalControl"], ["*solve*"]) + Test.@test sel(["JuMP", "+ModelingToolkit"]) == + (["JuMP", "ModelingToolkit"], String[]) + Test.@test_throws ArgumentError sel(["+Fortran"]) end Test.@testset "mode" begin