Skip to content

Commit cebfca6

Browse files
authored
Split backend tests into different workflows (#269)
* Split backend tests into different workflows * Name groups * Shorter names * Remove process coverage * Coverage dirs * Fix group * Typo * Clean up * Fix exclusions * Remove problematic double * Don't test folders * Verbosity
1 parent 3634522 commit cebfca6

File tree

9 files changed

+156
-96
lines changed

9 files changed

+156
-96
lines changed

.github/workflows/Documentation.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ concurrency:
1717
jobs:
1818

1919
docs:
20-
name: ${{ matrix.pkg.name }}
20+
name: ${{ matrix.pkg.shortcut }}
2121
runs-on: ubuntu-latest
2222
permissions:
2323
contents: write
@@ -27,8 +27,10 @@ jobs:
2727
matrix:
2828
pkg:
2929
- name: DifferentiationInterface
30+
shortcut: DI
3031
dir: './DifferentiationInterface'
3132
- name: DifferentiationInterfaceTest
33+
shortcut: DIT
3234
dir: './DifferentiationInterfaceTest'
3335

3436
steps:

.github/workflows/Test.yml

Lines changed: 83 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,51 +16,115 @@ concurrency:
1616

1717
jobs:
1818

19-
test:
20-
name: ${{ matrix.pkg.name }} - Julia ${{ matrix.version }}
21-
runs-on: ${{ matrix.os }}
19+
test-DI:
20+
name: DI (${{ matrix.group }}) - Julia ${{ matrix.version }}
21+
runs-on: ubuntu-latest
2222
timeout-minutes: 60
2323
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
2424
actions: write
2525
contents: read
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
pkg:
30-
- name: DifferentiationInterface
31-
dir: './DifferentiationInterface'
32-
- name: DifferentiationInterfaceTest
33-
dir: './DifferentiationInterfaceTest'
3429
version:
3530
- '1'
3631
- '1.6'
37-
os:
38-
- ubuntu-latest
39-
arch:
40-
- x64
32+
group:
33+
- Formalities
34+
- Internals
35+
- Single/Diffractor
36+
- Single/Enzyme
37+
- Single/FastDifferentiation
38+
- Single/FiniteDiff
39+
- Single/FiniteDifferences
40+
- Single/ForwardDiff
41+
- Single/PolyesterForwardDiff
42+
- Single/ReverseDiff
43+
- Single/Symbolics
44+
- Single/Tapir
45+
- Single/Tracker
46+
- Single/Zygote
47+
- Double/Enzyme-ForwardDiff
48+
- Double/ForwardDiff-Zygote
49+
- Double/ReverseDiff-Zygote
50+
exclude:
51+
- version: '1.6'
52+
group: Formalities
53+
- version: '1.6'
54+
group: Single/Diffractor
55+
- version: '1.6'
56+
group: Single/Enzyme
57+
- version: '1.6'
58+
group: Single/FiniteDiff
59+
- version: '1.6'
60+
group: Single/FastDifferentiation
61+
- version: '1.6'
62+
group: Single/PolyesterForwardDiff
63+
- version: '1.6'
64+
group: Single/Symbolics
65+
- version: '1.6'
66+
group: Single/Tapir
67+
- version: '1.6'
68+
group: Double/Enzyme-ForwardDiff
69+
- version: '1.6'
70+
group: Double/ReverseDiff-Zygote
4171

4272
steps:
4373
- uses: actions/checkout@v4
4474
- uses: julia-actions/setup-julia@v2
4575
with:
4676
version: ${{ matrix.version }}
47-
arch: ${{ matrix.arch }}
77+
arch: x64
78+
- uses: julia-actions/cache@v2
79+
- uses: julia-actions/julia-buildpkg@v1
80+
- uses: julia-actions/julia-runtest@v1
81+
with:
82+
project: ./DifferentiationInterface
83+
env:
84+
JULIA_DI_TEST_GROUP: ${{ matrix.group }}
85+
- uses: julia-actions/julia-processcoverage@v1
86+
with:
87+
directories: ./DifferentiationInterface/src,./DifferentiationInterface/ext
88+
- uses: codecov/codecov-action@v4
89+
with:
90+
files: lcov.info
91+
token: ${{ secrets.CODECOV_TOKEN }}
92+
fail_ci_if_error: true
93+
94+
test-DIT:
95+
name: DIT - Julia ${{ matrix.version }}
96+
runs-on: ubuntu-latest
97+
timeout-minutes: 60
98+
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
99+
actions: write
100+
contents: read
101+
strategy:
102+
fail-fast: false
103+
matrix:
104+
version:
105+
- '1'
106+
- '1.6'
107+
108+
steps:
109+
- uses: actions/checkout@v4
110+
- uses: julia-actions/setup-julia@v2
111+
with:
112+
version: ${{ matrix.version }}
113+
arch: x64
48114
- uses: julia-actions/cache@v2
49115
- uses: julia-actions/julia-buildpkg@v1
50116
- name: Dev dependencies (temporary)
51-
run: julia --project=${{ matrix.pkg.dir}}/ -e '
117+
run: julia --project='./DifferentiationInterfaceTest' -e '
52118
using Pkg;
53119
Pkg.Registry.update();
54-
if "${{ matrix.pkg.name}}" == "DifferentiationInterfaceTest";
55-
Pkg.develop(PackageSpec(path="./DifferentiationInterface"));
56-
end;
120+
Pkg.develop(PackageSpec(path="./DifferentiationInterface"));
57121
Pkg.instantiate();'
58122
- uses: julia-actions/julia-runtest@v1
59123
with:
60-
project: ${{ matrix.pkg.dir }}
124+
project: ./DifferentiationInterfaceTest
61125
- uses: julia-actions/julia-processcoverage@v1
62126
with:
63-
directories: ${{ matrix.pkg.dir }}/src,${{ matrix.pkg.dir }}/ext
127+
directories: ./DifferentiationInterfaceTest/src,./DifferentiationInterfaceTest/ext
64128
- uses: codecov/codecov-action@v4
65129
with:
66130
files: lcov.info

DifferentiationInterface/Project.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@ ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
7070
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
7171
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
7272
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
73-
# DifferentiationInterfaceTest = "a82114a7-5aa3-49a8-9643-716bb13727a3"
73+
DifferentiationInterfaceTest = "a82114a7-5aa3-49a8-9643-716bb13727a3"
7474
Diffractor = "9f5e2b26-1114-432f-b630-d3fe2085c51c"
75-
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
7675
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
7776
FastDifferentiation = "eb9bf01b-bf85-4b60-bf87-ee5de06c00be"
7877
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
@@ -96,8 +95,7 @@ test = [
9695
"ADTypes",
9796
"Aqua",
9897
"DataFrames",
99-
# "DifferentiationInterfaceTest",
100-
"Documenter",
98+
"DifferentiationInterfaceTest",
10199
"JET",
102100
"JuliaFormatter",
103101
"Pkg",

DifferentiationInterface/test/Double/Enzyme-ForwardDiff.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ using DifferentiationInterface, DifferentiationInterfaceTest
22
import DifferentiationInterface as DI
33
using Enzyme: Enzyme
44
using ForwardDiff: ForwardDiff
5-
using Zygote: Zygote
65

76
backends = [
87
SecondOrder(AutoForwardDiff(), AutoEnzyme(Enzyme.Forward)),
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
using Aqua: Aqua
2+
using DifferentiationInterface
3+
using Test
4+
5+
Aqua.test_all(
6+
DifferentiationInterface; ambiguities=false, deps_compat=(check_extras = false)
7+
)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
using DifferentiationInterface
2+
using JET: JET
3+
using Test
4+
5+
JET.test_package(DifferentiationInterface; target_defined_modules=true)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
using DifferentiationInterface
2+
using JuliaFormatter: JuliaFormatter
3+
using Test
4+
5+
@test JuliaFormatter.format(DifferentiationInterface; verbose=false, overwrite=false)

DifferentiationInterface/test/formal.jl

Lines changed: 0 additions & 22 deletions
This file was deleted.

DifferentiationInterface/test/runtests.jl

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,15 @@ using Pkg
44
using SparseConnectivityTracer
55
using Test
66

7-
push!(Base.LOAD_PATH, Base.active_project())
8-
Pkg.activate(; temp=true)
9-
10-
DI_PATH = joinpath(@__DIR__, "..", "..", "DifferentiationInterface")
7+
# DI_PATH = joinpath(@__DIR__, "..", "..", "DifferentiationInterface")
8+
# if isdir(DI_PATH)
9+
# Pkg.develop(; path=DI_PATH)
10+
# end
1111
DIT_PATH = joinpath(@__DIR__, "..", "..", "DifferentiationInterfaceTest")
12-
if isdir(DI_PATH)
13-
Pkg.develop(; path=DI_PATH)
14-
end
1512
if isdir(DIT_PATH)
1613
Pkg.develop(; path=DIT_PATH)
1714
end
1815

19-
BACKENDS_1_6 = [
20-
"FiniteDifferences", #
21-
"ForwardDiff",
22-
"ReverseDiff",
23-
"Tracker",
24-
"Zygote",
25-
]
26-
27-
BACKENDS_1_10 = [
28-
"Diffractor", #
29-
"Enzyme",
30-
"FiniteDiff",
31-
"FastDifferentiation",
32-
"PolyesterForwardDiff",
33-
"Symbolics",
34-
"Tapir",
35-
]
36-
37-
@static if VERSION >= v"1.10"
38-
Pkg.add(vcat(BACKENDS_1_6, BACKENDS_1_10))
39-
else
40-
Pkg.add(vcat(BACKENDS_1_6))
41-
end
42-
4316
function MyAutoSparse(backend::AbstractADType)
4417
coloring_algorithm = GreedyColoringAlgorithm()
4518
sparsity_detector = TracerSparsityDetector()
@@ -48,31 +21,60 @@ end
4821

4922
LOGGING = get(ENV, "CI", "false") == "false"
5023

24+
GROUP = get(ENV, "JULIA_DI_TEST_GROUP", "All")
25+
5126
## Main tests
5227

5328
@testset verbose = true "DifferentiationInterface.jl" begin
54-
@static if VERSION >= v"1.10"
55-
@info "Testing formalities"
56-
@testset verbose = true "Formal tests" begin
57-
include("formal.jl")
29+
if GROUP == "Formalities" || GROUP == "All"
30+
@testset "Formalities/$file" for file in readdir(joinpath(@__DIR__, "Formalities"))
31+
@info "Testing Formalities/$file)"
32+
include(joinpath(@__DIR__, "Formalities", file))
33+
end
34+
end
35+
36+
if GROUP == "Internals" || GROUP == "All"
37+
@testset "Internals/$file" for file in readdir(joinpath(@__DIR__, "Internals"))
38+
@info "Testing Internals/$file"
39+
include(joinpath(@__DIR__, "Internals", file))
5840
end
5941
end
6042

61-
@testset verbose = true "$folder" for folder in ["Single", "Double", "Internals"]
62-
folder_path = joinpath(@__DIR__, folder)
63-
@testset verbose = true "$(file[1:end-3])" for file in readdir(folder_path)
64-
endswith(file, ".jl") || continue
65-
if (
66-
VERSION < v"1.10" && any(
67-
part == backend for part in split(file[1:(end - 3)], '-') for
68-
backend in BACKENDS_1_10
69-
)
70-
)
71-
@info "Skipping $folder - $(file[1:end-3])"
72-
else
73-
@info "Testing $folder - $(file[1:end-3])"
74-
include(joinpath(folder_path, file))
43+
if GROUP == "All"
44+
Pkg.add([
45+
"Diffractor",
46+
"Enzyme",
47+
"FiniteDiff",
48+
"FiniteDifferences",
49+
"FastDifferentiation",
50+
"ForwardDiff",
51+
"PolyesterForwardDiff",
52+
"ReverseDiff",
53+
"Symbolics",
54+
"Tapir",
55+
"Tracker",
56+
"Zygote",
57+
])
58+
@testset verbose = true "$folder" for folder in ("Single", "Double")
59+
files = filter(f -> endswith(f, ".jl"), readdir(joinpath(@__DIR__, folder)))
60+
@testset "$file" for file in files
61+
@info "Testing $folder/$file"
62+
include(joinpath(@__DIR__, folder, file))
7563
end
7664
end
65+
elseif startswith(GROUP, "Single")
66+
b1 = split(GROUP, '/')[2]
67+
@testset "Single/$b1" begin
68+
@info "Testing Single/$b1"
69+
Pkg.add(b1)
70+
include(joinpath(@__DIR__, "Single", "$b1.jl"))
71+
end
72+
elseif startswith(GROUP, "Double")
73+
b1, b2 = split(split(GROUP, '/')[2], '-')
74+
@testset "Single/$b1-$b2" begin
75+
@info "Testing Double/$b1-$b2"
76+
Pkg.add([b1, b2])
77+
include(joinpath(@__DIR__, "Double", "$b1-$b2.jl"))
78+
end
7779
end
7880
end;

0 commit comments

Comments
 (0)