Project 1A #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: test | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| # Keep every run on dev so cancelled checks do not pollute the default branch | |
| # commit history. PRs and other branches still share a group and cancel stale runs. | |
| group: ${{ case(github.ref == 'refs/heads/dev', format('{0}-{1}', github.workflow, github.run_id), format('{0}-{1}', github.workflow, github.event.pull_request.number || github.ref)) }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| checks: write | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| unit: | |
| name: unit | |
| runs-on: ubuntu-latest | |
| # Belt-and-suspenders: without this, a step with no timeout-minutes of its | |
| # own that hangs runs until GitHub's default 6h job cap instead of failing | |
| # fast (see the httpapi-exercise incident this guards against). | |
| timeout-minutes: 30 | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: "24" | |
| - name: Setup Bun | |
| uses: ./.github/actions/setup-bun | |
| - name: Configure git identity | |
| run: | | |
| git config --global user.email "bot@opencode.ai" | |
| git config --global user.name "opencode" | |
| - name: Cache Turbo | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: node_modules/.cache/turbo | |
| key: turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}-${{ github.sha }} | |
| restore-keys: | | |
| turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}- | |
| turbo-${{ runner.os }}- | |
| - name: Run unit tests | |
| timeout-minutes: 15 | |
| # Default turbo concurrency (10) oversubscribes ubuntu-latest's 4 | |
| # vCPUs across 5 packages' test tasks running at once — same | |
| # contention issue typecheck.yml already caps for tsgo. | |
| run: GITHUB_ACTIONS=false bun turbo test --concurrency=4 | |
| - name: Check generated client | |
| timeout-minutes: 5 | |
| working-directory: packages/client | |
| run: bun run check:generated | |
| e2e: | |
| name: e2e (smoke) | |
| runs-on: ubuntu-latest | |
| env: | |
| PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright-browsers | |
| # Default CI worker count (5) oversubscribes a standard GitHub-hosted | |
| # runner running a live Vite dev server alongside that many Chromium | |
| # instances, producing widespread toBeVisible() timeouts unrelated to | |
| # the features under test. Lower concurrency trades wall-clock time | |
| # for reliability. | |
| PLAYWRIGHT_WORKERS: "2" | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| # Playwright 1.59 hangs while extracting Chromium with Node 24.16. | |
| node-version: "24.15" | |
| - name: Setup Bun | |
| uses: ./.github/actions/setup-bun | |
| - name: Read Playwright version | |
| id: playwright-version | |
| run: | | |
| version=$(node -e 'console.log(require("./package.json").workspaces.catalog["@playwright/test"])') | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| - name: Cache Playwright browsers | |
| id: playwright-cache | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: ${{ github.workspace }}/.playwright-browsers | |
| key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ steps.playwright-version.outputs.version }}-chromium | |
| - name: Install Playwright system dependencies | |
| working-directory: packages/app | |
| run: bunx playwright install-deps chromium | |
| - name: Install Playwright browsers | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| working-directory: packages/app | |
| run: bunx playwright install chromium | |
| - name: Run app e2e smoke tests | |
| # Full regression suite (packages/app/e2e/regression) runs nightly | |
| # instead of on every push — see e2e-regression.yml. This keeps | |
| # every-push feedback fast while still catching broad regressions. | |
| run: bun --cwd packages/app test:e2e:local e2e/smoke e2e/user-story | |
| env: | |
| CI: true | |
| timeout-minutes: 15 | |
| - name: Upload Playwright artifacts | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: playwright-smoke-${{ github.run_attempt }} | |
| if-no-files-found: ignore | |
| retention-days: 7 | |
| path: | | |
| packages/app/e2e/test-results | |
| packages/app/e2e/playwright-report |