|
| 1 | +name: extension CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - 'apps/extension/**' |
| 8 | + - 'pnpm-lock.yaml' |
| 9 | + - 'pnpm-workspace.yaml' |
| 10 | + - '.nvmrc' |
| 11 | + - '.github/workflows/extension-ci.yml' |
| 12 | + pull_request: |
| 13 | + branches: [main] |
| 14 | + paths: |
| 15 | + - 'apps/extension/**' |
| 16 | + - 'pnpm-lock.yaml' |
| 17 | + - 'pnpm-workspace.yaml' |
| 18 | + - '.nvmrc' |
| 19 | + - '.github/workflows/extension-ci.yml' |
| 20 | + |
| 21 | +concurrency: |
| 22 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 23 | + cancel-in-progress: true |
| 24 | + |
| 25 | +permissions: |
| 26 | + contents: read |
| 27 | + pull-requests: read |
| 28 | + |
| 29 | +jobs: |
| 30 | + # Compiler, linter, formatting and unit tests, via the extension's own `verify` |
| 31 | + # script so the extension's stricter (type-aware) oxlint config is what runs. |
| 32 | + verify: |
| 33 | + runs-on: ${{ vars.RUNNER_DEFAULT_LABEL || 'ubuntu-latest' }} |
| 34 | + timeout-minutes: 15 |
| 35 | + steps: |
| 36 | + - uses: useblacksmith/checkout@41cdeedae8edb2e684ba22896a5fd2a3cb85db6b # v1 |
| 37 | + with: |
| 38 | + lfs: true |
| 39 | + |
| 40 | + - name: Setup pnpm |
| 41 | + uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0 |
| 42 | + |
| 43 | + - name: Setup Node |
| 44 | + uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 |
| 45 | + with: |
| 46 | + node-version-file: '.nvmrc' |
| 47 | + cache: 'pnpm' |
| 48 | + |
| 49 | + - name: Install dependencies |
| 50 | + run: pnpm install --frozen-lockfile |
| 51 | + |
| 52 | + - name: Verify (typecheck, lint, format, unit tests) |
| 53 | + run: pnpm --filter kilo-extension verify |
| 54 | + |
| 55 | + # Prove the Firefox MV3 target still builds (the Chrome build runs inside e2e). |
| 56 | + build-firefox: |
| 57 | + runs-on: ${{ vars.RUNNER_DEFAULT_LABEL || 'ubuntu-latest' }} |
| 58 | + timeout-minutes: 15 |
| 59 | + steps: |
| 60 | + - uses: useblacksmith/checkout@41cdeedae8edb2e684ba22896a5fd2a3cb85db6b # v1 |
| 61 | + with: |
| 62 | + lfs: true |
| 63 | + |
| 64 | + - name: Setup pnpm |
| 65 | + uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0 |
| 66 | + |
| 67 | + - name: Setup Node |
| 68 | + uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 |
| 69 | + with: |
| 70 | + node-version-file: '.nvmrc' |
| 71 | + cache: 'pnpm' |
| 72 | + |
| 73 | + - name: Install dependencies |
| 74 | + run: pnpm install --frozen-lockfile |
| 75 | + |
| 76 | + - name: Build (Firefox MV3) |
| 77 | + run: pnpm --filter kilo-extension build:firefox |
| 78 | + |
| 79 | + # Chrome end-to-end tests. `e2e:chrome` builds the Chrome MV3 bundle first, so this |
| 80 | + # also covers the Chrome build. Firefox Selenium e2e (`e2e:firefox`) is intentionally |
| 81 | + # not run here: it relies on geckodriver tab detection that is unreliable headless. |
| 82 | + e2e-chrome: |
| 83 | + needs: verify |
| 84 | + runs-on: ${{ vars.RUNNER_LARGE_LABEL || 'ubuntu-24.04-8core' }} |
| 85 | + timeout-minutes: 20 |
| 86 | + env: |
| 87 | + CI: 'true' |
| 88 | + steps: |
| 89 | + - uses: useblacksmith/checkout@41cdeedae8edb2e684ba22896a5fd2a3cb85db6b # v1 |
| 90 | + with: |
| 91 | + lfs: true |
| 92 | + |
| 93 | + - name: Setup pnpm |
| 94 | + uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0 |
| 95 | + |
| 96 | + - name: Setup Node |
| 97 | + uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 |
| 98 | + with: |
| 99 | + node-version-file: '.nvmrc' |
| 100 | + cache: 'pnpm' |
| 101 | + |
| 102 | + - name: Install dependencies |
| 103 | + run: pnpm install --frozen-lockfile |
| 104 | + |
| 105 | + - name: Install Playwright Chromium |
| 106 | + run: pnpm --filter kilo-extension exec playwright install --with-deps chromium |
| 107 | + |
| 108 | + - name: Run Chrome e2e (builds the Chrome MV3 bundle first) |
| 109 | + run: pnpm --filter kilo-extension e2e:chrome |
| 110 | + |
| 111 | + - name: Upload Playwright report on failure |
| 112 | + if: failure() |
| 113 | + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 |
| 114 | + with: |
| 115 | + name: extension-playwright-report |
| 116 | + path: | |
| 117 | + apps/extension/playwright-report |
| 118 | + apps/extension/test-results |
| 119 | + retention-days: 7 |
| 120 | + if-no-files-found: ignore |