|
| 1 | +name: CI |
| 2 | + |
| 3 | +# Backlog §D1: gate every pull request. Jobs reuse the same scripts a |
| 4 | +# developer runs locally, exactly like release.yml does, so CI never becomes a |
| 5 | +# separate build path that can drift from the documented workflow. |
| 6 | + |
| 7 | +on: |
| 8 | + pull_request: |
| 9 | + push: |
| 10 | + branches: [main] |
| 11 | + schedule: |
| 12 | + # Nightly slot for the macOS E2E suite, which needs a GUI session and |
| 13 | + # mutates com.headless.app user defaults. |
| 14 | + - cron: "0 6 * * *" |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +concurrency: |
| 21 | + group: ci-${{ github.event.pull_request.number || github.ref }} |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +jobs: |
| 25 | + static: |
| 26 | + name: Static checks |
| 27 | + runs-on: ubuntu-latest |
| 28 | + timeout-minutes: 10 |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + fetch-depth: 0 |
| 33 | + - name: Install zsh |
| 34 | + run: sudo apt-get update && sudo apt-get install -y --no-install-recommends zsh |
| 35 | + - name: Shell syntax |
| 36 | + run: | |
| 37 | + set -eu |
| 38 | + status=0 |
| 39 | + for script in $(git ls-files '*.sh'); do |
| 40 | + case "$(head -n 1 "$script")" in |
| 41 | + *zsh*) checker="zsh -n" ;; |
| 42 | + *bash*) checker="bash -n" ;; |
| 43 | + *) checker="sh -n" ;; |
| 44 | + esac |
| 45 | + if ! $checker "$script"; then |
| 46 | + echo "syntax error: $script" >&2 |
| 47 | + status=1 |
| 48 | + fi |
| 49 | + done |
| 50 | + exit "$status" |
| 51 | + - name: QA evidence checksums |
| 52 | + # docs/qa/evidence is the only binary media allowed in git; prove the |
| 53 | + # committed bundle still matches its manifest. |
| 54 | + run: cd docs/qa/evidence && sha256sum -c SHA256SUMS |
| 55 | + - name: Whitespace |
| 56 | + if: github.event_name == 'pull_request' |
| 57 | + run: git diff --check "origin/${{ github.base_ref }}...HEAD" |
| 58 | + |
| 59 | + runtime: |
| 60 | + name: Agent runtime suite |
| 61 | + runs-on: ubuntu-latest |
| 62 | + timeout-minutes: 10 |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v4 |
| 65 | + - uses: pnpm/action-setup@v4 |
| 66 | + - uses: actions/setup-node@v4 |
| 67 | + with: |
| 68 | + node-version: 20 |
| 69 | + cache: pnpm |
| 70 | + - run: pnpm install --frozen-lockfile --filter @headless/app |
| 71 | + - name: Context pruning suite |
| 72 | + run: pnpm test:runtime |
| 73 | + |
| 74 | + protocol: |
| 75 | + name: Protocol suite |
| 76 | + runs-on: ubuntu-latest |
| 77 | + timeout-minutes: 30 |
| 78 | + container: swift:6.1-bookworm |
| 79 | + steps: |
| 80 | + - uses: actions/checkout@v4 |
| 81 | + - name: Prepare SwiftPM exclude paths |
| 82 | + # Package.swift excludes build/ and Headless.app from the host target; |
| 83 | + # Dockerfile.linux creates them for the same reason. |
| 84 | + run: mkdir -p apps/headless/build apps/headless/Headless.app |
| 85 | + - name: Protocol and security tests |
| 86 | + run: ./apps/headless/test.sh |
| 87 | + |
| 88 | + web: |
| 89 | + name: Web app |
| 90 | + runs-on: ubuntu-latest |
| 91 | + timeout-minutes: 20 |
| 92 | + steps: |
| 93 | + - uses: actions/checkout@v4 |
| 94 | + - uses: pnpm/action-setup@v4 |
| 95 | + - uses: actions/setup-node@v4 |
| 96 | + with: |
| 97 | + node-version: 20 |
| 98 | + cache: pnpm |
| 99 | + - run: pnpm install --frozen-lockfile --filter @headless/web |
| 100 | + - run: pnpm --filter @headless/web lint |
| 101 | + - run: pnpm --filter @headless/web build |
| 102 | + |
| 103 | + linux-e2e: |
| 104 | + name: Linux E2E (Docker) |
| 105 | + runs-on: ubuntu-latest |
| 106 | + timeout-minutes: 45 |
| 107 | + steps: |
| 108 | + - uses: actions/checkout@v4 |
| 109 | + - name: Sandboxed Chromium E2E |
| 110 | + run: ./apps/headless/Tests/linux-docker.sh |
| 111 | + - name: Upload QA evidence |
| 112 | + if: always() |
| 113 | + uses: actions/upload-artifact@v4 |
| 114 | + with: |
| 115 | + name: linux-e2e-evidence |
| 116 | + path: apps/headless/build/qa-evidence |
| 117 | + if-no-files-found: ignore |
| 118 | + retention-days: 7 |
| 119 | + |
| 120 | + macos: |
| 121 | + name: macOS build and protocol suite |
| 122 | + runs-on: macos-latest |
| 123 | + timeout-minutes: 45 |
| 124 | + steps: |
| 125 | + - uses: actions/checkout@v4 |
| 126 | + - name: Build app |
| 127 | + run: ./apps/headless/build.sh |
| 128 | + - name: Protocol and security tests |
| 129 | + run: ./apps/headless/test.sh |
| 130 | + |
| 131 | + macos-e2e: |
| 132 | + name: macOS E2E (WKWebView) |
| 133 | + # Opens real windows and mutates com.headless.app user defaults, so it runs |
| 134 | + # nightly, on demand, or on a pull request labelled macos-e2e. |
| 135 | + if: >- |
| 136 | + github.event_name == 'schedule' || |
| 137 | + github.event_name == 'workflow_dispatch' || |
| 138 | + contains(github.event.pull_request.labels.*.name, 'macos-e2e') |
| 139 | + runs-on: macos-latest |
| 140 | + timeout-minutes: 60 |
| 141 | + steps: |
| 142 | + - uses: actions/checkout@v4 |
| 143 | + - name: Install FFmpeg |
| 144 | + run: brew install ffmpeg |
| 145 | + - name: Build app |
| 146 | + run: ./apps/headless/build.sh |
| 147 | + - name: E2E |
| 148 | + run: zsh ./apps/headless/Tests/macos-e2e.sh |
0 commit comments