Skip to content

Commit e2b0655

Browse files
authored
Update github actions (#421)
* update CompatCheck to only run on project.toml-changing PRs * update test CI
1 parent d29d4d1 commit e2b0655

3 files changed

Lines changed: 21 additions & 97 deletions

File tree

.github/workflows/CI.yml

Lines changed: 9 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ on:
44
push:
55
branches:
66
- 'main'
7-
- 'release-'
8-
97
tags: '*'
10-
118
paths-ignore:
129
- 'docs/**'
1310
pull_request:
@@ -16,92 +13,15 @@ on:
1613

1714
concurrency:
1815
group: ${{ github.workflow }}-${{ github.ref }}
19-
# Cancel intermediate builds: only if it is a pull request build.
2016
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
2117

2218
jobs:
23-
setup-matrix:
24-
runs-on: ubuntu-latest
25-
outputs:
26-
groups: ${{ steps.mk.outputs.groups }}
27-
version: ${{ steps.mk.outputs.version }}
28-
os: ${{ steps.mk.outputs.os }}
29-
steps:
30-
- uses: actions/checkout@v6
31-
- id: mk
32-
shell: bash
33-
run: |
34-
# Auto-discover test groups from all subdirectory names.
35-
groups=$(find test -mindepth 1 -maxdepth 1 -type d \
36-
| xargs -I{} basename {} | sort \
37-
| jq -R -s -c '[split("\n")[] | select(length > 0)]')
38-
39-
echo "groups=${groups}" >> "$GITHUB_OUTPUT"
40-
41-
# Draft PR: only run ubuntu-latest + version=1
42-
if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.draft }}" == "true" ]]; then
43-
echo 'version=["1"]' >> "$GITHUB_OUTPUT"
44-
echo 'os=["ubuntu-latest"]' >> "$GITHUB_OUTPUT"
45-
else
46-
echo 'version=["lts","1"]' >> "$GITHUB_OUTPUT"
47-
echo 'os=["ubuntu-latest","macOS-latest","windows-latest"]' >> "$GITHUB_OUTPUT"
48-
fi
49-
50-
test:
51-
name: "Tests (${{ matrix.group }}, ${{ matrix.os }}, Julia ${{ matrix.version }})"
52-
needs: setup-matrix
53-
strategy:
54-
fail-fast: false
55-
matrix:
56-
version: ${{ fromJSON(needs.setup-matrix.outputs.version) }}
57-
os: ${{ fromJSON(needs.setup-matrix.outputs.os) }}
58-
group: ${{ fromJSON(needs.setup-matrix.outputs.groups) }}
59-
runs-on: ${{ matrix.os }}
60-
timeout-minutes: 120
61-
steps:
62-
- uses: actions/checkout@v6
63-
- uses: julia-actions/setup-julia@v3
64-
with:
65-
version: ${{ matrix.version }}
66-
- uses: julia-actions/cache@v3
67-
- uses: julia-actions/julia-buildpkg@v1
68-
- uses: julia-actions/julia-runtest@v1
69-
with:
70-
test_args: '${{ matrix.group }}${{ github.event.pull_request.draft == true && '' --fast'' || '''' }}'
71-
env:
72-
JULIA_NUM_THREADS: "4"
73-
- uses: julia-actions/julia-processcoverage@v1
74-
with:
75-
directories: 'src,ext'
76-
- uses: codecov/codecov-action@v6
77-
with:
78-
files: lcov.info
79-
token: ${{ secrets.CODECOV_TOKEN }}
80-
fail_ci_if_error: false
81-
82-
# test-nightly:
83-
# name: "Tests (${{ matrix.group }}, ${{ matrix.os }}, Julia nightly)"
84-
# needs: [setup-matrix, test]
85-
# if: github.event.pull_request.draft != true
86-
# strategy:
87-
# fail-fast: false
88-
# matrix:
89-
# version:
90-
# - 'nightly'
91-
# group: ${{ fromJSON(needs.setup-matrix.outputs.groups) }}
92-
# os:
93-
# - ubuntu-latest
94-
# - macOS-latest
95-
# - windows-latest
96-
# runs-on: ${{ matrix.os }}
97-
# timeout-minutes: 120
98-
# steps:
99-
# - uses: actions/checkout@v6
100-
# - uses: julia-actions/setup-julia@v3
101-
# with:
102-
# version: ${{ matrix.version }}
103-
# - uses: julia-actions/cache@v3
104-
# - uses: julia-actions/julia-buildpkg@v1
105-
# - uses: julia-actions/julia-runtest@v1
106-
# with:
107-
# test_args: '${{ matrix.group }}'
19+
tests:
20+
name: "Tests"
21+
uses: "QuantumKitHub/QuantumKitHubActions/.github/workflows/TestGroups.yml@main"
22+
with:
23+
fast: "${{ github.event.pull_request.draft == true }}"
24+
exclude: '["cuda", "amd"]'
25+
timeout-minutes: 120
26+
secrets:
27+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/CompatCheck.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414

1515
pull_request:
1616
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft]
17+
paths:
18+
- 'Project.toml'
19+
- 'test/Project.toml'
1720
workflow_dispatch:
1821

1922
concurrency:

test/runtests.jl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,19 @@ if (Sys.isapple() && get(ENV, "CI", "false") == "true") || !isempty(VERSION.prer
2626
filter!(!startswith("mooncake") first, testsuite)
2727
end
2828

29+
args = parse_args(ARGS; custom = ["fast"])
2930
# --fast: skip AD tests and inject fast_tests=true into each worker sandbox
30-
fast = "--fast" in ARGS
31-
filtered_args = filter(!=("--fast"), ARGS)
32-
# if fast
33-
# filter!(!startswith("chainrules") ∘ first, testsuite)
34-
# filter!(!startswith("mooncake") ∘ first, testsuite)
35-
# end
31+
fast = !isnothing(args.custom["fast"])
32+
3633
setup_path = joinpath(@__DIR__, "setup.jl")
37-
init_code = quote
34+
const init_worker_code = quote
3835
const fast_tests = $fast
3936
include($setup_path)
4037
using .TestSetup
4138
end
39+
const init_code = quote
40+
using ..TestSetup
41+
const fast_tests = $fast
42+
end
4243

43-
ParallelTestRunner.runtests(TensorKit, filtered_args; testsuite, init_code)
44+
ParallelTestRunner.runtests(TensorKit, args; init_worker_code, init_code)

0 commit comments

Comments
 (0)