|
1 | | -name: CI (lean) |
| 1 | +name: CI (uv) |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
|
7 | 7 | branches: [ main ] |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - build: |
11 | | - runs-on: ubuntu-latest |
| 10 | + test: |
| 11 | + name: Tests (${{ matrix.os }} | py${{ matrix.python-version }}) |
| 12 | + runs-on: ${{ matrix.os }} |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + os: [ubuntu-latest, macos-14, windows-latest] |
| 17 | + python-version: ["3.11"] |
| 18 | + |
| 19 | + env: |
| 20 | + PIP_DISABLE_PIP_VERSION_CHECK: "1" |
| 21 | + PYTHONUNBUFFERED: "1" |
| 22 | + # Make pytest output calm but useful |
| 23 | + PYTEST_ADDOPTS: "-q --maxfail=1 -ra" |
| 24 | + # Ensure tests can import workbench_core from repo root |
| 25 | + PYTHONPATH: ${{ github.workspace }} |
| 26 | + |
12 | 27 | steps: |
13 | | - - uses: actions/checkout@v4 |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v4 |
14 | 30 |
|
15 | | - - name: Set up Python |
| 31 | + - name: Setup Python ${{ matrix.python-version }} |
16 | 32 | uses: actions/setup-python@v5 |
17 | 33 | with: |
18 | | - python-version: '3.11' |
| 34 | + python-version: ${{ matrix.python-version }} |
| 35 | + cache: "pip" |
19 | 36 |
|
20 | 37 | - name: Install uv |
21 | | - run: | |
22 | | - pip install uv |
| 38 | + run: python -m pip install -q uv |
23 | 39 |
|
24 | | - - name: Sync deps (frozen if lock exists) |
25 | | - run: | |
26 | | - if [ -f uv.lock ]; then |
27 | | - uv sync --frozen |
28 | | - else |
29 | | - uv sync || true |
30 | | - fi |
| 40 | + # Use workflow-level conditions instead of shell conditionals (works on Windows too) |
| 41 | + - name: Sync deps (frozen) |
| 42 | + if: ${{ hashFiles('uv.lock') != '' }} |
| 43 | + run: uv sync --frozen |
31 | 44 |
|
| 45 | + - name: Sync deps |
| 46 | + if: ${{ hashFiles('uv.lock') == '' }} |
| 47 | + run: uv sync |
| 48 | + |
| 49 | + # Ensure dev tools exist even if not declared as deps |
32 | 50 | - name: Install dev tools |
33 | | - run: | |
34 | | - pip install ruff mypy bandit |
| 51 | + run: uv pip install -q ruff pytest mypy bandit |
| 52 | + |
| 53 | + - name: Lint (ruff, concise) |
| 54 | + run: uv run ruff check . --output-format=concise |
35 | 55 |
|
36 | | - - name: Lint (ruff) |
37 | | - run: python -m ruff check . |
| 56 | + - name: Type-check (mypy, non-blocking) |
| 57 | + continue-on-error: true |
| 58 | + run: uv run mypy --ignore-missing-imports . |
38 | 59 |
|
39 | | - - name: Type-check (mypy, lenient) |
40 | | - run: python -m mypy --ignore-missing-imports . || true |
| 60 | + - name: Security scan (bandit, non-blocking) |
| 61 | + continue-on-error: true |
| 62 | + run: uv run bandit -q -r . |
41 | 63 |
|
42 | | - - name: Smoke test |
43 | | - run: make test |
| 64 | + - name: Run tests |
| 65 | + run: uv run pytest |
0 commit comments