Skip to content

Commit af97b0a

Browse files
authored
Modernize test workflow (#382)
* refactor tests to be more modular * switch to ParallelTestRunner * switch to TensorKitTensors * separate out changebonds tests * reduce CI runner pressure * try update tests * small fixes * make tests trigger on draft status * more attempts * more more attempts * more more attempts * more more more attempts * more more more more attempts
1 parent b3427bc commit af97b0a

37 files changed

Lines changed: 2517 additions & 2387 deletions

.github/workflows/Tests.yml

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ 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:
@@ -17,30 +18,49 @@ concurrency:
1718
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
1819

1920
jobs:
21+
setup-matrix:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
matrix: ${{ steps.mk.outputs.matrix }}
25+
steps:
26+
- id: mk
27+
shell: bash
28+
run: |
29+
# Draft PR: only run ubuntu-latest + version=1 (all groups)
30+
if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.draft }}" == "true" ]]; then
31+
cat >> "$GITHUB_OUTPUT" <<'EOF'
32+
matrix={"version":["1"],"os":["ubuntu-latest"],"group":["states","operators","algorithms","multifusion","misc"]}
33+
EOF
34+
else
35+
cat >> "$GITHUB_OUTPUT" <<'EOF'
36+
matrix={"version":["lts","1"],"os":["ubuntu-latest","windows-latest","macOS-latest"],"group":["states","operators","algorithms","multifusion","misc"]}
37+
EOF
38+
fi
39+
2040
tests:
2141
name: "Tests"
42+
needs: setup-matrix
2243
strategy:
2344
fail-fast: false
24-
matrix:
25-
version:
26-
- 'lts' # minimal supported version
27-
- '1' # latest released Julia version
28-
group:
29-
- states
30-
- operators
31-
- algorithms
32-
- multifusion
33-
- other
34-
os:
35-
- ubuntu-latest
36-
- macOS-latest
37-
- windows-latest
38-
uses: "QuantumKitHub/QuantumKitHubActions/.github/workflows/Tests.yml@main"
39-
with:
40-
group: "${{ matrix.group }}"
41-
nthreads: 4
42-
julia-version: "${{ matrix.version }}"
43-
os: "${{ matrix.os }}"
44-
timeout-minutes: 120
45-
secrets:
46-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
45+
matrix: ${{ fromJSON(needs.setup-matrix.outputs.matrix) }}
46+
47+
runs-on: ${{ matrix.os }}
48+
steps:
49+
- uses: actions/checkout@v4
50+
- uses: julia-actions/setup-julia@v2
51+
with:
52+
version: ${{ matrix.version }}
53+
- uses: julia-actions/cache@v2
54+
- uses: julia-actions/julia-buildpkg@v1
55+
- uses: julia-actions/julia-runtest@v1
56+
timeout-minutes: 120
57+
with:
58+
test_args: '--jobs=1 ${{ matrix.group }}'
59+
- uses: julia-actions/julia-processcoverage@v1
60+
with:
61+
directories: 'src,ext'
62+
- uses: codecov/codecov-action@v5
63+
with:
64+
files: lcov.info
65+
token: "${{ secrets.CODECOV_TOKEN }}"
66+
fail_ci_if_error: true

Project.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ LoggingExtras = "~1.0"
3737
MatrixAlgebraKit = "0.6"
3838
OhMyThreads = "0.7, 0.8"
3939
OptimKit = "0.3.1, 0.4"
40+
ParallelTestRunner = "2"
4041
Pkg = "1"
4142
Plots = "1.40"
4243
Printf = "1"
4344
Random = "1"
4445
RecipesBase = "1.1"
4546
TensorKit = "0.16"
4647
TensorKitManifolds = "0.7"
48+
TensorKitTensors = "0.2"
4749
TensorOperations = "5"
4850
Test = "1"
4951
TestExtras = "0.3"
@@ -53,10 +55,12 @@ julia = "1.10"
5355
[extras]
5456
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
5557
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
58+
ParallelTestRunner = "d3525ed8-44d0-4b2c-a655-542cee43accc"
5659
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
5760
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
61+
TensorKitTensors = "41b62e7d-e9d1-4e23-942c-79a97adf954b"
5862
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
5963
TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a"
6064

6165
[targets]
62-
test = ["Aqua", "Pkg", "Test", "TestExtras", "Plots", "Combinatorics"]
66+
test = ["Aqua", "Pkg", "Test", "TestExtras", "Plots", "Combinatorics", "ParallelTestRunner", "TensorKitTensors"]

0 commit comments

Comments
 (0)