diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 68aef7c7..44cd76d0 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -6,34 +6,37 @@ on: push: branches: - master + schedule: + - cron: '15 4 * * 6' jobs: test: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + env: + GROUP: ${{ matrix.group }} strategy: + fail-fast: false matrix: group: - Core version: - '1' + os: + - ubuntu-latest + - macos-latest + - windows-latest steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} - - uses: actions/cache@v4 - env: - cache-name: cache-artifacts + - uses: julia-actions/cache@v1 with: - path: ~/.julia/artifacts - key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} - restore-keys: | - ${{ runner.os }}-test-${{ env.cache-name }}- - ${{ runner.os }}-test- - ${{ runner.os }}- + token: ${{ secrets.GITHUB_TOKEN }} - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 + with: + depwarn: error - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v4 with: - file: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} + file: lcov.info \ No newline at end of file diff --git a/.github/workflows/Downgrade.yml b/.github/workflows/Downgrade.yml new file mode 100644 index 00000000..110675ce --- /dev/null +++ b/.github/workflows/Downgrade.yml @@ -0,0 +1,43 @@ +name: Downgrade +on: + pull_request: + branches: + - master + paths-ignore: + - 'docs/**' + push: + branches: + - master + paths-ignore: + - 'docs/**' + schedule: + - cron: '15 4 * * 6' +jobs: + test: + runs-on: ${{ matrix.os }} + env: + GROUP: ${{ matrix.group }} + strategy: + fail-fast: false + matrix: + group: + - Core + version: + - '1' + os: + - ubuntu-latest + - macos-latest + - windows-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.version }} + - uses: julia-actions/julia-downgrade-compat@v1 + with: + skip: Pkg,TOML,Sundials_jll + - uses: julia-actions/cache@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 \ No newline at end of file diff --git a/Project.toml b/Project.toml index ec6ea8d6..19d968ef 100644 --- a/Project.toml +++ b/Project.toml @@ -17,26 +17,44 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" Sundials_jll = "fb77eaff-e24c-56d4-86b1-d163f2edb164" [compat] +AlgebraicMultigrid = "0.6" +Aqua = "0.8" CEnum = "0.5" -DataStructures = "0.18" -DiffEqBase = "6.122" -PrecompileTools = "1" -Reexport = "1.0" -SciMLBase = "2.9" +DAEProblemLibrary = "0.1" +DataStructures = "0.18.13" +DiffEqBase = "6.147" +DiffEqCallbacks = "2.35" +ForwardDiff = "0.10.20" +IncompleteLU = "0.2" +Libdl = "1.10" +LinearAlgebra = "1.10" +Logging = "1.10" +ModelingToolkit = "8.74" +ODEProblemLibrary = "0.1.5" +PrecompileTools = "1.2" +Reexport = "1.2" +SafeTestsets = "0.1" +SciMLBase = "2.26" +SparseArrays = "1.10" +SparseDiffTools = "2.14" +SparsityTracing = "0.2.1" Sundials_jll = "5.2" -julia = "1.9" +Test = "1.10" +julia = "1.10" [extras] AlgebraicMultigrid = "2169fc97-5a83-5252-b627-83903c6c433c" +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DAEProblemLibrary = "dfb8ca35-80a1-48ba-a605-84916a45b4f8" DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" IncompleteLU = "40713840-3770-5561-ab4c-a76e7d0d7895" ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78" ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" +SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" SparseDiffTools = "47a9eef4-7e08-11e9-0b38-333d64bd3804" SparsityTracing = "06eadbd4-12ad-4cbc-ab6e-10f8370940a5" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Test", "AlgebraicMultigrid", "DiffEqCallbacks", "ODEProblemLibrary", "DAEProblemLibrary", "ForwardDiff", "SparseDiffTools", "SparsityTracing", "IncompleteLU", "ModelingToolkit"] +test = ["Aqua", "Test", "SafeTestsets", "AlgebraicMultigrid", "DiffEqCallbacks", "ODEProblemLibrary", "DAEProblemLibrary", "ForwardDiff", "SparseDiffTools", "SparsityTracing", "IncompleteLU", "ModelingToolkit"] diff --git a/test/common_interface/cvode.jl b/test/common_interface/cvode.jl index a40996cf..cba1843d 100644 --- a/test/common_interface/cvode.jl +++ b/test/common_interface/cvode.jl @@ -57,7 +57,7 @@ sol_idxs = solve(prob, CVODE_Adams(); save_idxs = [1], timeseries_errors = false sol_idxs = solve(prob, CVODE_Adams(); save_idxs = [1, 2], timeseries_errors = false, calculate_error = false) -@test length(sol_idxs[1]) == 2 +@test length(sol_idxs[:, 1]) == 2 @test sol[1, :] == sol_idxs[1, :] @test sol[2, :] == sol_idxs[2, :] diff --git a/test/cvode_Roberts_dns.jl b/test/cvode_Roberts_dns.jl index 8c2e8ffe..7dae0f11 100644 --- a/test/cvode_Roberts_dns.jl +++ b/test/cvode_Roberts_dns.jl @@ -2,6 +2,12 @@ using Sundials ## f routine. Compute function f(t,y). +function f(t, y, ydot) + ydot[1] = -0.04 * y[1] + 1.0e4 * y[2] * y[3] + ydot[3] = 3.0e7 * y[2] * y[2] + ydot[2] = -ydot[1] - ydot[3] + return Sundials.CV_SUCCESS +end function f(t, y_nv, ydot_nv, user_data) y = convert(Vector, y_nv) ydot = convert(Vector, ydot_nv) diff --git a/test/generator.jl b/test/generator.jl index c2706a2b..d301535c 100644 --- a/test/generator.jl +++ b/test/generator.jl @@ -1,2 +1,3 @@ +using Sundials # Test these sundials_sundials, sundials_sunlinsolve, sundials_sunlinsolve, sundial_sunmatrix are callable @test Sundials.SUNLinSolNewEmpty() isa Any diff --git a/test/ida_Roberts_dns.jl b/test/ida_Roberts_dns.jl index 2be5ddd1..2b925bd9 100644 --- a/test/ida_Roberts_dns.jl +++ b/test/ida_Roberts_dns.jl @@ -79,6 +79,7 @@ end neq = 3 nout = 12 t0 = 0.0 +y0 = [1.0, 0.0, 0.0] yy0 = [1.0, 0.0, 0.0] yp0 = [-0.04, 0.04, 0.0] rtol = 1e-4 diff --git a/test/kinsol_banded.jl b/test/kinsol_banded.jl index 4ae55fcd..67491efd 100644 --- a/test/kinsol_banded.jl +++ b/test/kinsol_banded.jl @@ -1,3 +1,4 @@ +using Sundials function f!(resid, x) for i in eachindex(x) resid[i] = sin(x[i]) + x[i]^3 diff --git a/test/qa.jl b/test/qa.jl new file mode 100644 index 00000000..458be152 --- /dev/null +++ b/test/qa.jl @@ -0,0 +1,11 @@ +using Sundials, Aqua +@testset "Aqua" begin + Aqua.find_persistent_tasks_deps(Sundials) + Aqua.test_ambiguities(Sundials, recursive = false) + Aqua.test_deps_compat(Sundials) + Aqua.test_piracies(Sundials) + Aqua.test_project_extras(Sundials) + Aqua.test_stale_deps(Sundials) + Aqua.test_unbound_args(Sundials) + Aqua.test_undefined_exports(Sundials) +end diff --git a/test/runtests.jl b/test/runtests.jl index 26ecf42e..58a73b02 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,92 +1,48 @@ -using Sundials -using Test +using SafeTestsets, Test +@testset "Sundials" begin + @safetestset "Quality Assurance" include("qa.jl") + @safetestset "Generator" include("generator.jl") -@testset "Generator" begin - include("generator.jl") -end - -@testset "CVODE" begin - @testset "Roberts CVODE Simplified" begin - include("cvode_Roberts_simplified.jl") - end - @testset "Roberts CVODE Direct" begin - include("cvode_Roberts_dns.jl") + @testset "CVODE" begin + @safetestset "Roberts CVODE Simplified" include("cvode_Roberts_simplified.jl") + @safetestset "Roberts CVODE Direct" include("cvode_Roberts_dns.jl") + # @safetestset "CVODES Direct" include("cvodes_dns.jl") end - #@testset "CVODES Direct" begin include("cvodes_dns.jl") end -end -@testset "IDA" begin - @testset "Roberts IDA Simplified" begin - include("ida_Roberts_simplified.jl") - end - @testset "Roberts IDA Direct" begin - include("ida_Roberts_dns.jl") - end - @testset "Heat IDA Direct" begin - include("ida_Heat2D.jl") + @testset "IDA" begin + @safetestset "Roberts IDA Simplified" include("ida_Roberts_simplified.jl") + @safetestset "Roberts IDA Direct" include("ida_Roberts_dns.jl") + @safetestset "Heat IDA Direct" include("ida_Heat2D.jl") + # Commented out because still uses the syntax from Grid which is a deprecated package + # @safetestset "Cable IDA Direct" include("ida_Cable.jl") end - # Commented out because still uses the syntax from Grid which is a deprecated package - #@testset "Cable IDA Direct" begin include("ida_Cable.jl") end -end -@testset "ARK" begin - @testset "Roberts ARKStep Direct" begin - include("arkstep_Roberts_dns.jl") + @testset "ARK" begin + @safetestset "Roberts ARKStep Direct" include("arkstep_Roberts_dns.jl") + @safetestset "NonLinear ERKStep Direct" include("erkstep_nonlin.jl") + # @safetestset "MRI two way couple" include("mri_twowaycouple.jl") end - @testset "NonLinear ERKStep Direct" begin - include("erkstep_nonlin.jl") - end - #@testset "MRI two way couple" begin include("mri_twowaycouple.jl") end -end -@testset "Kinsol" begin - @testset "Kinsol Simplified" begin - include("kinsol_mkin_simplified.jl") - end - @testset "Kinsol MKin" begin - include("kinsol_mkinTest.jl") - end - @testset "Kinsol Banded" begin - include("kinsol_banded.jl") - end - @testset "Kinsol NonlinearSolve" begin - include("kinsol_nonlinear_solve.jl") + @testset "Kinsol" begin + @safetestset "Kinsol Simplified" include("kinsol_mkin_simplified.jl") + @safetestset "Kinsol MKin" include("kinsol_mkinTest.jl") + @safetestset "Kinsol Banded" include("kinsol_banded.jl") + @safetestset "Kinsol NonlinearSolve" include("kinsol_nonlinear_solve.jl") end -end -@testset "Handle Tests" begin - include("handle_tests.jl") -end -@testset "Common Interface" begin - @testset "CVODE" begin - include("common_interface/cvode.jl") - end - @testset "ARKODE" begin - include("common_interface/arkode.jl") - end - @testset "IDA" begin - include("common_interface/ida.jl") - end - @testset "Jacobians" begin - include("common_interface/jacobians.jl") - end - @testset "Callbacks" begin - include("common_interface/callbacks.jl") - end - @testset "Iterator" begin - include("common_interface/iterators.jl") - end - @testset "Errors" begin - include("common_interface/errors.jl") - end - @testset "Mass Matrix" begin - include("common_interface/mass_matrix.jl") - end - @testset "Preconditioners" begin - include("common_interface/precs.jl") + @safetestset "Handle Tests" include("handle_tests.jl") + + @testset "Common Interface" begin + @safetestset "CVODE" include("common_interface/cvode.jl") + @safetestset "ARKODE" include("common_interface/arkode.jl") + @safetestset "IDA" include("common_interface/ida.jl") + @safetestset "Jacobians" include("common_interface/jacobians.jl") + @safetestset "Callbacks" include("common_interface/callbacks.jl") + @safetestset "Iterator" include("common_interface/iterators.jl") + @safetestset "Errors" include("common_interface/errors.jl") + @safetestset "Mass Matrix" include("common_interface/mass_matrix.jl") + @safetestset "Preconditioners" include("common_interface/precs.jl") end -end -@testset "Interpolation" begin - include("interpolation.jl") + @safetestset "Interpolation" include("interpolation.jl") end