Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 67 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ concurrency:

jobs:

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

test-smoke:
name: Linux / make test-smoke
runs-on: ubuntu-latest
timeout-minutes: 60
env:
INSTALL_PRECOMMIT: "false"
steps:
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: false
- name: Run `make test-smoke`
run: make test-smoke

test-tutorials:
name: Linux / make test-tutorials
runs-on: ubuntu-latest
timeout-minutes: 60
env:
INSTALL_PRECOMMIT: "false"
steps:
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: false
- name: Run `make test-tutorials`
run: make test-tutorials

# ── Stage 2: full test matrix, gated on Stage 1. ──
macos-tests:
name: macOS / make test-highest-pytorch / markers=not-slow
needs: [check]
needs: [check, test-smoke, test-tutorials]
Comment thread
guru-desh marked this conversation as resolved.
if: github.repository == 'apple/coreai-optimization'
runs-on: [self-hosted, macos, tahoe, ARM64]
timeout-minutes: 60
env:
INSTALL_PRECOMMIT: "false"
steps:
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
Expand All @@ -58,3 +93,31 @@ jobs:
with:
name: test-results-macos-highest-fast
path: test-results/

linux-tests:
name: Linux / make test-${{ matrix.torch }}-pytorch / markers=${{ matrix.speed == 'slow' && 'slow' || 'not-slow' }}
needs: [check, test-smoke, test-tutorials]
runs-on: ubuntu-latest
timeout-minutes: 120
env:
INSTALL_PRECOMMIT: "false"
strategy:
fail-fast: false
matrix:
torch: [highest, lowest]
speed: [slow, fast]
steps:
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: false
- name: Run `make test-${{ matrix.torch }}-pytorch`
run: make test-${{ matrix.torch }}-pytorch PYTEST_ARGS="--marker '${{ matrix.speed == 'slow' && 'slow' || 'not slow' }}' --junit"
- name: Upload test results
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: test-results-linux-${{ matrix.torch }}-${{ matrix.speed }}
path: test-results/
8 changes: 6 additions & 2 deletions scripts/make/install_pre_commit_hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,9 @@ if ! command -v lychee &>/dev/null; then
fi

# Configure git hooks. Force-install so the shebang points to the current venv.
uv run --no-sync --active pre-commit install -f
echo "✓ Pre-commit hooks configured to use $VIRTUAL_ENV"
if [[ "${INSTALL_PRECOMMIT:-true}" == "false" ]]; then
echo "Skipping git hook configuration (INSTALL_PRECOMMIT=$INSTALL_PRECOMMIT)"
else
uv run --no-sync --active pre-commit install -f
echo "✓ Pre-commit hooks configured to use $VIRTUAL_ENV"
fi
10 changes: 8 additions & 2 deletions scripts/make/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ while [[ $# -gt 0 ]]; do
esac
done

if [[ "$ENSURE_MODE" == true ]]; then
INSTALL_PRECOMMIT="${INSTALL_PRECOMMIT:-false}"
else
INSTALL_PRECOMMIT="${INSTALL_PRECOMMIT:-true}"
fi

# Validate required arguments
if [[ -z "$PYTHON_VERSION" ]]; then
echo "Error: --python-version is required"
Expand Down Expand Up @@ -339,11 +345,11 @@ echo "Running: ${SYNC_CMD[*]}"
"${SYNC_CMD[@]}"

echo ""
echo "[3/3] Configuring pre-commit hooks..."
echo "[3/3] Installing hook dependencies and configuring pre-commit hooks..."
if [[ "$VENV_PREEXISTED" == "true" ]]; then
echo "Skipped (venv already exists, hooks already configured)"
else
"$SCRIPTS_DIR/make/install_pre_commit_hooks.sh" "$COREAI_OPT_HOME"
INSTALL_PRECOMMIT="$INSTALL_PRECOMMIT" "$SCRIPTS_DIR/make/install_pre_commit_hooks.sh" "$COREAI_OPT_HOME"
fi

echo ""
Expand Down
1 change: 1 addition & 0 deletions tests/export/test_graph_mode_mlir_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ def test_mnist_export(
"[Export Tests] ResNet50 graph-mode int8 quantization"
" SNR falls below threshold on Linux (19.44 < 20.0)"
),
strict=False,
)
def test_resnet_export(
resnet50_model: torch.nn.Module,
Expand Down