Skip to content

Commit 7223b5d

Browse files
committed
CI tests with NaN-safe mode
1 parent 463e830 commit 7223b5d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ permissions:
1717

1818
jobs:
1919
test:
20-
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ github.event_name }}
20+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - NaN-safe mode ${{ matrix.nansafe && 'enabled' || 'disabled' }} - ${{ github.event_name }}
2121
runs-on: ${{ matrix.os }}
2222
strategy:
2323
fail-fast: false
@@ -30,12 +30,21 @@ jobs:
3030
- ubuntu-latest
3131
- windows-latest
3232
- macOS-latest
33+
nansafe:
34+
- true
35+
- false
3336
steps:
3437
- uses: actions/checkout@v5
3538
- uses: julia-actions/setup-julia@v2
3639
with:
3740
version: ${{ matrix.version }}
3841
- uses: julia-actions/cache@v2
42+
- name: Set NaN-safe mode preference
43+
run: |
44+
open(joinpath(pwd(), "Project.toml"), "a") do io
45+
println(io, "\n[preferences.ForwardDiff]\nnansafe_mode = ${{ matrix.nansafe }}\n")
46+
end
47+
shell: julia --color=yes {0}
3948
- uses: julia-actions/julia-buildpkg@v1
4049
- uses: julia-actions/julia-runtest@v1
4150
- uses: julia-actions/julia-processcoverage@v1

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using ForwardDiff, Test, Random
22

3+
@info "Testing ForwardDiff with NaN-safe mode $(ForwardDiff.NANSAFE_MODE_ENABLED ? "enabled" : "disabled")"
4+
35
SEED = trunc(Int, time())
46
println("##### Random.seed!($SEED), on VERSION == $VERSION")
57
Random.seed!(SEED)

0 commit comments

Comments
 (0)