Skip to content
Merged
Changes from all commits
Commits
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
45 changes: 42 additions & 3 deletions .github/workflows/factory-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# The factory's slow loop (.claude/factory/README.md, "Two feedback loops"): the project's gate
# (factory/config.toml `gate`) on a clean runner, for every pull request to main and every push to
# main. The ruleset requires its `gate` check. Written by the factory's sync.sh: edit it there.
# A change to planning files only (factory/PLAN.md, DONE.md, decisions/) runs no gate: `gate` then
# reports from a Linux runner with no steps, never macOS (the human, 2026-12-01).
name: factory

on:
Expand All @@ -18,20 +20,57 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
scope:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
code: ${{ steps.scope.outputs.code }}
steps:
- name: Planning files only?
id: scope
env:
GH_TOKEN: ${{ github.token }}
BASE: ${{ github.event.pull_request.base.sha || github.event.before }}
HEAD: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
code=true
if [ "${{ github.event_name }}" != workflow_dispatch ] && [ -n "$BASE" ] \
&& files=$(gh api "repos/$GITHUB_REPOSITORY/compare/$BASE...$HEAD" --jq '.files[].filename'); then
# The compare API lists at most 300 files: that many is never planning only.
n=$(printf '%s\n' "$files" | grep -c .)
if [ "$n" -gt 0 ] && [ "$n" -lt 300 ] \
&& ! printf '%s\n' "$files" | grep -qvE '^factory/(PLAN\.md|DONE\.md|decisions/)'; then
code=false
fi
fi
echo "code=$code" >>"$GITHUB_OUTPUT"
echo "code changed: $code"

gate:
runs-on: macos-15 # arm64: watane's release ships only aarch64-apple-darwin
needs: scope
if: ${{ !cancelled() }} # a failed scope job means "code": the gate runs, never skips
# arm64 macOS: watane's release ships only aarch64-apple-darwin. Planning only: Linux, no steps.
runs-on: ${{ needs.scope.outputs.code != 'false' && 'macos-15' || 'ubuntu-latest' }}
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Planning files only
if: needs.scope.outputs.code == 'false'
run: echo "planning files only; no gate"
- if: needs.scope.outputs.code != 'false'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: watane-dev from watane's release (a mod's gate needs it)
if: hashFiles('wit/world.wit') != ''
if: needs.scope.outputs.code != 'false' && hashFiles('wit/world.wit') != ''
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release download v0.1.1 --repo civic-tech-pioneer/watane -p 'watane-*-aarch64-apple-darwin.tar.gz' -O - | tar xz -C "$RUNNER_TEMP"
echo "$RUNNER_TEMP"/watane-*/bin >> "$GITHUB_PATH"
rustup target add wasm32-wasip2
# check.sh runs `cargo +nightly fmt`; a fresh nightly may come without rustfmt (ranking S249).
rustup target add wasm32-wasip2 --toolchain stable # doctor checks stable (ranking S249)
rustup component add rustfmt --toolchain nightly
- name: gate
if: needs.scope.outputs.code != 'false'
run: bash -c "$(sed -n 's/^gate *= *"\(.*\)".*/\1/p' factory/config.toml | head -1)"
Loading