prose

Browser checks

Runs a repository's browser checks, pnpm run test:browser. It's a workflow beside ci.yml, so ci stays the same in every repository and finishes first. The main ruleset doesn't require it. craftz status and pnpm gone say how the latest run ended, and a failed run keeps its Playwright report for a week, to open the trace.

When it runs is the repository's choice, and on: is the one part of this file that may differ. The default is once for each merge to main, since on a pull request it finished after the merge and gated nothing. A repository narrows that with paths-ignore, or adds workflow_call and runs it from its release, where it stops the release. workflow_dispatch stays, so a run by hand is always there, on a branch too, where a risky change needs a browser run before it merges. A run is never cancelled by a later merge, since a cancelled run says nothing about its commit.

A job that runs past six minutes is stopped, where GitHub's own limit is six hours. That's for a job that hangs. The test:browser step is stopped at four minutes, twice its target, so a suite that has slowed that far fails and gets fixed. One over the target but under the stop passes, and craftz status notes it, as the rules say.

name: Browser

on:
  push:
    branches: [main]
    # Prose's browser checks are a release's: they run when `package.json` changes, which a version
    # bump and a dependency bump both do, and the staged version waits for approval on npm. A merge
    # to anything else skips them. `workflow_dispatch` runs them for any other case.
    paths: [package.json]
  workflow_dispatch:

# Each commit has its own run, and a later merge doesn't cancel it.
concurrency:
  group: ${{ github.workflow }}-${{ github.sha }}
  cancel-in-progress: false

permissions:
  contents: read

jobs:
  browser:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - name: Checkout
        uses: actions/checkout@v7
      # Reads the pnpm version from package.json's `packageManager`.
      - name: Set up pnpm
        uses: pnpm/action-setup@v6
      - name: Set up Node
        uses: actions/setup-node@v7
        with:
          node-version-file: package.json
          cache: pnpm

      - name: Install
        run: pnpm install --frozen-lockfile
      # The headless shell is all a headless run needs, and it's far smaller than full Chromium.
      # It launches on `ubuntu-latest` as it is, since `playwright install-deps chromium` only adds
      # fonts there, and its `apt` step hung for six minutes in a run. Five seconds is the usual
      # download, so a minute is for a download that has hung.
      - name: Chromium
        timeout-minutes: 1
        run: pnpm exec playwright install --only-shell chromium

      - name: test:browser
        timeout-minutes: 8
        run: pnpm run test:browser

      - name: Report
        if: failure()
        uses: actions/upload-artifact@v7
        with:
          name: playwright-report
          path: playwright-report
          if-no-files-found: ignore
          retention-days: 7