|
| 1 | +name: CI |
| 2 | + |
| 3 | +# PR quality gates for OOMOL Connect, run serially in a single job: |
| 4 | +# 1) Lint (oxlint + oxfmt) -> 2) Typecheck (build) -> 3) Unit tests (vitest) |
| 5 | +# Serial keeps it simple and fail-fast: dependencies install once and a failing |
| 6 | +# earlier step short-circuits the rest. Also runs on pushes to main so the default |
| 7 | +# branch stays green and the npm cache stays warm for PR runs. |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: [main] |
| 11 | + pull_request: |
| 12 | + |
| 13 | +# Cancel superseded runs for the same ref (e.g. new push to an open PR). |
| 14 | +concurrency: |
| 15 | + group: ci-${{ github.workflow }}-${{ github.ref }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +# Least privilege: this job only reads the repository. |
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + |
| 22 | +env: |
| 23 | + # This project runs TypeScript directly with `node` (native type stripping) and |
| 24 | + # forbids `tsx` / `--experimental-strip-types` (see AGENTS.md). Type stripping is |
| 25 | + # on by default only on Node >= 22.18 / >= 23.6, so pin an LTS that supports it. |
| 26 | + # Do NOT downgrade below 22.18 — `npm ci` (postinstall codegen) and typecheck fail. |
| 27 | + NODE_VERSION: "24" |
| 28 | + |
| 29 | +jobs: |
| 30 | + ci: |
| 31 | + name: Lint, Typecheck & Test |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v4 |
| 36 | + with: |
| 37 | + # No step needs the persisted GITHUB_TOKEN in git config; dropping it |
| 38 | + # keeps `npm ci` postinstall scripts from reading it (zizmor hardening). |
| 39 | + persist-credentials: false |
| 40 | + |
| 41 | + - name: Setup Node.js ${{ env.NODE_VERSION }} |
| 42 | + uses: actions/setup-node@v4 |
| 43 | + with: |
| 44 | + node-version: ${{ env.NODE_VERSION }} |
| 45 | + cache: npm |
| 46 | + |
| 47 | + # Runs postinstall codegen (provider registry + catalog). |
| 48 | + - name: Install dependencies |
| 49 | + run: npm ci |
| 50 | + |
| 51 | + # 1) Lint |
| 52 | + - name: Lint (oxlint) |
| 53 | + run: npm run lint |
| 54 | + |
| 55 | + - name: Check formatting (oxfmt) |
| 56 | + run: npm run format |
| 57 | + |
| 58 | + # 2) Typecheck (build): regenerates the registry, type-checks src/scripts/examples. |
| 59 | + - name: Typecheck |
| 60 | + run: npm run typecheck |
| 61 | + |
| 62 | + # 3) Unit tests (vitest): covers src and the web workspace. |
| 63 | + - name: Run tests (vitest) |
| 64 | + run: npm test |
0 commit comments