Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update tests workflow to use centralised reusable workflow #226

Merged
merged 4 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions .github/workflows/CI.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ on:
jobs:
format-check:
name: "Format Check"
uses: "SciML/.github/.github/workflows/format-check.yml@v1"
uses: "SciML/.github/.github/workflows/format-suggestions-on-pr.yml@v1"
32 changes: 32 additions & 0 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Tests"

on:
pull_request:
branches:
- master
paths-ignore:
- 'docs/**'
push:
branches:
- master
paths-ignore:
- 'docs/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch || github.ref != 'refs/tags/v*' }}

jobs:
tests:
name: "Tests"
strategy:
fail-fast: false
matrix:
os:
- "ubuntu-latest"
- "macos-latest"
- "windows-latest"
uses: "SciML/.github/.github/workflows/tests.yml@v1"
with:
os: "${{ matrix.os }}"
secrets: "inherit"
26 changes: 13 additions & 13 deletions test/manifold_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ function isautonomous(::ManifoldProjection{
end

sol = solve(prob, Vern7())
@test !(sol[end][1]^2 + sol[end][2]^2 ≈ 2)
@test !(sol.u[end][1]^2 + sol.u[end][2]^2 ≈ 2)

# autodiff=true
@inferred ManifoldProjection(g; autonomous = Val(false), resid_prototype = zeros(2))
cb = ManifoldProjection(g; resid_prototype = zeros(2))
@test isautonomous(cb.affect!)
solve(prob, Vern7(), callback = cb)
@time sol = solve(prob, Vern7(), callback = cb)
@test sol[end][1]^2 + sol[end][2]^2 ≈ 2
@test sol.u[end][1]^2 + sol.u[end][2]^2 ≈ 2

cb_t = ManifoldProjection(g_t; resid_prototype = zeros(2))
@test !isautonomous(cb_t.affect!)
Expand All @@ -42,7 +42,7 @@ cb_false = ManifoldProjection(
@test isautonomous(cb_false.affect!)
solve(prob, Vern7(), callback = cb_false)
sol = solve(prob, Vern7(), callback = cb_false)
@test sol[end][1]^2 + sol[end][2]^2 ≈ 2
@test sol.u[end][1]^2 + sol.u[end][2]^2 ≈ 2

cb_t_false = ManifoldProjection(g_t,
nlsolve = GaussNewton(; autodiff = AutoFiniteDiff()), resid_prototype = zeros(2))
Expand All @@ -56,16 +56,16 @@ u₀ = ArrayPartition(ones(2), ones(2))
prob = ODEProblem(f, u₀, (0.0, 100.0))

sol = solve(prob, Vern7(), callback = cb)
@test sol[end][1]^2 + sol[end][2]^2 ≈ 2
@test sol.u[end][1]^2 + sol.u[end][2]^2 ≈ 2

sol = solve(prob, Vern7(), callback = cb_t)
@test sol[end][1]^2 + sol[end][2]^2 ≈ 2
@test sol.u[end][1]^2 + sol.u[end][2]^2 ≈ 2

sol = solve(prob, Vern7(), callback = cb_false)
@test sol[end][1]^2 + sol[end][2]^2 ≈ 2
@test sol.u[end][1]^2 + sol.u[end][2]^2 ≈ 2

sol = solve(prob, Vern7(), callback = cb_t_false)
@test sol[end][1]^2 + sol[end][2]^2 ≈ 2
@test sol.u[end][1]^2 + sol.u[end][2]^2 ≈ 2

# Test termination if cannot project to manifold
function g_unsat(resid, u, p)
Expand Down Expand Up @@ -94,7 +94,7 @@ cb = ManifoldProjection(g_oop; isinplace = Val(false))
@test isautonomous(cb.affect!)
solve(prob, Vern7(), callback = cb)
@time sol = solve(prob, Vern7(), callback = cb)
@test sol[end][1]^2 + sol[end][2]^2 ≈ 2
@test sol.u[end][1]^2 + sol.u[end][2]^2 ≈ 2

cb_t = ManifoldProjection(g_oop_t; isinplace = Val(false))
@test !isautonomous(cb_t.affect!)
Expand All @@ -108,7 +108,7 @@ cb_false = ManifoldProjection(
@test isautonomous(cb_false.affect!)
solve(prob, Vern7(), callback = cb_false)
sol = solve(prob, Vern7(), callback = cb_false)
@test sol[end][1]^2 + sol[end][2]^2 ≈ 2
@test sol.u[end][1]^2 + sol.u[end][2]^2 ≈ 2

cb_t_false = ManifoldProjection(g_oop_t,
nlsolve = GaussNewton(; autodiff = AutoFiniteDiff()), isinplace = Val(false))
Expand All @@ -122,13 +122,13 @@ u₀ = ArrayPartition(ones(2), ones(2))
prob = ODEProblem(f, u₀, (0.0, 100.0))

sol = solve(prob, Vern7(), callback = cb)
@test sol[end][1]^2 + sol[end][2]^2 ≈ 2
@test sol.u[end][1]^2 + sol.u[end][2]^2 ≈ 2

sol = solve(prob, Vern7(), callback = cb_t)
@test sol[end][1]^2 + sol[end][2]^2 ≈ 2
@test sol.u[end][1]^2 + sol.u[end][2]^2 ≈ 2

sol = solve(prob, Vern7(), callback = cb_false)
@test sol[end][1]^2 + sol[end][2]^2 ≈ 2
@test sol.u[end][1]^2 + sol.u[end][2]^2 ≈ 2

sol = solve(prob, Vern7(), callback = cb_t_false)
@test sol[end][1]^2 + sol[end][2]^2 ≈ 2
@test sol.u[end][1]^2 + sol.u[end][2]^2 ≈ 2
Loading