Skip to content

Commit 667e19d

Browse files
ChrisRackauckas-ClaudeChrisRackauckasclaude
authored
Canonical CI: grouped-tests.yml + root test/test_groups.toml (#79)
* Canonical CI: grouped-tests.yml + root test/test_groups.toml Convert the root test workflow (Tests.yml) to the canonical grouped-tests.yml@v1 thin caller, with the group x version matrix declared once in test/test_groups.toml. - Tests.yml: replace the hand-maintained version matrix job with a thin `uses: SciML/.github/.github/workflows/grouped-tests.yml@v1` caller (secrets: inherit, default GROUP env). on:/concurrency: preserved. - test/test_groups.toml: [Core] and [QA] each on ["lts", "1"]. Core reproduces the old (version in {1, lts}) full-suite matrix. - runtests.jl: GROUP dispatch. Core runs the functional suite (interface_tests.jl, the type-stability checks, the MATLAB-solve block); QA activates test/qa, develops the package, instantiates, and includes qa/qa.jl. - test/qa: isolated environment (Aqua + JET + Test + MATLABDiffEq via [sources]) and qa.jl running Aqua.test_all + JET.report_package. This keeps the QA tooling out of the main test target's resolve. - jet_tests.jl: keep the functional type-stability tests; the package's JET static analysis now lives in the QA group. - Project.toml: raise julia compat floor 1.6 -> 1.10 (LTS); add [compat] for the test extras (ParameterizedFunctions, Test); move JET out of the main [extras]/[targets] into the isolated test/qa environment. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Add Pkg as test dependency for grouped-tests Core group The grouped test/runtests.jl uses `using Pkg` (for the QA group's Pkg.activate), but Pkg was not a declared test dependency. The Core group runs with project='.', so it died with: ArgumentError: Package Pkg not found in current path Declare Pkg in the root test environment so the Core job loads it. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Hoist Core-group usings to top level to fix macro-expansion bug The Core-group `using DiffEqBase, MATLABDiffEq, ParameterizedFunctions` sat inside the top-level `if GROUP` block that also uses `@ode_def_bare` inline. Julia macro-expands the entire `if` block as one unit before the in-block `using` runs, so the macro is undefined at expansion time (UndefVarError: @ode_def_bare not defined in Main). Hoisting the usings to top level fixes it. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent abd5312 commit 667e19d

7 files changed

Lines changed: 111 additions & 85 deletions

File tree

.github/workflows/Tests.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,5 @@ concurrency:
1818

1919
jobs:
2020
tests:
21-
name: "Tests"
22-
strategy:
23-
fail-fast: false
24-
matrix:
25-
version:
26-
- "1"
27-
- "lts"
28-
uses: "SciML/.github/.github/workflows/tests.yml@v1"
29-
with:
30-
julia-version: "${{ matrix.version }}"
21+
uses: "SciML/.github/.github/workflows/grouped-tests.yml@v1"
3122
secrets: "inherit"

Project.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1111

1212
[compat]
1313
DiffEqBase = "6.122, 7"
14-
JET = "0.9, 0.10, 0.11"
1514
MATLAB = "0.8, 0.9, 0.10"
1615
ModelingToolkit = "8, 9, 10, 11"
16+
ParameterizedFunctions = "5"
1717
PrecompileTools = "1"
1818
Reexport = "0.2, 1.0"
19-
julia = "1.6"
19+
Test = "<0.0.1, 1"
20+
julia = "1.10"
2021

2122
[extras]
22-
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
2323
ParameterizedFunctions = "65888b18-ceab-5e60-b2b9-181511a3b968"
24+
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
2425
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2526

2627
[targets]
27-
test = ["Test", "ParameterizedFunctions", "JET"]
28+
test = ["Test", "ParameterizedFunctions", "Pkg"]

test/jet_tests.jl

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
1-
# JET.jl static analysis tests for MATLABDiffEq
2-
# These tests verify type stability and catch potential runtime errors
3-
# They can run without MATLAB installed since they only test Julia code
1+
# Static type-stability tests for MATLABDiffEq
2+
# These tests verify type stability and catch potential runtime errors.
3+
# They run without MATLAB installed since they only test Julia code.
4+
# JET/Aqua static analysis of the package itself lives in the QA group
5+
# (test/qa/qa.jl); this file holds the functional type-stability checks.
46

57
using Test
68
using DiffEqBase
79

8-
# JET is an optional test dependency
9-
const HAS_JET = try
10-
@eval using JET
11-
true
12-
catch
13-
false
14-
end
15-
1610
# Import buildDEStats for testing - we need to access it from the module
1711
# Since MATLABDiffEq requires MATLAB, we'll test the function pattern directly
1812

@@ -65,14 +59,6 @@ end
6559
result_partial = buildDEStats_test(partial_stats)
6660
@test result_partial.nf == 42
6761
@test result_partial.nreject == 0
68-
69-
# JET analysis - verify no obvious errors in the function
70-
if HAS_JET
71-
rep = JET.report_call(buildDEStats_test, (Dict{String, Any},))
72-
# We expect some reports due to Dict{String, Any} type uncertainty
73-
# but the function should still be valid
74-
@test true # Function analyzed successfully
75-
end
7662
end
7763

7864
@testset "Algorithm struct definitions" begin
@@ -126,16 +112,6 @@ end
126112
@test _is_matlab_compatible_eltype_test(BigFloat) === false
127113
@test _is_matlab_compatible_eltype_test(BigInt) === false
128114
@test _is_matlab_compatible_eltype_test(Float32) === false
129-
130-
# JET @test_opt analysis for type stability
131-
if HAS_JET
132-
@testset "JET @test_opt type stability" begin
133-
# Test type stability of _is_matlab_compatible_eltype
134-
@test_opt _is_matlab_compatible_eltype_test(Float64)
135-
@test_opt _is_matlab_compatible_eltype_test(Int64)
136-
@test_opt _is_matlab_compatible_eltype_test(BigFloat)
137-
end
138-
end
139115
end
140116

141117
@testset "Return type inference" begin

test/qa/Project.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[deps]
2+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
3+
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
4+
MATLABDiffEq = "e2752cbe-bcf4-5895-8727-84ebc14a76bd"
5+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
6+
7+
[sources]
8+
MATLABDiffEq = {path = "../.."}
9+
10+
[compat]
11+
Aqua = "0.8"
12+
JET = "0.9, 0.10, 0.11"
13+
Test = "<0.0.1, 1"
14+
julia = "1.10"

test/qa/qa.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using MATLABDiffEq, Aqua, JET
2+
using Test
3+
4+
@testset "Aqua" begin
5+
Aqua.test_all(MATLABDiffEq)
6+
end
7+
8+
@testset "JET static analysis" begin
9+
rep = JET.report_package(MATLABDiffEq; target_modules = (MATLABDiffEq,))
10+
@test length(JET.get_reports(rep)) == 0
11+
end

test/runtests.jl

Lines changed: 62 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,64 @@
1-
using DiffEqBase, MATLABDiffEq, ParameterizedFunctions, Test
2-
3-
# Interface tests - these test type validation without needing MATLAB runtime
4-
include("interface_tests.jl")
5-
6-
# JET static analysis tests - these also run without MATLAB
7-
include("jet_tests.jl")
8-
9-
# The following tests require MATLAB runtime to be available
10-
# They test the actual ODE solving functionality
11-
12-
f = @ode_def_bare LotkaVolterra begin
13-
dx = a * x - b * x * y
14-
dy = -c * y + d * x * y
15-
end a b c d
16-
p = [1.5, 1, 3, 1]
17-
tspan = (0.0, 10.0)
18-
u0 = [1.0, 1.0]
19-
prob = ODEProblem(f, u0, tspan, p)
20-
sol = solve(prob, MATLABDiffEq.ode45())
21-
22-
function lorenz(du, u, p, t)
23-
du[1] = 10.0(u[2] - u[1])
24-
du[2] = u[1] * (28.0 - u[3]) - u[2]
25-
return du[3] = u[1] * u[2] - (8 / 3) * u[3]
1+
using Pkg
2+
using Test
3+
using DiffEqBase, MATLABDiffEq, ParameterizedFunctions
4+
5+
const GROUP = get(ENV, "GROUP", "Core")
6+
7+
# QA (Aqua + JET) runs in an isolated environment (test/qa) so its tooling deps
8+
# never enter the main test target's resolve. On Julia < 1.11 the [sources] table
9+
# is ignored, so develop the package by path to test the PR branch code.
10+
function activate_qa_env()
11+
Pkg.activate(joinpath(@__DIR__, "qa"))
12+
Pkg.develop(PackageSpec(path = dirname(@__DIR__)))
13+
return Pkg.instantiate()
2614
end
27-
u0 = [1.0; 0.0; 0.0]
28-
tspan = (0.0, 100.0)
29-
prob = ODEProblem(lorenz, u0, tspan)
30-
sol = solve(prob, MATLABDiffEq.ode45())
31-
32-
algs = [
33-
MATLABDiffEq.ode23
34-
MATLABDiffEq.ode45
35-
MATLABDiffEq.ode113
36-
MATLABDiffEq.ode23s
37-
MATLABDiffEq.ode23t
38-
MATLABDiffEq.ode23tb
39-
MATLABDiffEq.ode15s
40-
]
41-
42-
for alg in algs
43-
sol = solve(prob, alg())
15+
16+
if GROUP == "Core" || GROUP == "All"
17+
# Interface tests - these test type validation without needing MATLAB runtime
18+
include("interface_tests.jl")
19+
20+
# Static type-stability tests - these also run without MATLAB
21+
include("jet_tests.jl")
22+
23+
# The following tests require MATLAB runtime to be available
24+
# They test the actual ODE solving functionality
25+
26+
f = @ode_def_bare LotkaVolterra begin
27+
dx = a * x - b * x * y
28+
dy = -c * y + d * x * y
29+
end a b c d
30+
p = [1.5, 1, 3, 1]
31+
tspan = (0.0, 10.0)
32+
u0 = [1.0, 1.0]
33+
prob = ODEProblem(f, u0, tspan, p)
34+
sol = solve(prob, MATLABDiffEq.ode45())
35+
36+
function lorenz(du, u, p, t)
37+
du[1] = 10.0(u[2] - u[1])
38+
du[2] = u[1] * (28.0 - u[3]) - u[2]
39+
return du[3] = u[1] * u[2] - (8 / 3) * u[3]
40+
end
41+
u0 = [1.0; 0.0; 0.0]
42+
tspan = (0.0, 100.0)
43+
prob = ODEProblem(lorenz, u0, tspan)
44+
sol = solve(prob, MATLABDiffEq.ode45())
45+
46+
algs = [
47+
MATLABDiffEq.ode23
48+
MATLABDiffEq.ode45
49+
MATLABDiffEq.ode113
50+
MATLABDiffEq.ode23s
51+
MATLABDiffEq.ode23t
52+
MATLABDiffEq.ode23tb
53+
MATLABDiffEq.ode15s
54+
]
55+
56+
for alg in algs
57+
sol = solve(prob, alg())
58+
end
59+
end
60+
61+
if GROUP == "QA"
62+
activate_qa_env()
63+
include("qa/qa.jl")
4464
end

test/test_groups.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Root MATLABDiffEq.jl test-group matrix, consumed by the reusable
2+
# grouped-tests.yml@v1 caller (.github/workflows/Tests.yml) via
3+
# scripts/compute_affected_sublibraries.jl --root-matrix. Each group runs on
4+
# every Julia version it lists; runtests.jl dispatches on GROUP.
5+
#
6+
# Core reproduces the old Tests.yml matrix (the whole suite on "lts" and "1").
7+
# QA is newly split out: Aqua + JET run in the isolated test/qa environment.
8+
9+
[Core]
10+
versions = ["lts", "1"]
11+
12+
[QA]
13+
versions = ["lts", "1"]

0 commit comments

Comments
 (0)