Skip to content

Commit a87b440

Browse files
authored
ci: add ubuntu-latest test pipelines (#19)
* ci: add ubuntu-latest test pipelines for highest/lowest torch Add 4 GitHub-hosted Linux pipelines that run on ubuntu-latest: - highest-torch slow, highest-torch fast - lowest-torch slow, lowest-torch fast Each runs the corresponding make target with --junit and uploads its test-results artifact. Ungated and independent of the macOS self-hosted jobs so they also run on forks. * ci: gate test matrix behind a tiered check/smoke/tutorials stage Introduce a tiered CI structure: - Tier 1 (ubuntu-latest, ungated): make check, make test-smoke, make test-tutorials. - Tier 2 (needs all of Tier 1): the 4 linux test pipelines and the macOS test run. Move `check` off the macOS self-hosted runner to ubuntu-latest and drop its repo gate so the gate also runs on forks (otherwise Tier 2 would be skipped there). test-smoke/test-tutorials targets are added by a separate change; until then those jobs fail and Tier 2 is skipped. * ci: set linux test pipeline timeout-minutes to 120 * build: gate pre-commit hook install behind INSTALL_PRECOMMIT Port the scripts/make changes from coreai-opt#497 so INSTALL_PRECOMMIT is a real knob: setup_env.sh defaults it (false in --ensure mode, true otherwise) and threads it to install_pre_commit_hooks.sh, which skips `pre-commit install -f` when INSTALL_PRECOMMIT=false. * ci: set INSTALL_PRECOMMIT=false for the test, smoke, and tutorial jobs Skip git-hook configuration during env setup for the 4 linux test jobs, the macOS test run, test-smoke, and test-tutorials. `check` is left as-is. * ci: collapse linux test jobs into a strategy matrix GitHub Actions doesn't support YAML anchors, so collapse the 4 linux-* test jobs into a single `linux-tests` job with a strategy.matrix over {highest,lowest} x {slow,fast}, declaring needs:/env:/steps once. Also drop the redundant "Stage 2 runs only if..." comment. * test: set strict=False on the resnet export xfail
1 parent aeee805 commit a87b440

4 files changed

Lines changed: 82 additions & 8 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ concurrency:
2020

2121
jobs:
2222

23+
# ── Stage 1: cheap correctness gate (ubuntu-latest, ungated). ──
2324
check:
24-
name: macOS / make check
25-
if: github.repository == 'apple/coreai-optimization'
26-
runs-on: [self-hosted, macos, tahoe, ARM64]
25+
name: Linux / make check
26+
runs-on: ubuntu-latest
2727
timeout-minutes: 30
2828
steps:
2929
- name: Check out repository
@@ -37,12 +37,47 @@ jobs:
3737
- name: Run `make check`
3838
run: make check
3939

40+
test-smoke:
41+
name: Linux / make test-smoke
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 60
44+
env:
45+
INSTALL_PRECOMMIT: "false"
46+
steps:
47+
- name: Check out repository
48+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
49+
- name: Install uv
50+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
51+
with:
52+
enable-cache: false
53+
- name: Run `make test-smoke`
54+
run: make test-smoke
55+
56+
test-tutorials:
57+
name: Linux / make test-tutorials
58+
runs-on: ubuntu-latest
59+
timeout-minutes: 60
60+
env:
61+
INSTALL_PRECOMMIT: "false"
62+
steps:
63+
- name: Check out repository
64+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
65+
- name: Install uv
66+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
67+
with:
68+
enable-cache: false
69+
- name: Run `make test-tutorials`
70+
run: make test-tutorials
71+
72+
# ── Stage 2: full test matrix, gated on Stage 1. ──
4073
macos-tests:
4174
name: macOS / make test-highest-pytorch / markers=not-slow
42-
needs: [check]
75+
needs: [check, test-smoke, test-tutorials]
4376
if: github.repository == 'apple/coreai-optimization'
4477
runs-on: [self-hosted, macos, tahoe, ARM64]
4578
timeout-minutes: 60
79+
env:
80+
INSTALL_PRECOMMIT: "false"
4681
steps:
4782
- name: Check out repository
4883
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -58,3 +93,31 @@ jobs:
5893
with:
5994
name: test-results-macos-highest-fast
6095
path: test-results/
96+
97+
linux-tests:
98+
name: Linux / make test-${{ matrix.torch }}-pytorch / markers=${{ matrix.speed == 'slow' && 'slow' || 'not-slow' }}
99+
needs: [check, test-smoke, test-tutorials]
100+
runs-on: ubuntu-latest
101+
timeout-minutes: 120
102+
env:
103+
INSTALL_PRECOMMIT: "false"
104+
strategy:
105+
fail-fast: false
106+
matrix:
107+
torch: [highest, lowest]
108+
speed: [slow, fast]
109+
steps:
110+
- name: Check out repository
111+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
112+
- name: Install uv
113+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
114+
with:
115+
enable-cache: false
116+
- name: Run `make test-${{ matrix.torch }}-pytorch`
117+
run: make test-${{ matrix.torch }}-pytorch PYTEST_ARGS="--marker '${{ matrix.speed == 'slow' && 'slow' || 'not slow' }}' --junit"
118+
- name: Upload test results
119+
if: always()
120+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
121+
with:
122+
name: test-results-linux-${{ matrix.torch }}-${{ matrix.speed }}
123+
path: test-results/

scripts/make/install_pre_commit_hooks.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,9 @@ if ! command -v lychee &>/dev/null; then
6060
fi
6161

6262
# Configure git hooks. Force-install so the shebang points to the current venv.
63-
uv run --no-sync --active pre-commit install -f
64-
echo "✓ Pre-commit hooks configured to use $VIRTUAL_ENV"
63+
if [[ "${INSTALL_PRECOMMIT:-true}" == "false" ]]; then
64+
echo "Skipping git hook configuration (INSTALL_PRECOMMIT=$INSTALL_PRECOMMIT)"
65+
else
66+
uv run --no-sync --active pre-commit install -f
67+
echo "✓ Pre-commit hooks configured to use $VIRTUAL_ENV"
68+
fi

scripts/make/setup_env.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@ while [[ $# -gt 0 ]]; do
195195
esac
196196
done
197197

198+
if [[ "$ENSURE_MODE" == true ]]; then
199+
INSTALL_PRECOMMIT="${INSTALL_PRECOMMIT:-false}"
200+
else
201+
INSTALL_PRECOMMIT="${INSTALL_PRECOMMIT:-true}"
202+
fi
203+
198204
# Validate required arguments
199205
if [[ -z "$PYTHON_VERSION" ]]; then
200206
echo "Error: --python-version is required"
@@ -339,11 +345,11 @@ echo "Running: ${SYNC_CMD[*]}"
339345
"${SYNC_CMD[@]}"
340346

341347
echo ""
342-
echo "[3/3] Configuring pre-commit hooks..."
348+
echo "[3/3] Installing hook dependencies and configuring pre-commit hooks..."
343349
if [[ "$VENV_PREEXISTED" == "true" ]]; then
344350
echo "Skipped (venv already exists, hooks already configured)"
345351
else
346-
"$SCRIPTS_DIR/make/install_pre_commit_hooks.sh" "$COREAI_OPT_HOME"
352+
INSTALL_PRECOMMIT="$INSTALL_PRECOMMIT" "$SCRIPTS_DIR/make/install_pre_commit_hooks.sh" "$COREAI_OPT_HOME"
347353
fi
348354

349355
echo ""

tests/export/test_graph_mode_mlir_export.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def test_mnist_export(
211211
"[Export Tests] ResNet50 graph-mode int8 quantization"
212212
" SNR falls below threshold on Linux (19.44 < 20.0)"
213213
),
214+
strict=False,
214215
)
215216
def test_resnet_export(
216217
resnet50_model: torch.nn.Module,

0 commit comments

Comments
 (0)