ci-design
Rules for CI in a zgeoff repo: workflows, jobs, test budgets, timeouts, triggers, builds and the dependency gates. Load it before you add, change or review a workflow, a job or a trigger, or a release-age exclude, override or audit ignore. For how to write tests, load the testing skill. Load the repo's project-ci-design skill beside it; where they disagree, the project skill wins.
- License 许可
- MIT
- 所属仓库
- zgeoff/hq
- 最近更新
- 2026-11-13
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- ci-design
- metadata
- { "kind": "rule-set" }
- description
- Rules for CI in a zgeoff repo: workflows, jobs, test budgets, timeouts, triggers, builds and the dependency gates. Load it before you add, change or review a workflow, a job or a trigger, or a release-age exclude, override or audit ignore. For how to write tests, load the testing skill. Load the repo's project-ci-design skill beside it; where they disagree, the project skill wins.
02 资源文件 2
- 参考文档references/dependency-exceptions.md3.7 KB
- 参考文档references/run-times.md1018 B
03 SKILL.md 正文
CI design
References
- Dependency exceptions: adding a release-age exclude, an override or an audit ignore for a third-party package.
- Run times: measuring a median time for the test budget or a timeout.
Workflow lint
- After you change a workflow, run
bun x @zgeoff/chex workflowsand fix every warning. CI stays green on a warning.
Jobs
Never edit pr.yml:
repo-sync copies it from
zgeoff/tools and overwrites your change. pr.yml runs the shared
bun-checks.yml on
each pull request.
- Add CI work as a package script. Unless
BUN_CHECK_SCRIPTSis set,bun-checks.ymlruns the standard list:audit,deadcode,format:check,lint,typecheckandtest, and each oftest:e2e,test:browser,test:docker,test:hostandtest:agent-sdkthat the repo defines. Where each test runs says what each test script runs.test:model-apistays out of the list, and runs as that page says. - To run a script outside the standard list, such as a made-up
check:sql, set the repo variableBUN_CHECK_SCRIPTS. Write in it every script to run, the standard ones included. A script you leave out stops running, and a name thatpackage.jsonlacks fails the run. - Expect a private repo to run every script in one
checksjob. In a public repo,bun-checks.ymlgives each oftest:e2e,test:browser,test:docker,test:hostandtest:agent-sdka job of its name, such astest-e2e. It runs each othertest:<name>script in thetestjob, and the rest in thestaticjob. - Require
pr / checksin themainruleset. In a public repo, thechecksjob fails when any other job fails. - Put a job of your own in a workflow you write, such as
image.yml. - Never require a branch to be up to date before merge. The push run on
maintests the merged tree.
Find the repo's test budget in the Facts table of its project-ci-design skill. The budget caps the median test time: the slowest test job in a public repo, and the sum of the steps that run test scripts in a private one. When the repo has no budget, skip each rule that uses one. Measure each time and median in this skill as Run times says.
- In a public repo, move a script into a job in a workflow you write only when its step takes over
60 s longer than the steps that set up a job, such as the checkout and
bun install. Shard tests only when the repo is over its test budget. - In a private repo, write a job of your own only for a heavy check: one on any runner but a
GitHub-hosted
ubuntu-*, or one that sets up KVM. Run it onscheduleorworkflow_dispatch. A required check runs on every push to a pull request, so never require a heavy check. - Give a required job no
if:or path filter. GitHub counts a skipped required check as a pass.
Timeouts
- Set
timeout-minuteson every job that runs steps. GitHub refuses it on a job that calls a reusable workflow, so pass the workflow'stimeout-minutesinput when it has one. - Set 20 minutes on a job with tests. Once its tests have stayed within the test budget for a week
of runs on
main, set twice the budget plus the job's median time outside its tests. - Set twice the median time on a job with no tests, and never less than 5 minutes.
- Set the timeout of the
bun-checks.ymljobs with the repo variableBUN_CHECK_TIMEOUT_MINUTES. Set it to the slowest test job's timeout. In a workflow you write that callsbun-checks.yml, pass the variable the waypr.ymldoes.
Reusable workflows
-
Share steps as a reusable workflow. A composite action fails as one red line, with no step to point at.
-
Before you write setup steps, look for a shared workflow in zgeoff/tools.
-
In a workflow you write, pin each call of a zgeoff/tools workflow to the latest commit on
main, with the# maincomment:uses: zgeoff/tools/.github/workflows/<name>.yml@<commit> # main -
Never move the pin by hand. Repo-sync moves each pin in
.github/workflows/, yours included.
Step scripts
- Keep each
run:to one plain command, with no shellif, loop,&&,||,;, pipe or${{ }}. Pass an expression's value throughenv:. - Write the script in TypeScript under
scripts/<job>/. Run it asbun run --silent ci:<name>, from a package script such as"ci:tag-release": "bun scripts/release/tag-release.ts". - Keep step scripts out of
.github/. Each script's test sits beside it, andbun testskips hidden folders.
Path filters
Filter a job only when you can list every path it reads, shared packages, bun.lock and the
workflow's own file included. Filter it with a changes job, and leave paths off the trigger: a
workflow that never starts reports no checks, so a required check in it blocks the merge.
jobs:
changes:
uses: zgeoff/tools/.github/workflows/paths-changed.yml@<commit> # main
with:
paths: |
services/api/**
packages/shared/**
bun.lock
.github/workflows/image.yml
image: # not a required check, so a skip is safe
needs: changes
# != 'false', so a failed changes job still runs the image build
if: ${{ !cancelled() && needs.changes.outputs.changed != 'false' }}
timeout-minutes: 15
Cancelling runs
-
Write a workflow of your own for the checks of a push to
main, such as amain.ymlthat callsbun-checks.yml. Repo-sync delivers none. Never cancel its runs: a cancelled run leaves that merged commit untested. -
In each pull-request workflow you write, cancel the older run. Name the workflow in the group, so two workflows never cancel each other:
concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -
Never cancel a release, deploy or migrate job: a deploy cut off halfway leaves its target half changed. Give the job its own job-level group, such as
deploy-${{ github.ref }}, withcancel-in-progress: false. -
When checks and a deploy share a workflow, put the checks' group at job level too. Then a newer run cancels only the checks.
-
In a workflow that runs only on
main, group bygithub.sha, withcancel-in-progress: false. Then two runs of one commit, such as a rerun and a dispatch, wait for each other.
Builds
- Build each artifact once per run. Pass an image on through the registry or buildx's
type=ghacache, and a file throughactions/upload-artifact. - Never cache
~/.bun/install/cacheornode_modules.bun install --frozen-lockfileis faster than the restore. - When a job reads git history, such as tags, check out with
fetch-depth: 0andfilter: blob:none. When it reads many old files, usefilter: ''in place ofblob:none. For a diff against the base branch, usefetch-depth: 2.
workflow_run triggers
When a job that workflow_run starts holds a secret or write access, give the job this if:. A
pull_request run can hold a fork's code, and a fork's main passes a branches: [main] filter on
the trigger.
if: >-
contains(fromJSON('["push","schedule"]'), github.event.workflow_run.event) &&
github.event.workflow_run.head_repository.full_name == github.repository
First-party packages
When bunfig.toml sets minimumReleaseAge, give each first-party package an exclude. Renovate
bumps each one as soon as it publishes, and bun install refuses a release younger than that age.
- Run
bun x @zgeoff/chex dependency-gates, and add each first-party package it lists tominimumReleaseAgeExcludes, by its full name, such as@zgeoff/std. - Never write a scope, such as
@zgeoff/*. Bun accepts it with no warning and lets nothing through. - Never write a removal comment for a first-party package. The audit-fix workflow deletes the exclude of each package a removal comment names, on its removal date.
- Add a missing exclude in a pull request of its own into
main. Renovate drops a commit you push to its branch. Once yours merges, tick the rebase checkbox in each red Renovate pull request.
Dependency exceptions
- Add a release-age exclude, an override or an audit ignore for a third-party package only for a named reason, such as a fix the repo needs. Add it as Dependency exceptions says.
- When a release older than
minimumReleaseAgeholds the fix, lock it as step 2 of Release-age excludes says, and add no exclude. - Remove each exclude, override or ignore once it guards nothing.
chex dependency-gatesfails the run on an expired exclude, an override that everybun.lockrange admits, and an ignore that no locked package needs.
04 同仓库更多 Skills
tickets
What a good Linear issue is in team GEO - its sections, when it is Ready, its fields, the Actions an agent may take, cross-repo and umbrella work, and how to save it. Load it before you write, rewrite, groom, split or save an issue, or judge whether one is Ready.
release
How z-release takes merged work to live across the zgeoff repos - release PRs, the nightly batch, cloud deploys, bump PRs, host switches, the nixie memory-store backup check, recovery and the hard timing rules. Load it in z-release's session, and before any release, deploy, host switch, atc upgrade or rollback.
preview-qa
Runs live checks for the owner's issues, on a PR's preview environment before the merge and read-only on production once the release ships, records the evidence on the issue, closes it, and hands back only the checks that need the owner. Use when z-review sends a preview check with an issue, its PR and the items to check, or when hq or z-release messages "Shipped, now live-check".
pr-review
How z-review reviews and merges every PR in the zgeoff repos, and files the only follow-up issues a PR may leave. Load it when hq messages "Final: GEO-n (repo#n at <sha>)", when an agent answers a finding, when a session sends z-review a PR to merge, or before an issue is filed from a PR.
owner-calls
What only the owner decides, how a session puts something to the owner, how the owner's answers count, and the fleet's shared terms. Load it before you flag an issue for the owner, send a decision or a hands-on step for the owner, decide something under a grant, or act on an answer of the owner's.
linear-triage
How z-triage keeps the owner's Linear workspace accurate: grooming every open issue, moving it to Ready once it meets the criteria, acting on hq's alerts, and queuing the owner's questions as calls. Load it for each scheduled pass and check, when a session asks for a check now, when hq sends an alert, and before an issue is written or rewritten.