Skip to content

Commit 9ddce45

Browse files
committed
ci: dedupe workflow via composite setup action and linux test matrix
GitHub Actions doesn't support YAML anchors, so use its native DRY mechanisms instead: - Add a local composite action (.github/actions/setup) for the uv install step, used by all jobs. (checkout must stay per-job: a local action requires the repo to already be checked out.) - Collapse the 4 linux-* test jobs into a single `linux-tests` job with a strategy.matrix over {highest,lowest} x {slow,fast}, so needs:/env:/steps are declared once. - Drop the redundant "Stage 2 runs only if..." comment.
1 parent 883ce88 commit 9ddce45

2 files changed

Lines changed: 25 additions & 95 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Setup
2+
description: Install uv (cache disabled) for coreai-optimization CI jobs. Assumes the repository is already checked out.
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Install uv
8+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
9+
with:
10+
enable-cache: false

.github/workflows/ci.yaml

Lines changed: 15 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ concurrency:
2121
jobs:
2222

2323
# ── Stage 1: cheap correctness gate (ubuntu-latest, ungated). ──
24-
# Stage 2 runs only if all three of these pass.
2524
check:
2625
name: Linux / make check
2726
runs-on: ubuntu-latest
@@ -31,10 +30,7 @@ jobs:
3130
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
3231
with:
3332
fetch-depth: 0
34-
- name: Install uv
35-
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
36-
with:
37-
enable-cache: false
33+
- uses: ./.github/actions/setup
3834
- name: Run `make check`
3935
run: make check
4036

@@ -47,10 +43,7 @@ jobs:
4743
steps:
4844
- name: Check out repository
4945
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
50-
- name: Install uv
51-
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
52-
with:
53-
enable-cache: false
46+
- uses: ./.github/actions/setup
5447
- name: Run `make test-smoke`
5548
run: make test-smoke
5649

@@ -63,10 +56,7 @@ jobs:
6356
steps:
6457
- name: Check out repository
6558
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
66-
- name: Install uv
67-
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
68-
with:
69-
enable-cache: false
59+
- uses: ./.github/actions/setup
7060
- name: Run `make test-tutorials`
7161
run: make test-tutorials
7262

@@ -82,10 +72,7 @@ jobs:
8272
steps:
8373
- name: Check out repository
8474
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
85-
- name: Install uv
86-
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
87-
with:
88-
enable-cache: false
75+
- uses: ./.github/actions/setup
8976
- name: Run `make test-highest-pytorch`
9077
run: make test-highest-pytorch PYTEST_ARGS="--marker 'not slow' --junit"
9178
- name: Upload test results
@@ -95,94 +82,27 @@ jobs:
9582
name: test-results-macos-highest-fast
9683
path: test-results/
9784

98-
linux-highest-slow:
99-
name: Linux / make test-highest-pytorch / markers=slow
85+
linux-tests:
86+
name: Linux / make test-${{ matrix.torch }}-pytorch / markers=${{ matrix.speed == 'slow' && 'slow' || 'not-slow' }}
10087
needs: [check, test-smoke, test-tutorials]
10188
runs-on: ubuntu-latest
10289
timeout-minutes: 120
10390
env:
10491
INSTALL_PRECOMMIT: "false"
92+
strategy:
93+
fail-fast: false
94+
matrix:
95+
torch: [highest, lowest]
96+
speed: [slow, fast]
10597
steps:
10698
- name: Check out repository
10799
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
108-
- name: Install uv
109-
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
110-
with:
111-
enable-cache: false
112-
- name: Run `make test-highest-pytorch`
113-
run: make test-highest-pytorch PYTEST_ARGS="--marker slow --junit"
114-
- name: Upload test results
115-
if: always()
116-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
117-
with:
118-
name: test-results-linux-highest-slow
119-
path: test-results/
120-
121-
linux-highest-fast:
122-
name: Linux / make test-highest-pytorch / markers=not-slow
123-
needs: [check, test-smoke, test-tutorials]
124-
runs-on: ubuntu-latest
125-
timeout-minutes: 120
126-
env:
127-
INSTALL_PRECOMMIT: "false"
128-
steps:
129-
- name: Check out repository
130-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
131-
- name: Install uv
132-
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
133-
with:
134-
enable-cache: false
135-
- name: Run `make test-highest-pytorch`
136-
run: make test-highest-pytorch PYTEST_ARGS="--marker 'not slow' --junit"
137-
- name: Upload test results
138-
if: always()
139-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
140-
with:
141-
name: test-results-linux-highest-fast
142-
path: test-results/
143-
144-
linux-lowest-slow:
145-
name: Linux / make test-lowest-pytorch / markers=slow
146-
needs: [check, test-smoke, test-tutorials]
147-
runs-on: ubuntu-latest
148-
timeout-minutes: 120
149-
env:
150-
INSTALL_PRECOMMIT: "false"
151-
steps:
152-
- name: Check out repository
153-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
154-
- name: Install uv
155-
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
156-
with:
157-
enable-cache: false
158-
- name: Run `make test-lowest-pytorch`
159-
run: make test-lowest-pytorch PYTEST_ARGS="--marker slow --junit"
160-
- name: Upload test results
161-
if: always()
162-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
163-
with:
164-
name: test-results-linux-lowest-slow
165-
path: test-results/
166-
167-
linux-lowest-fast:
168-
name: Linux / make test-lowest-pytorch / markers=not-slow
169-
needs: [check, test-smoke, test-tutorials]
170-
runs-on: ubuntu-latest
171-
timeout-minutes: 120
172-
env:
173-
INSTALL_PRECOMMIT: "false"
174-
steps:
175-
- name: Check out repository
176-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
177-
- name: Install uv
178-
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
179-
with:
180-
enable-cache: false
181-
- name: Run `make test-lowest-pytorch`
182-
run: make test-lowest-pytorch PYTEST_ARGS="--marker 'not slow' --junit"
100+
- uses: ./.github/actions/setup
101+
- name: Run `make test-${{ matrix.torch }}-pytorch`
102+
run: make test-${{ matrix.torch }}-pytorch PYTEST_ARGS="--marker '${{ matrix.speed == 'slow' && 'slow' || 'not slow' }}' --junit"
183103
- name: Upload test results
184104
if: always()
185105
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
186106
with:
187-
name: test-results-linux-lowest-fast
107+
name: test-results-linux-${{ matrix.torch }}-${{ matrix.speed }}
188108
path: test-results/

0 commit comments

Comments
 (0)