Skip to content

Commit dd05ae9

Browse files
kshyattlkdvosKatharine Hyatt
authored
Use a test setup matrix like TensorKit (#215)
* Use a test setup matrix like TensorKit * Try to exclude Enzyme on macOS * Apply suggestions from code review Co-authored-by: Lukas Devos <ldevos98@gmail.com> * Try filtering * Move stuff into subdirectories * Fix paths * Suggestions --------- Co-authored-by: Lukas Devos <ldevos98@gmail.com> Co-authored-by: Katharine Hyatt <katharine.s.hyatt@gmail.com>
1 parent 5dec49b commit dd05ae9

15 files changed

Lines changed: 73 additions & 30 deletions

File tree

.github/workflows/Tests.yml

Lines changed: 63 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,76 @@ on:
99
paths-ignore:
1010
- 'docs/**'
1111
pull_request:
12+
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft]
1213
workflow_dispatch:
1314

1415
concurrency:
1516
group: ${{ github.workflow }}-${{ github.ref }}
1617
# Cancel intermediate builds: only if it is a pull request build.
1718
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
18-
1919
jobs:
20-
tests:
21-
name: "Tests"
20+
setup-matrix:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
groups: ${{ steps.mk.outputs.groups }}
24+
version: ${{ steps.mk.outputs.version }}
25+
os: ${{ steps.mk.outputs.os }}
26+
steps:
27+
- uses: actions/checkout@v6
28+
- id: mk
29+
shell: bash
30+
run: |
31+
# Auto-discover test groups from all subdirectory names.
32+
groups=$(find test -mindepth 1 -maxdepth 1 -type d \
33+
| xargs -I{} basename {} | sort \
34+
| jq -R -s -c '[split("\n")[] | select(length > 0) | select(.!= "testsuite")]')
35+
36+
echo "groups=${groups}" >> "$GITHUB_OUTPUT"
37+
38+
# Draft PR: only run ubuntu-latest + version=1
39+
if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.draft }}" == "true" ]]; then
40+
echo 'version=["1"]' >> "$GITHUB_OUTPUT"
41+
echo 'os=["ubuntu-latest"]' >> "$GITHUB_OUTPUT"
42+
else
43+
echo 'version=["min","1"]' >> "$GITHUB_OUTPUT"
44+
echo 'os=["ubuntu-latest","macOS-latest","windows-latest"]' >> "$GITHUB_OUTPUT"
45+
fi
46+
47+
test:
48+
name: "Tests (${{ matrix.group }}, ${{ matrix.os }}, Julia ${{ matrix.version }})"
49+
needs: setup-matrix
2250
strategy:
2351
fail-fast: false
2452
matrix:
25-
version:
26-
- 'lts' # minimal supported version
27-
- '1' # latest released Julia version
28-
# group:
29-
os:
30-
- ubuntu-latest
31-
- macOS-latest
32-
- windows-latest
33-
uses: "QuantumKitHub/QuantumKitHubActions/.github/workflows/Tests.yml@main"
34-
with:
35-
group: "${{ matrix.group }}"
36-
nthreads: 4
37-
julia-version: "${{ matrix.version }}"
38-
os: "${{ matrix.os }}"
39-
timeout-minutes: 120
40-
secrets:
41-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
53+
version: ${{ fromJSON(needs.setup-matrix.outputs.version) }}
54+
os: ${{ fromJSON(needs.setup-matrix.outputs.os) }}
55+
group: ${{ fromJSON(needs.setup-matrix.outputs.groups) }}
56+
exclude:
57+
- os: macos-latest
58+
version: 1
59+
group: enzyme
60+
- os: macos-latest
61+
version: "min"
62+
group: enzyme
63+
runs-on: ${{ matrix.os }}
64+
timeout-minutes: 120
65+
steps:
66+
- uses: actions/checkout@v6
67+
- uses: julia-actions/setup-julia@v3
68+
with:
69+
version: ${{ matrix.version }}
70+
- uses: julia-actions/cache@v3
71+
- uses: julia-actions/julia-buildpkg@v1
72+
- uses: julia-actions/julia-runtest@v1
73+
with:
74+
test_args: '${{ matrix.group }}${{ github.event.pull_request.draft == true && '' --fast'' || '''' }}'
75+
env:
76+
JULIA_NUM_THREADS: "4"
77+
- uses: julia-actions/julia-processcoverage@v1
78+
with:
79+
directories: 'src,ext'
80+
- uses: codecov/codecov-action@v6
81+
with:
82+
files: lcov.info
83+
token: ${{ secrets.CODECOV_TOKEN }}
84+
fail_ci_if_error: false
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using Test
44
#BLASFloats = (Float32, Float64, ComplexF32, ComplexF64)
55
BLASFloats = (Float32, ComplexF64) # full suite is too expensive on CI
66

7-
@isdefined(TestSuite) || include("testsuite/TestSuite.jl")
7+
@isdefined(TestSuite) || include("../testsuite/TestSuite.jl")
88
using .TestSuite
99

1010
is_buildkite = get(ENV, "BUILDKITE", "false") == "true"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ using CUDA, AMDGPU
88
BLASFloats = (Float32, Float64, ComplexF32, ComplexF64)
99
GenericFloats = (BigFloat, Complex{BigFloat})
1010

11-
@isdefined(TestSuite) || include("testsuite/TestSuite.jl")
11+
@isdefined(TestSuite) || include("../testsuite/TestSuite.jl")
1212
using .TestSuite
1313

1414
is_buildkite = get(ENV, "BUILDKITE", "false") == "true"

test/eig.jl renamed to test/decompositions/eig.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ using CUDA, AMDGPU
99
BLASFloats = (Float32, Float64, ComplexF32, ComplexF64)
1010
GenericFloats = (BigFloat, Complex{BigFloat})
1111

12-
@isdefined(TestSuite) || include("testsuite/TestSuite.jl")
12+
@isdefined(TestSuite) || include("../testsuite/TestSuite.jl")
1313
using .TestSuite
1414

1515
is_buildkite = get(ENV, "BUILDKITE", "false") == "true"

test/eigh.jl renamed to test/decompositions/eigh.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ using CUDA, AMDGPU
88
BLASFloats = (Float32, Float64, ComplexF32, ComplexF64)
99
GenericFloats = (BigFloat, Complex{BigFloat})
1010

11-
@isdefined(TestSuite) || include("testsuite/TestSuite.jl")
11+
@isdefined(TestSuite) || include("../testsuite/TestSuite.jl")
1212
using .TestSuite
1313

1414
is_buildkite = get(ENV, "BUILDKITE", "false") == "true"

test/lq.jl renamed to test/decompositions/lq.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ using CUDA, AMDGPU, GenericLinearAlgebra
99
BLASFloats = (Float32, Float64, ComplexF32, ComplexF64)
1010
GenericFloats = (Float16, BigFloat, Complex{BigFloat})
1111

12-
@isdefined(TestSuite) || include("testsuite/TestSuite.jl")
12+
@isdefined(TestSuite) || include("../testsuite/TestSuite.jl")
1313
using .TestSuite
1414

1515
is_buildkite = get(ENV, "BUILDKITE", "false") == "true"

0 commit comments

Comments
 (0)