|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +# Cancel previous runs on the same branch when a new commit is pushed |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + lint: |
| 17 | + name: Lint (ruff + mypy) |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + - uses: actions/setup-python@v5 |
| 22 | + with: |
| 23 | + python-version: "3.10" |
| 24 | + cache: pip |
| 25 | + - name: Install dev deps |
| 26 | + run: pip install -r requirements-dev.txt |
| 27 | + - name: Ruff |
| 28 | + run: ruff check scripts/ tests/ |
| 29 | + - name: Mypy |
| 30 | + run: mypy scripts/ |
| 31 | + |
| 32 | + test: |
| 33 | + name: Pytest (${{ matrix.os }} / py${{ matrix.python-version }}) |
| 34 | + needs: lint |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + matrix: |
| 38 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 39 | + python-version: ["3.10", "3.12"] |
| 40 | + # Trim matrix — keep ubuntu fully tested, others only on 3.12 |
| 41 | + exclude: |
| 42 | + - os: macos-latest |
| 43 | + python-version: "3.10" |
| 44 | + - os: windows-latest |
| 45 | + python-version: "3.10" |
| 46 | + runs-on: ${{ matrix.os }} |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@v4 |
| 49 | + - uses: actions/setup-python@v5 |
| 50 | + with: |
| 51 | + python-version: ${{ matrix.python-version }} |
| 52 | + cache: pip |
| 53 | + - name: Install dev deps |
| 54 | + run: pip install -r requirements-dev.txt |
| 55 | + - name: Pytest with coverage |
| 56 | + run: pytest --cov=scripts --cov-report=term --cov-report=xml -q |
| 57 | + - name: Upload coverage (Linux py3.12 only) |
| 58 | + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' |
| 59 | + uses: actions/upload-artifact@v4 |
| 60 | + with: |
| 61 | + name: coverage-xml |
| 62 | + path: coverage.xml |
| 63 | + if-no-files-found: ignore |
| 64 | + |
| 65 | + smoke-e2e: |
| 66 | + name: E2E smoke (Linux) |
| 67 | + needs: test |
| 68 | + runs-on: ubuntu-latest |
| 69 | + steps: |
| 70 | + - uses: actions/checkout@v4 |
| 71 | + - uses: actions/setup-python@v5 |
| 72 | + with: |
| 73 | + python-version: "3.12" |
| 74 | + cache: pip |
| 75 | + - uses: actions/setup-node@v4 |
| 76 | + with: |
| 77 | + node-version: "20" |
| 78 | + - name: Install dev deps |
| 79 | + run: pip install -r requirements-dev.txt |
| 80 | + - name: Bootstrap demo project |
| 81 | + working-directory: tests/fixtures/demo-app |
| 82 | + run: | |
| 83 | + npm init -y >/dev/null |
| 84 | + npm install --silent --save-dev @playwright/test @axe-core/playwright dotenv |
| 85 | + npx playwright install --with-deps chromium |
| 86 | + - name: Serve demo HTML |
| 87 | + run: | |
| 88 | + cd tests/fixtures/demo-app |
| 89 | + python3 -m http.server 8765 & |
| 90 | + echo $! > /tmp/server.pid |
| 91 | + sleep 1 |
| 92 | + curl -fsS http://127.0.0.1:8765/ >/dev/null |
| 93 | + - name: Run skill pipeline against demo |
| 94 | + working-directory: tests/fixtures/demo-app |
| 95 | + run: | |
| 96 | + mkdir -p reports/run-ci |
| 97 | + npx playwright test --project chromium-mobile --reporter=json,list \ |
| 98 | + > reports/run-ci/playwright-stdout.txt 2>&1 || true |
| 99 | + # Move Playwright's results.json into the run dir |
| 100 | + cp test-results/results.json reports/run-ci/results.json || \ |
| 101 | + cp playwright-report/results.json reports/run-ci/results.json |
| 102 | + python ../../../scripts/run_suite.py --cwd . --out reports/run-ci --skip-run |
| 103 | + python ../../../scripts/fingerprint_bugs.py \ |
| 104 | + --current reports/run-ci/raw_bugs.json \ |
| 105 | + --out reports/run-ci/bugs.json \ |
| 106 | + --diff reports/run-ci/diff.json |
| 107 | + python ../../../scripts/generate_report.py \ |
| 108 | + --run-dir reports/run-ci --app-name "Demo App" |
| 109 | + - name: Verify report artefacts exist |
| 110 | + working-directory: tests/fixtures/demo-app |
| 111 | + run: | |
| 112 | + test -f reports/run-ci/bugs.json |
| 113 | + test -f reports/run-ci/diff.json |
| 114 | + test -f reports/run-ci/report.md |
| 115 | + test -f reports/run-ci/index.html |
| 116 | + echo "--- report.md preview ---" |
| 117 | + head -40 reports/run-ci/report.md |
| 118 | + - name: Upload run artefacts |
| 119 | + if: always() |
| 120 | + uses: actions/upload-artifact@v4 |
| 121 | + with: |
| 122 | + name: smoke-e2e-run |
| 123 | + path: tests/fixtures/demo-app/reports/run-ci/ |
| 124 | + if-no-files-found: warn |
| 125 | + - name: Stop demo server |
| 126 | + if: always() |
| 127 | + run: kill $(cat /tmp/server.pid) || true |
0 commit comments