Skip to content

Commit 571133f

Browse files
authored
Clean up tests (#248)
* Clean up tests * Simplify workflow name * Add DIT to test deps of DI * Fix circular dep * Separate test deps for DI * Dev main package * Rm Manifest * No reresolve * Do dev in test code * using Pkg
1 parent 103b3c1 commit 571133f

14 files changed

Lines changed: 175 additions & 159 deletions

File tree

.github/workflows/CI.yml

Lines changed: 0 additions & 103 deletions
This file was deleted.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags: ['*']
8+
pull_request:
9+
workflow_dispatch:
10+
11+
concurrency:
12+
# Skip intermediate builds: always.
13+
# Cancel intermediate builds: only if it is a pull request build.
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
16+
17+
jobs:
18+
19+
docs:
20+
name: ${{ matrix.pkg.name }}
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: write
24+
statuses: write
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
pkg:
29+
- name: DifferentiationInterface
30+
dir: './DifferentiationInterface'
31+
- name: DifferentiationInterfaceTest
32+
dir: './DifferentiationInterfaceTest'
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: julia-actions/setup-julia@v2
37+
with:
38+
version: '1'
39+
- uses: julia-actions/cache@v1
40+
- name: Install dependencies
41+
run: julia --project=${{ matrix.pkg.dir}}/docs/ -e '
42+
using Pkg;
43+
Pkg.Registry.update();
44+
if "${{ matrix.pkg.name}}" == "DifferentiationInterface";
45+
Pkg.develop(PackageSpec(path="./DifferentiationInterface"));
46+
else;
47+
Pkg.develop([PackageSpec(path="./DifferentiationInterface"), PackageSpec(path="${{ matrix.pkg.dir}}")]);
48+
end;
49+
Pkg.instantiate();'
50+
- name: Build and deploy
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
53+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key
54+
run: julia --project=${{ matrix.pkg.dir}}/docs/ ${{ matrix.pkg.dir}}/docs/make.jl

.github/workflows/Test.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags: ['*']
8+
pull_request:
9+
workflow_dispatch:
10+
11+
concurrency:
12+
# Skip intermediate builds: always.
13+
# Cancel intermediate builds: only if it is a pull request build.
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
16+
17+
jobs:
18+
19+
test:
20+
name: ${{ matrix.pkg.name }} - Julia ${{ matrix.version }}
21+
runs-on: ${{ matrix.os }}
22+
timeout-minutes: 60
23+
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
24+
actions: write
25+
contents: read
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
pkg:
30+
- name: DifferentiationInterface
31+
dir: './DifferentiationInterface'
32+
- name: DifferentiationInterfaceTest
33+
dir: './DifferentiationInterfaceTest'
34+
version:
35+
- '1'
36+
os:
37+
- ubuntu-latest
38+
arch:
39+
- x64
40+
41+
steps:
42+
- uses: actions/checkout@v4
43+
- uses: julia-actions/setup-julia@v2
44+
with:
45+
version: ${{ matrix.version }}
46+
arch: ${{ matrix.arch }}
47+
- uses: julia-actions/cache@v2
48+
- uses: julia-actions/julia-buildpkg@v1
49+
- uses: julia-actions/julia-runtest@v1
50+
with:
51+
project: ${{ matrix.pkg.dir }}
52+
- uses: julia-actions/julia-processcoverage@v1
53+
with:
54+
directories: ${{ matrix.pkg.dir }}/src,${{ matrix.pkg.dir }}/ext
55+
- uses: codecov/codecov-action@v4
56+
with:
57+
files: lcov.info
58+
token: ${{ secrets.CODECOV_TOKEN }}
59+
fail_ci_if_error: true

DifferentiationInterface/Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ ReverseDiff = "1.15.1"
5858
SparseArrays = "1"
5959
Symbolics = "5.27.1"
6060
Tapir = "0.2.4"
61-
Test = "1"
6261
Tracker = "0.2.33"
6362
Zygote = "0.6.69"
6463
julia = "1.10"
@@ -67,6 +66,7 @@ julia = "1.10"
6766
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
6867
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
6968
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
69+
DifferentiationInterfaceTest = "a82114a7-5aa3-49a8-9643-716bb13727a3"
7070
Diffractor = "9f5e2b26-1114-432f-b630-d3fe2085c51c"
7171
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
7272
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
@@ -92,6 +92,7 @@ test = [
9292
"ADTypes",
9393
"Aqua",
9494
"DataFrames",
95+
"DifferentiationInterfaceTest",
9596
"Diffractor",
9697
"Documenter",
9798
"Enzyme",

DifferentiationInterface/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# DifferentiationInterface
44

5-
[![Build Status](https://github.com/gdalle/DifferentiationInterface.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/gdalle/DifferentiationInterface.jl/actions/workflows/CI.yml?query=branch%3Amain)
5+
[![Build Status](https://github.com/gdalle/DifferentiationInterface.jl/actions/workflows/Test.yml/badge.svg?branch=main)](https://github.com/gdalle/DifferentiationInterface.jl/actions/workflows/Test.yml?query=branch%3Amain)
66
[![Coverage](https://codecov.io/gh/gdalle/DifferentiationInterface.jl/branch/main/graph/badge.svg)](https://app.codecov.io/gh/gdalle/DifferentiationInterface.jl)
77
[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle)
88
[![DOI](https://zenodo.org/badge/740973714.svg)](https://zenodo.org/doi/10.5281/zenodo.11092033)

DifferentiationInterface/test/formal.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ using DifferentiationInterface
33
using Documenter: Documenter
44
using JET: JET
55
using JuliaFormatter: JuliaFormatter
6+
using Test
67

78
@testset "Aqua" begin
89
Aqua.test_all(

DifferentiationInterface/test/runtests.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
using Pkg
2-
Pkg.develop(
3-
Pkg.PackageSpec(; path=joinpath(@__DIR__, "..", "..", "DifferentiationInterfaceTest"))
4-
)
5-
61
using ADTypes
72
using DifferentiationInterface
3+
using Pkg
84
using SparseConnectivityTracer: SparseConnectivityTracer
95
using Test
106

7+
DIT_PATH = joinpath(@__DIR__, "..", "..", "DifferentiationInterfaceTest")
8+
if isdir(DIT_PATH)
9+
Pkg.develop(; path=DIT_PATH)
10+
end
11+
1112
function MyAutoSparse(backend::AbstractADType)
1213
coloring_algorithm = DifferentiationInterface.GreedyColoringAlgorithm()
1314
sparsity_detector = SparseConnectivityTracer.TracerSparsityDetector()

DifferentiationInterfaceTest/Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
4242
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
4343
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
4444
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
45-
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
45+
SparseConnectivityTracer = "9f842d2f-2579-4b1d-911e-f412cf18a3f5"
4646
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4747

4848
[targets]
49-
test = ["ADTypes", "Aqua", "DataFrames", "DifferentiationInterface", "ForwardDiff", "JET", "JuliaFormatter", "Pkg", "SparseArrays", "Symbolics", "Test"]
49+
test = ["ADTypes", "Aqua", "DataFrames", "DifferentiationInterface", "ForwardDiff", "JET", "JuliaFormatter", "Pkg", "SparseArrays", "SparseConnectivityTracer", "Test"]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using DifferentiationInterface
2+
using DifferentiationInterfaceTest
3+
using Aqua: Aqua
4+
using JET: JET
5+
using JuliaFormatter: JuliaFormatter
6+
using Test
7+
8+
@testset "Aqua" begin
9+
Aqua.test_all(
10+
DifferentiationInterfaceTest; ambiguities=false, deps_compat=(check_extras = false)
11+
)
12+
end
13+
@testset "JuliaFormatter" begin
14+
@test JuliaFormatter.format(
15+
DifferentiationInterfaceTest; verbose=false, overwrite=false
16+
)
17+
end
18+
@testset verbose = true "JET" begin
19+
JET.test_package(DifferentiationInterfaceTest; target_defined_modules=true)
20+
end

DifferentiationInterfaceTest/test/forwarddiff.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
using DifferentiationInterface
2+
using DifferentiationInterfaceTest
3+
using ForwardDiff: ForwardDiff
4+
15
test_differentiation(AutoForwardDiff(); logging=get(ENV, "CI", "false") == "false")
26

3-
#=
47
test_differentiation(
5-
AutoSparse(AutoForwardDiff()),
8+
MyAutoSparse(AutoForwardDiff()),
69
sparse_scenarios();
710
sparsity=true,
811
logging=get(ENV, "CI", "false") == "false",
912
)
10-
=#
1113

1214
test_differentiation(
1315
AutoForwardDiff(),

0 commit comments

Comments
 (0)