Skip to content

Commit 2247c4a

Browse files
authored
CI tests with NaN-safe mode (#776)
1 parent 5d2edc1 commit 2247c4a

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
@@ -31,12 +31,21 @@ jobs:
3131
- ubuntu-latest
3232
- windows-latest
3333
- macOS-latest
34+
nansafe:
35+
- true
36+
- false
3437
steps:
3538
- uses: actions/checkout@v5
3639
- uses: julia-actions/setup-julia@v2
3740
with:
3841
version: ${{ matrix.version }}
3942
- uses: julia-actions/cache@v2
43+
- name: Set NaN-safe mode preference
44+
run: |
45+
open(joinpath(pwd(), "Project.toml"), "a") do io
46+
println(io, "\n[preferences.ForwardDiff]\nnansafe_mode = ${{ matrix.nansafe }}\n")
47+
end
48+
shell: julia --color=yes {0}
4049
- uses: julia-actions/julia-buildpkg@v1
4150
- uses: julia-actions/julia-runtest@v1
4251
- 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)