| 1 | name: Main landing gate |
| 2 | |
| 3 | # Why this exists |
| 4 | # |
| 5 | # `ci.yml` runs only on `workflow_dispatch`, so without this job nothing |
| 6 | # validates a push to `main`: on 2026-10-29 four commits landed red behind |
| 7 | # `[skip ci]` (`PersistRequest::ClearCheckpoint` became dead, `clippy` failed |
| 8 | # on `codewhale-skills`, and the blocking-calls budget went stale for a file |
| 9 | # that had moved crates). |
| 10 | # |
| 11 | # This job is deliberately narrow. It runs the fast checks for exactly the |
| 12 | # class of breakage that reaches `main` unnoticed: rustfmt, the CHANGELOG slice, |
| 13 | # README locale stamps, the dead-code/blocking-calls/swallowed-errors/bare-git |
| 14 | # budgets, generated-asset drift (including the website's generated facts, agent |
| 15 | # docs and feature registry), behavioural-guard receipts, and feature |
| 16 | # release-note receipts. Measured at ~45 s on a warm Linux runner. |
| 17 | # |
| 18 | # Since 2026-11-08 (founder) the `full-ci` job also dispatches `ci.yml` on every |
| 19 | # push to main, so every gate and the three-OS suite run on each landing. Since |
| 20 | # 2026-11-22 (founder) it skips that dispatch when the exact pushed SHA already |
| 21 | # has a green full `ci.yml` run (scripts/release/require-full-ci-receipt.sh); |
| 22 | # any doubt dispatches as before. The preflight job stays narrow so a red |
| 23 | # landing still shows up in minutes. |
| 24 | |
| 25 | on: |
| 26 | push: |
| 27 | branches: [main] |
| 28 | workflow_dispatch: |
| 29 | |
| 30 | permissions: |
| 31 | contents: read |
| 32 | |
| 33 | concurrency: |
| 34 | group: main-landing-${{ github.sha }} |
| 35 | cancel-in-progress: true |
| 36 | |
| 37 | jobs: |
| 38 | preflight: |
| 39 | name: Landing preflight |
| 40 | runs-on: ubuntu-24.04 |
| 41 | timeout-minutes: 15 |
| 42 | steps: |
| 43 | - uses: actions/checkout@v7 |
| 44 | with: |
| 45 | # The preflight diffs against the push's base commit to scope feature |
| 46 | # receipts, and the changelog/budget checks read history. |
| 47 | fetch-depth: 0 |
| 48 | |
| 49 | - uses: dtolnay/rust-toolchain@master |
| 50 | with: |
| 51 | toolchain: 1.100.0 |
| 52 | components: rustfmt |
| 53 | |
| 54 | - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 |
| 55 | with: |
| 56 | node-version: 22 |
| 57 | |
| 58 | - name: Format and changelog slice |
| 59 | run: | |
| 60 | set -euo pipefail |
| 61 | cargo fmt --all -- --check |
| 62 | bash scripts/sync-changelog.sh --check |
| 63 | |
| 64 | - name: README and source budgets |
| 65 | run: | |
| 66 | set -euo pipefail |
| 67 | python3 scripts/check-readme-translations.py |
| 68 | bash scripts/check-readme-locales.sh |
| 69 | python3 scripts/check-dead-code-budget.py |
| 70 | python3 scripts/check-blocking-calls-budget.py |
| 71 | python3 scripts/check-swallowed-errors-budget.py |
| 72 | python3 scripts/check-bare-git.py |
| 73 | |
| 74 | - name: Website generated facts and routes |
| 75 | run: | |
| 76 | set -euo pipefail |
| 77 | node web/scripts/check-facts.mjs |
| 78 | node web/scripts/check-cloud-facts.mjs |
| 79 | node web/scripts/check-release-docs.mjs |
| 80 | node web/scripts/check-runtime-routes.mjs |
| 81 | |
| 82 | - name: Commit receipts and range checks |
| 83 | env: |
| 84 | BEFORE_SHA: ${{ github.event.before }} |
| 85 | run: | |
| 86 | set -euo pipefail |
| 87 | base="" |
| 88 | if [[ -n "${BEFORE_SHA:-}" && "${BEFORE_SHA}" != "0000000000000000000000000000000000000000" && "${BEFORE_SHA}" != -* ]]; then |
| 89 | base="$(git rev-parse --verify --quiet "${BEFORE_SHA}^{commit}" 2>/dev/null || true)" |
| 90 | if [[ ! "${base}" =~ ^[0-9a-f]{40}$ ]]; then |
| 91 | base="" |
| 92 | fi |
| 93 | fi |
| 94 | if [[ -z "${base}" ]]; then |
| 95 | base="$(git rev-parse --verify --quiet 'HEAD~1^{commit}' 2>/dev/null || true)" |
| 96 | fi |
| 97 | if [[ -z "${base}" ]]; then |
| 98 | echo "::error::Cannot resolve push base commit for landing range checks." >&2 |
| 99 | exit 1 |
| 100 | fi |
| 101 | python3 scripts/check-behaviour-line.py --warn-only "${base}" HEAD |
| 102 | python3 scripts/check-behaviour-line.py --guards-only "${base}" HEAD |
| 103 | python3 scripts/check-docs-drift.py --warn-only "${base}" HEAD |
| 104 | bash scripts/release/check-feature-release-notes.sh "${base}" HEAD |
| 105 | |
| 106 | full-ci: |
| 107 | name: Dispatch full CI |
| 108 | if: github.event_name == 'push' |
| 109 | runs-on: ubuntu-24.04 |
| 110 | timeout-minutes: 5 |
| 111 | permissions: |
| 112 | actions: write |
| 113 | contents: read |
| 114 | steps: |
| 115 | - uses: actions/checkout@v7 |
| 116 | with: |
| 117 | sparse-checkout: scripts/release |
| 118 | persist-credentials: false |
| 119 | - name: Run ci.yml with every gate on the pushed commit |
| 120 | env: |
| 121 | GH_TOKEN: ${{ github.token }} |
| 122 | run: | |
| 123 | set -euo pipefail |
| 124 | if receipt="$(bash scripts/release/require-full-ci-receipt.sh "${GITHUB_REPOSITORY}" "${GITHUB_SHA}" 2>&1)"; then |
| 125 | echo "Not dispatching a duplicate full run. ${receipt}" | tee -a "${GITHUB_STEP_SUMMARY}" |
| 126 | exit 0 |
| 127 | fi |
| 128 | echo "${receipt}" |
| 129 | gh workflow run ci.yml --repo "${GITHUB_REPOSITORY}" --ref main -f expected_sha="${GITHUB_SHA}" |
| 130 | |
| 131 | web_changes: |
| 132 | name: Web change detection |
| 133 | runs-on: ubuntu-24.04 |
| 134 | timeout-minutes: 5 |
| 135 | outputs: |
| 136 | web: ${{ steps.detect.outputs.web }} |
| 137 | steps: |
| 138 | - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 |
| 139 | with: |
| 140 | fetch-depth: 0 |
| 141 | filter: blob:none |
| 142 | persist-credentials: false |
| 143 | - name: Detect website input changes |
| 144 | id: detect |
| 145 | shell: bash |
| 146 | env: |
| 147 | EVENT_NAME: ${{ github.event_name }} |
| 148 | BEFORE_SHA: ${{ github.event.before }} |
| 149 | run: | |
| 150 | set -euo pipefail |
| 151 | if [[ "${EVENT_NAME}" == "workflow_dispatch" || ! "${BEFORE_SHA}" =~ ^[0-9a-fA-F]{40}$ || "${BEFORE_SHA}" =~ ^0+$ ]] \ |
| 152 | || ! git rev-parse --verify --quiet "${BEFORE_SHA}^{commit}" >/dev/null; then |
| 153 | echo "web=true" >> "${GITHUB_OUTPUT}" |
| 154 | exit 0 |
| 155 | fi |
| 156 | mapfile -t changed < <(git diff --name-only "${BEFORE_SHA}" "${GITHUB_SHA}" -- | sort) |
| 157 | web=false |
| 158 | for path in "${changed[@]}"; do |
| 159 | case "${path}" in |
| 160 | web/*|docs/*|CHANGELOG.md|Cargo.toml|CONTRIBUTING.md|LICENSE|README.md|npm/codewhale/package.json|npm/codewhale/README.md|npm/codewhale/scripts/artifacts.js|crates/config/assets/*|crates/config/src/cloud_facts/keys.rs|crates/config/src/app_mode.rs|crates/sandbox/src/lib.rs|crates/engine/src/tools/*|crates/engine/src/core/engine/tool_catalog.rs|crates/app-server/src/runtime_api.rs|crates/app-server/src/runtime_web/*|crates/palette/src/rgb.rs|crates/cli/Cargo.toml|crates/execpolicy/src/approval_mode.rs|crates/runtime/src/audit.rs|crates/runtime/src/config.rs|crates/runtime/src/config/subagent_limits.rs|crates/runtime/src/settings.rs|crates/tui/src/tui/app.rs|crates/tui/src/tui/app/init.rs|scripts/export-design-tokens.py|vendor/codewhale-design/*|integrations/dingtalk-bridge/README.md|integrations/telegram-bridge/README.md|telemetry-ingest/*|.github/workflows/web.yml|.github/workflows/main-landing.yml) |
| 161 | web=true |
| 162 | ;; |
| 163 | esac |
| 164 | done |
| 165 | echo "web=${web}" >> "${GITHUB_OUTPUT}" |
| 166 | echo "Web gates required: ${web}" |
| 167 | |
| 168 | web: |
| 169 | name: Web gates |
| 170 | needs: web_changes |
| 171 | if: needs.web_changes.outputs.web == 'true' |
| 172 | runs-on: ubuntu-24.04 |
| 173 | timeout-minutes: 30 |
| 174 | defaults: |
| 175 | run: |
| 176 | working-directory: web |
| 177 | steps: |
| 178 | - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 |
| 179 | with: |
| 180 | fetch-depth: 0 |
| 181 | persist-credentials: false |
| 182 | - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 |
| 183 | with: |
| 184 | node-version: 22 |
| 185 | cache: 'npm' |
| 186 | cache-dependency-path: web/package-lock.json |
| 187 | - name: Install dependencies |
| 188 | run: npm ci |
| 189 | - name: Run tests |
| 190 | run: npm test |
| 191 | - name: Check web surface |
| 192 | env: |
| 193 | GITHUB_TOKEN: ${{ github.token }} |
| 194 | run: npm run check |
| 195 |