Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
4d80e68
ci(factory): prepare nightly CI and upstream mirror guard
kvnloo Nov 24, 2026
383e797
ci(factory): gate driver with a baseline-differential unit gate
Nov 25, 2026
52ba937
ci(factory): measured bundle budget and headless globe smoke
Nov 25, 2026
7656e39
ci(factory): record the unit baseline at nightly 53f0caa6
Nov 25, 2026
2196aa0
ci(factory): reusable exact-SHA workflow with lockfile-keyed caches
Nov 25, 2026
d95cc71
ci(factory): run the gates on a disposable Boat VM and post statuses
Nov 25, 2026
aab4f38
ci(factory): record benchmarks already over budget at the baseline
Nov 26, 2026
588f86d
docs(factory): exact-SHA CI contract, baselines and thresholds
Nov 26, 2026
389d328
fix(factory-ci): report external kills and test-less files truthfully
Nov 26, 2026
d0dfe32
ci(factory): re-record the unit baseline with the fixed driver
Nov 26, 2026
da15c7b
docs(factory): measured costs and required checks
Nov 26, 2026
bae4f45
feat(factory): exact-SHA status and soak evaluation for branch gates
Nov 26, 2026
c24a29b
feat(factory): hourly soak observations as commit statuses
Nov 26, 2026
2212fe3
feat(factory): nightly integration of green PRs labeled nightly
Nov 26, 2026
62cbd88
feat(factory): fail-closed fast-forward staging promotion
Nov 26, 2026
402c5a7
test(factory): acceptance and refusal paths for integration and promo…
Nov 26, 2026
ab10df4
docs(factory): nightly integration, soak ledger and promotion runbook
Nov 26, 2026
1e471af
test(factory): an older verdict on the same SHA cannot satisfy the CI…
Nov 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/actions/factory-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Factory Node toolchain
description: >-
Pinned Node plus node_modules restored only on an exact match of OS image,
architecture, Node, npm and package-lock.json. A miss runs npm ci; a partial
or older tree is never reused.
inputs:
browser:
description: Also install and cache the Chrome build Puppeteer pins.
default: 'false'
runs:
using: composite
steps:
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24.22.2

- name: Cache key
id: key
shell: bash
run: |
lock=$(sha256sum package-lock.json | cut -c1-64)
echo "modules=factory-nm-v1-${ImageOS}-${RUNNER_ARCH}-node$(node -v)-npm$(npm -v)-${lock}" >> "$GITHUB_OUTPUT"
echo "browser=factory-chrome-v1-${ImageOS}-${RUNNER_ARCH}-${lock}" >> "$GITHUB_OUTPUT"

- name: Restore node_modules
id: modules
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: node_modules
key: ${{ steps.key.outputs.modules }}

- name: Restore Puppeteer Chrome
if: inputs.browser == 'true'
id: chrome
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.cache/puppeteer
key: ${{ steps.key.outputs.browser }}

- name: Install locked dependencies
if: steps.modules.outputs.cache-hit != 'true'
shell: bash
env:
PUPPETEER_SKIP_DOWNLOAD: ${{ inputs.browser == 'true' && '0' || '1' }}
run: npm ci --no-audit --no-fund

- name: Install Puppeteer Chrome
if: inputs.browser == 'true' && steps.chrome.outputs.cache-hit != 'true'
shell: bash
run: npx --no-install puppeteer browsers install chrome
39 changes: 36 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: CI
on:
pull_request:
push:
branches: [main]
branches: [nightly, staging]
workflow_dispatch:

permissions:
contents: read
Expand All @@ -13,6 +14,34 @@ concurrency:
cancel-in-progress: true

jobs:
factory-base:
name: Fork branch policy
if: github.repository == 'kvnloo/gods-eye-view' && github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Refuse feature PRs to mirror and stable branches
env:
BASE: ${{ github.base_ref }}
run: |
case "$BASE" in
main|staging) echo '::error::Target nightly. Main mirrors upstream; staging is fast-forward promotion only.'; exit 1 ;;
esac

factory:
# Required on the fork: the gev-ci/* statuses this posts on the exact head.
name: Factory gates
if: >-
github.repository == 'kvnloo/gods-eye-view' && (
(github.event_name == 'pull_request' && contains(fromJSON('["nightly","staging"]'), github.base_ref)) ||
(github.event_name == 'push' && contains(fromJSON('["refs/heads/nightly","refs/heads/staging"]'), github.ref)))
permissions:
contents: read
statuses: write
uses: ./.github/workflows/factory-ci-sha.yml
with:
sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
base-sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || '' }}

verify:
name: Node ${{ matrix.node }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -51,11 +80,15 @@ jobs:

- name: Check published layer-token allocations
if: github.event_name == 'pull_request'
run: npm run layer-token:check -- --base-ref origin/main
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: npm run layer-token:check -- --base-ref "$BASE_SHA"

- name: Check Data Library manifests and share tokens
if: github.event_name == 'pull_request'
run: npm run library:check -- --base-ref origin/main
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: npm run library:check -- --base-ref "$BASE_SHA"

- name: Run unit tests
run: npm test
Expand Down
149 changes: 149 additions & 0 deletions .github/workflows/factory-ci-sha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Full validation of one exact commit. Called by ci.yml for PRs and pushes, and
# by the nightly-integration and staging-promotion workflows for the SHA they
# are about to publish. Contract: docs/factory-ci.md.
#
# Every gate posts a commit status on inputs.sha: gev-ci/<gate> plus
# gev-ci/full. A Boat run of scripts/factory-ci.mjs posts the same contexts, so
# consumers read statuses, not job names.
name: Factory CI (exact SHA)

on:
workflow_call:
inputs:
sha:
description: Full 40-character commit SHA to validate.
required: true
type: string
base-sha:
description: Optional full SHA the append-only ledgers are checked against.
required: false
type: string
default: ''
outputs:
full:
description: success or failure, the state posted as gev-ci/full.
value: ${{ jobs.report.outputs.full }}
workflow_dispatch:
inputs:
sha:
description: Full 40-character commit SHA to validate.
required: true
base-sha:
description: Optional full SHA the append-only ledgers are checked against.
required: false
default: ''

permissions:
contents: read

concurrency:
group: factory-ci-sha-${{ inputs.sha }}
cancel-in-progress: false

jobs:
gates:
name: gev-ci ${{ matrix.group }}
runs-on: ubuntu-24.04
timeout-minutes: ${{ matrix.timeout }}
strategy:
fail-fast: false
matrix:
include:
- group: checks
gates: lint typecheck translations
browser: 'false'
timeout: 20
- group: unit
gates: unit
browser: 'false'
timeout: 45
- group: build
gates: build bundle-budget globe-smoke
browser: 'true'
timeout: 25
- group: perf
gates: perf-smoke
browser: 'false'
timeout: 20
env:
SHA: ${{ inputs.sha }}
BASE_SHA: ${{ inputs.base-sha }}
GEV_CI_RUNNER: github-actions
steps:
- name: Refuse anything but a full SHA
run: |
[[ $SHA =~ ^[0-9a-f]{40}$ ]] || { echo "::error::sha must be 40 lowercase hex characters"; exit 1; }
[[ -z $BASE_SHA || $BASE_SHA =~ ^[0-9a-f]{40}$ ]] || { echo "::error::base-sha must be empty or a full SHA"; exit 1; }

- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
ref: ${{ inputs.sha }}
fetch-depth: 0
persist-credentials: false

- name: Confirm the checked-out commit
run: test "$(git rev-parse HEAD)" = "$SHA"

- uses: ./.github/actions/factory-node
with:
browser: ${{ matrix.browser }}

- name: Run gates
run: node scripts/factory-ci.mjs ${{ matrix.gates }} --out ci-results ${BASE_SHA:+--base-ref "$BASE_SHA"}

- name: Upload results
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: gev-ci-${{ matrix.group }}-${{ inputs.sha }}
path: |
ci-results/*.json
ci-results/*.log
ci-results/*.png
if-no-files-found: error
retention-days: 30

report:
name: gev-ci report
needs: gates
if: always()
runs-on: ubuntu-24.04
permissions:
contents: read
statuses: write
outputs:
full: ${{ steps.post.outputs.full }}
env:
SHA: ${{ inputs.sha }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
ref: ${{ inputs.sha }}
persist-credentials: false

- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: gev-ci-*-${{ inputs.sha }}
path: ci-results
merge-multiple: true

- name: Post commit statuses
id: post
env:
GH_TOKEN: ${{ github.token }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
node scripts/factory-ci.mjs statuses ci-results > statuses.tsv
{
echo "### gev-ci for \`$SHA\`"
echo '| Context | State | Detail |'
echo '|---|---|---|'
while IFS=$'\t' read -r context state description; do
gh api -X POST "repos/$GITHUB_REPOSITORY/statuses/$SHA" \
-f state="$state" -f context="$context" -f description="$description" -f target_url="$RUN_URL" > /dev/null
echo "| $context | $state | $description |"
done < statuses.tsv
} >> "$GITHUB_STEP_SUMMARY"
full=$(awk -F'\t' '$1 == "gev-ci/full" { print $2 }' statuses.tsv)
echo "full=$full" >> "$GITHUB_OUTPUT"
test "$full" = success
53 changes: 53 additions & 0 deletions .github/workflows/factory-main-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Factory main mirror
on:
schedule:
- cron: '17 * * * *'
workflow_dispatch:
inputs:
apply:
description: Apply the fast-forward (false only checks readiness)
type: boolean
default: false

permissions:
contents: write

concurrency:
group: factory-main-mirror
cancel-in-progress: false

jobs:
mirror:
if: github.repository == 'kvnloo/gods-eye-view' && (github.ref == 'refs/heads/staging' || (github.ref == 'refs/heads/ci/factory-foundation' && github.event_name == 'workflow_dispatch' && !inputs.apply))
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Compare and fast-forward main without checking out code
env:
GH_TOKEN: ${{ github.token }}
APPLY: ${{ github.event_name == 'schedule' || inputs.apply }}
shell: bash
run: |
set -euo pipefail
fork=kvnloo/gods-eye-view
upstream=bilawalsidhu/gods-eye-view
before=$(gh api "repos/$fork/git/ref/heads/main" --jq .object.sha)
target=$(gh api "repos/$upstream/git/ref/heads/main" --jq .object.sha)
printf 'Fork main: `%s`\n\nUpstream main: `%s`\n\n' "$before" "$target" | tee -a "$GITHUB_STEP_SUMMARY"
if [[ "$before" == "$target" ]]; then
printf 'Already in sync.\n' | tee -a "$GITHUB_STEP_SUMMARY"
exit 0
fi
ancestor=$(gh api "repos/$upstream/compare/$before...$target" --jq .merge_base_commit.sha)
if [[ "$ancestor" != "$before" ]]; then
printf '::error::Fork main is not an ancestor of upstream main; refusing to update.\n'
exit 1
fi
if [[ "$APPLY" != true ]]; then
printf 'Fast-forward available (dry run).\n' | tee -a "$GITHUB_STEP_SUMMARY"
exit 0
fi
gh api -X PATCH "repos/$fork/git/refs/heads/main" -f sha="$target" -F force=false --jq .object.sha
after=$(gh api "repos/$fork/git/ref/heads/main" --jq .object.sha)
[[ "$after" == "$target" ]]
printf 'Fast-forwarded to `%s`.\n' "$after" | tee -a "$GITHUB_STEP_SUMMARY"
78 changes: 78 additions & 0 deletions .github/workflows/factory-nightly-integrate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Nightly integration: merge green PRs labeled `nightly` into `nightly`, but only
# publish an integration SHA whose own gev-ci/* statuses are green.
# Owner card: t_cf66fac4. Runbook: docs/factory/NIGHTLY-PROMOTION.md.
#
# `schedule` fires only from the default branch (`staging`), so this runs once
# the file has been promoted there. Until then use the host runner in the runbook.
name: Factory nightly integration

on:
schedule:
- cron: '41 8 * * *' # 08:41 UTC, 02:41 US Central
workflow_dispatch:
inputs:
dry-run:
description: Assess and merge locally; push nothing
type: boolean
default: false

permissions:
contents: read

# One branch mutator at a time: shared with factory-promote-staging.yml.
concurrency:
group: factory-branch-mutation
cancel-in-progress: false

jobs:
integrate:
name: Integrate labeled PRs into nightly
if: github.repository == 'kvnloo/gods-eye-view'
runs-on: ubuntu-24.04
timeout-minutes: 350
environment: factory-branches
permissions:
contents: read
pull-requests: read
statuses: read
actions: write # dispatches factory-ci-sha.yml for each integration SHA
steps:
- name: Check out the trusted gate scripts (default branch, never a PR)
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
ref: ${{ github.event.repository.default_branch }}
sparse-checkout: |
scripts/factory
ci/factory/branch-policy.json
sparse-checkout-cone-mode: false
persist-credentials: false

# GITHUB_TOKEN cannot push commits that touch .github/workflows, and many
# integrations do. The App token is used only by `git push`.
- name: Branch push token
id: app
uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
with:
client-id: ${{ vars.FACTORY_APP_CLIENT_ID }}
private-key: ${{ secrets.FACTORY_APP_PRIVATE_KEY }}
permission-contents: write
permission-workflows: write

- name: Integrate (exact-SHA CI via factory-ci-sha.yml)
env:
GH_TOKEN: ${{ github.token }}
FACTORY_PUSH_TOKEN: ${{ steps.app.outputs.token }}
DRY_RUN: ${{ inputs.dry-run && '--dry-run' || '' }}
run: |
python3 scripts/factory/nightly_integrate.py --validator dispatch \
--ci-workflow factory-ci-sha.yml --ci-ref '${{ github.event.repository.default_branch }}' \
--lock '' --report integration.json $DRY_RUN

- name: Keep the JSON record
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: nightly-integration-${{ github.run_id }}
path: integration.json
if-no-files-found: warn
retention-days: 90
Loading
Loading