@futurelastic/colab-handbook 1.20.4-rc.9 → 1.21.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/audit/audit.mjs +70 -0
- package/package.json +1 -1
- package/templates/README.md +39 -9
- package/templates/ci-call.yml +74 -0
- package/templates/ci-laravel.yml +128 -682
- package/templates/ci-node.yml +88 -676
- package/templates/ci-python.yml +104 -644
- package/tools/colab +96 -6
- package/tools/lib/ci-wait.js +16 -2
- package/tools/lib/gate-drift.js +112 -0
- package/tools/lib/git.js +44 -1
- package/tools/lib/stale-base.js +15 -2
- package/tools/lib/stamp.js +15 -9
- package/tools/lib/template-roundtrip.js +7 -4
- package/tools/lib/template-trunk.js +45 -4
- package/tools/lib/verify-runs.js +207 -15
package/audit/audit.mjs
CHANGED
|
@@ -123,6 +123,8 @@ const npmGuard = require("../tools/lib/npm-publish-guard.js");
|
|
|
123
123
|
const installRoute = require("../tools/lib/install-route.js");
|
|
124
124
|
const releaseRunner = require("../tools/lib/release-runner.js"); // #453
|
|
125
125
|
const { parseWorkflowOn, workflowFiresOnTag, prereleaseTagTriggers, workflowsFiringOnBranchPush, instructionFilesCallerFindings } = require("../tools/lib/workflow-triggers.js");
|
|
126
|
+
// #721: a copied CI gate, or one that never skips, is drift — the pure reading lives with its tests.
|
|
127
|
+
const gateDrift = require("../tools/lib/gate-drift.js");
|
|
126
128
|
const shipBatch = require("../tools/lib/ship-batch.js");
|
|
127
129
|
const integrationProfile = require("../tools/lib/integration-profile.js"); // #610
|
|
128
130
|
const ciProfile = require("../tools/lib/ci-profile.js"); // #559
|
|
@@ -584,6 +586,13 @@ function listRemoteDir(slug, path) {
|
|
|
584
586
|
}
|
|
585
587
|
}
|
|
586
588
|
|
|
589
|
+
// #721: one GitHub REST read, parsed — null when it could not be read (offline, no auth, an API error).
|
|
590
|
+
function readRemoteJson(slug, path) {
|
|
591
|
+
const r = remoteCache.get(slug, `repos/${slug}/${path}`);
|
|
592
|
+
if (r.status !== "ok") return null;
|
|
593
|
+
try { return JSON.parse(r.text); } catch { return null; }
|
|
594
|
+
}
|
|
595
|
+
|
|
587
596
|
function listRemoteBranches(slug) {
|
|
588
597
|
const r = remoteCache.get(slug, `repos/${slug}/branches`, { paginate: true });
|
|
589
598
|
return r.status === "ok" ? r.items.map((b) => String(b.name)) : null; // null = could not determine, distinct from "no branches"
|
|
@@ -872,6 +881,12 @@ function makeSource(target) {
|
|
|
872
881
|
const slug = url ? githubSlugFromRemote(url) : null;
|
|
873
882
|
return slug ? readRemoteIssue(slug, num) : null;
|
|
874
883
|
},
|
|
884
|
+
// #721: a REST read under repos/<slug>/ on the same resolved remote; null = unreadable.
|
|
885
|
+
ghApi: (p) => {
|
|
886
|
+
const url = gitRemote.remoteUrl(root);
|
|
887
|
+
const slug = url ? githubSlugFromRemote(url) : null;
|
|
888
|
+
return slug ? readRemoteJson(slug, p) : null;
|
|
889
|
+
},
|
|
875
890
|
// Same remote-slug resolution as labels() above, one API call, and only when the
|
|
876
891
|
// identity scan was explicitly asked for — see readRemoteMetadata for the contract.
|
|
877
892
|
// An unresolvable remote is its own status, not "no-remote": the scan was asked for
|
|
@@ -930,6 +945,7 @@ function makeSource(target) {
|
|
|
930
945
|
isLinkedWorktree: () => false,
|
|
931
946
|
labels: () => listRemoteLabels(target.slug),
|
|
932
947
|
issue: (num) => readRemoteIssue(target.slug, num),
|
|
948
|
+
ghApi: (p) => readRemoteJson(target.slug, p),
|
|
933
949
|
// Anchor-link check is local-only by design (#158) — enumerating markdown remotely
|
|
934
950
|
// would be N `gh api` calls per repo across a fleet sweep. Empty list = the check
|
|
935
951
|
// scans nothing and emits nothing for a remote source, matching checkRunbook's
|
|
@@ -2187,6 +2203,8 @@ function auditRepoInner(target, ctx) {
|
|
|
2187
2203
|
info.predatesAxes = [];
|
|
2188
2204
|
info.suggestions = [];
|
|
2189
2205
|
const suggest = (t) => info.suggestions.push(t);
|
|
2206
|
+
// #721: the CI dedupe gate maintained once — a copy of it, or a gate that never skips, is drift.
|
|
2207
|
+
checkGateDrift(src, workflows, cfg?.trunk ?? null, warn, { self: isSelf, suggest });
|
|
2190
2208
|
if (integrationSuggestion) suggest(integrationSuggestion); // #610
|
|
2191
2209
|
if (!isSelf) checkStamps(src, ctx.handbook, ctx.templateNames, fail, warn, { ceremony, missingAxes, predatesAxes: info.predatesAxes, writesRaw, suggest });
|
|
2192
2210
|
|
|
@@ -2853,6 +2871,58 @@ function checkInstructionFilesCaller(src, workflows, trunk, warn) {
|
|
|
2853
2871
|
for (const f of instructionFilesCallerFindings({ readFile: (p) => src.readFile(p), workflows, trunk })) warn(f.text);
|
|
2854
2872
|
}
|
|
2855
2873
|
|
|
2874
|
+
// ---- CI gate drift (#721) ----------------------------------------------------
|
|
2875
|
+
// The dedupe gate lives once, in the handbook's reusable workflow (.github/workflows/ci-light.yml).
|
|
2876
|
+
// Two readings, both warn (drift, not customisation — the repo still owns its files):
|
|
2877
|
+
// 1. a workflow carrying its own copy of the gate instead of calling ci-light.yml — static, always;
|
|
2878
|
+
// 2. a guarded workflow whose last N trunk push runs never skipped although one landed a tree another
|
|
2879
|
+
// ref had already passed green — read from run history, so only where GitHub can be read.
|
|
2880
|
+
// The handbook itself is the source: its ci.yml and ci-light.yml carry the gate by design, so the
|
|
2881
|
+
// static reading is off here (self-audit); the history reading still runs.
|
|
2882
|
+
// Reading 1 is a warn only once the handbook's latest release tag carries ci-light.yml: before that
|
|
2883
|
+
// there is nothing to switch TO (a caller pins a tag), so it is a suggestion — the #607 posture for a
|
|
2884
|
+
// CI copy — and it turns into drift by itself the day a release ships the workflow.
|
|
2885
|
+
let reusableReleasedMemo;
|
|
2886
|
+
function reusableReleased() {
|
|
2887
|
+
if (reusableReleasedMemo !== undefined) return reusableReleasedMemo;
|
|
2888
|
+
const hb = handbookInfo(HANDBOOK_ROOT);
|
|
2889
|
+
reusableReleasedMemo = false;
|
|
2890
|
+
if (hb.hasGit && !hb.untagged) {
|
|
2891
|
+
try {
|
|
2892
|
+
execFileSync("git", ["-C", HANDBOOK_ROOT, "cat-file", "-e", `${hb.version}:${gateDrift.REUSABLE_PATH}`], { stdio: "ignore" });
|
|
2893
|
+
reusableReleasedMemo = hb.version;
|
|
2894
|
+
} catch { reusableReleasedMemo = false; }
|
|
2895
|
+
}
|
|
2896
|
+
return reusableReleasedMemo;
|
|
2897
|
+
}
|
|
2898
|
+
function checkGateDrift(src, workflows, trunk, warn, { self = false, suggest = () => {} } = {}) {
|
|
2899
|
+
const { callers, copies } = gateDrift.copiedGates({ readFile: (p) => src.readFile(p), workflows });
|
|
2900
|
+
if (!self && copies.length) {
|
|
2901
|
+
const released = reusableReleased();
|
|
2902
|
+
for (const wf of copies) {
|
|
2903
|
+
if (released) warn(gateDrift.copiedGateText(wf));
|
|
2904
|
+
else suggest(`${wf}: ${gateDrift.copiedGateText(wf)} — a suggestion until a handbook release tag carries ${gateDrift.REUSABLE_PATH}`);
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
if (!trunk || typeof src.ghApi !== "function") return;
|
|
2908
|
+
for (const wf of [...callers, ...copies]) {
|
|
2909
|
+
if (self && wf === "ci-light.yml") continue; // the callee: its runs are its callers'
|
|
2910
|
+
const q = (p) => src.ghApi(`actions/workflows/${encodeURIComponent(wf)}/${p}`);
|
|
2911
|
+
const trunkList = q(`runs?branch=${encodeURIComponent(trunk)}&event=push&status=completed&per_page=${gateDrift.RECENT_TRUNK_RUNS}`);
|
|
2912
|
+
if (!trunkList || !Array.isArray(trunkList.workflow_runs)) continue; // unreadable or offline — say nothing
|
|
2913
|
+
const greenList = q("runs?event=push&status=success&per_page=50"); // the guard's own window (#493)
|
|
2914
|
+
if (!greenList || !Array.isArray(greenList.workflow_runs)) continue;
|
|
2915
|
+
const tree = (r) => (r.head_commit && r.head_commit.tree_id) || null;
|
|
2916
|
+
const trunkRuns = trunkList.workflow_runs.slice(0, gateDrift.RECENT_TRUNK_RUNS).map((r) => {
|
|
2917
|
+
const j = src.ghApi(`actions/runs/${r.id}/jobs?per_page=100`);
|
|
2918
|
+
return { id: r.id, tree: tree(r), created: r.created_at, jobs: j && Array.isArray(j.jobs) ? j.jobs : null };
|
|
2919
|
+
});
|
|
2920
|
+
const greenRuns = greenList.workflow_runs.map((r) => ({ id: r.id, branch: r.head_branch, tree: tree(r), created: r.created_at }));
|
|
2921
|
+
const r = gateDrift.gateNeverSkips({ trunkRuns, greenRuns, trunk });
|
|
2922
|
+
if (r.verdict === "drift") warn(gateDrift.inertGateText(wf, r));
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
|
|
2856
2926
|
// ---- a deploy trigger that fires on a pre-release tag (#332) ---------------
|
|
2857
2927
|
// The logic lives in tools/lib/workflow-triggers.js (#338) so `colab release cut` refuses on the
|
|
2858
2928
|
// same finding; this maps its severity onto the audit's fail/warn.
|
package/package.json
CHANGED
package/templates/README.md
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Starting points you **copy into your own repo**. That is the entire model.
|
|
4
4
|
|
|
5
|
-
> **These are NOT called remotely — with
|
|
5
|
+
> **These are NOT called remotely — with two exceptions.** `instruction-files.yml` is a caller:
|
|
6
6
|
> its one job `uses:` this handbook's reusable `.github/workflows/instruction-files.yml` (#588,
|
|
7
|
-
> kept for compatibility — see *Where each file lives* below).
|
|
8
|
-
>
|
|
7
|
+
> kept for compatibility — see *Where each file lives* below). The light CI templates are the other:
|
|
8
|
+
> `ci-node.yml`, `ci-python.yml`, `ci-laravel.yml` (since #724) and the generic `ci-call.yml` call the
|
|
9
|
+
> reusable light lane `.github/workflows/ci-light.yml`, pinned to a release tag (#721 — see
|
|
10
|
+
> *The reusable light lane* below). Every other file here is copied, not called. (`dist-refs.yml` is a
|
|
9
11
|
> `workflow_call` workflow, but its caller is your own release workflow, in the same repo, via
|
|
10
12
|
> `uses: ./.github/workflows/dist-refs.yml` — the file still lives, in full, where it runs.) An earlier version of this
|
|
11
13
|
> handbook told repos to call shared workflows; that was reversed. Every other workflow now
|
|
@@ -102,10 +104,11 @@ check that reads one of these files is that tool's behaviour, documented with th
|
|
|
102
104
|
|
|
103
105
|
| File | Copy to | For | Notes |
|
|
104
106
|
|---|---|---|---|
|
|
105
|
-
| `ci-
|
|
106
|
-
| `ci-
|
|
107
|
-
| `ci-
|
|
108
|
-
| `ci-python.yml` | `.github/workflows/ci.yml` |
|
|
107
|
+
| `ci-call.yml` | `.github/workflows/ci.yml` | The generic caller: a hybrid repo, or a stack with no `ci-<stack>.yml` of its own (#721) | **A caller, not a copy:** triggers, concurrency and one `uses:` of the handbook's reusable `.github/workflows/ci-light.yml` — the dedupe gate, the secret scan, a `quick` and a `full` job, job-class `runs-on`. `colab template ci-call` writes this repo's trunk refs and pins the call to the release it stamps. Your commands go in `with:` (`toolchain`, `install`, `quick`, `full`); your own jobs sit beside the call. A copied gate is reported as drift. |
|
|
108
|
+
| `ci-node.yml` | `.github/workflows/ci.yml` | Pure Node repos: Vite SPA, node libs, Astro static, **Capacitor apps** | A **caller** of `ci-light.yml` (#724), its `with:` filled in for Node: typecheck/lint in `quick`, `npm test` and the build in `full`, each only if `package.json` declares it. The call resolves Node from `project.yml` → `.nvmrc`/`engines` → **fails**. Never a default. Opt-in `Migration round-trip` job beside the call — `--roundtrip` writes it live, see *Migration round-trip* below. |
|
|
109
|
+
| `ci-laravel.yml` | `.github/workflows/ci.yml` | Laravel + Inertia + Vite fullstack (with route/type codegen) | A **caller** of `ci-light.yml` (#724). Same resolution for **both** PHP and Node. Its `full` script carries the test tier (`RUN_TESTS`), the sqlite bootstrap + explicit wayfinder step and the Vite build; beside the call, a `migrations` job that round-trips the schema (migrate → rollback → seed → migrate, schema compared) on the test engine **and** the deploy engine (a MariaDB/MySQL service container at production's version). Its data-dependent checks need `ROUNDTRIP_SEEDER` — see *Migration round-trip* below. |
|
|
110
|
+
| `ci-node-heavy.yml`, `ci-python-heavy.yml`, `ci-laravel-heavy.yml` | `.github/workflows/ci-heavy.yml` | The heavy lane beside the matching `ci-<stack>.yml` (above) | `schedule` + `workflow_dispatch` + `workflow_call`, never a push. **Still a copy** (#724 kept it one: it runs nightly and on candidates, never per merge, so it is not what drifted, and its plan gate is per-repo). Its toolchain resolution follows the same precedence as the reusable light lane's, and the `secrets` job's gitleaks install and `GITLEAKS_VERSION` follow its `gitleaks` job — keep them in step. `TRUNK` is an edit point. |
|
|
111
|
+
| `ci-python.yml` | `.github/workflows/ci.yml` | Python: FastAPI/Flask services, CLIs, libraries | A **caller** of `ci-light.yml` (#724): byte-compile, ruff and mypy in `quick`, pytest in `full`, each only if installed. The call resolves Python from `project.yml` → `.python-version`/`requires-python` → **fails**. `requirements.txt` does not count. **Hybrid** Python+Node repo: `toolchain: python,node` in the same call — see the template header. Opt-in `Migration round-trip` job, as in `ci-node.yml`. |
|
|
109
112
|
| `release-tag.yml` | `.github/workflows/release.yml` | Any repo cutting `v*.*.*` releases | Triggers on tag push. Publishes a grouped GitHub Release — a `-rc.N` tag as a pre-release, every summary since the previous *final* tag. No toolchain, no deploy; its header shows the `!v*.*.*-*` exclusion a deploy trigger needs. |
|
|
110
113
|
| `release-auto.yml` | `.github/workflows/release-auto.yml` | A repo whose release tags land on `main` (`trunk: main`, `deploy: tag` or `none`) and whose §6 release route cuts candidates | Runs `colab release cut --auto` after CI goes green on main — at the sha that CI run tested (`--sha`, #622), even once main has moved on — and `colab release finalize --auto` daily — plus an hourly run that re-tries only a refused cut, once the fetched CLI has moved within `RETRY_WINDOW_MINUTES` or a run at main's head was cancelled (#547) — from a handbook ref (`HANDBOOK_REF` — the `stable` channel by default, `next` for the fast channel, or an exact tag to freeze; #445) — the handbook's own copy runs its checkout's CLI instead, since it ships the CLI it releases with (#428). **Publishes the Release in the same run** — a tag pushed with `GITHUB_TOKEN` triggers no other workflow, so `release-tag.yml` would never fire for it. A refusal is a warning, not a red run. Reads and creates tags, and fast-forwards the release channels `next` / `stable` (branches naming the newest candidate / final, #445); never pushes a commit. The audit recognises any workflow running `release cut/finalize --auto` and warns when the route leaves candidates off, when it tags without publishing while a tag-push workflow waits, or when it commits. |
|
|
111
114
|
| `forgejo-release-auto.yml` | `.forgejo/workflows/release-auto.yml` | A repo hosted on **Forgejo** (or Gitea) whose §6 release route cuts candidates, with the forge named in the machine config's `forges` (#678) | The Forgejo dialect of `release-auto.yml` (#681). It has no `workflow_run`: the job you append to your CI (in its header) dispatches it when CI ends green, with `source=ci-completed` and the sha it tested. It waits for CI at that sha (`colab ci-wait`), then runs `colab release cut --auto --sha`, which tags the candidate and publishes its pre-release through the forge's API. No `permissions:` blocks, full-URL `uses:`, the runner label from the `RELEASE_RUNNER` variable, verdicts printed to the log (Forgejo drops the step summary), no `jq`. A refusal stays green. No verdict is a red run. **No finalize step**: on a forge a final is a human's `release finalize` under the human bar, which also publishes the final's release, so no tag-push workflow is needed. Keep its `name:` equal to the file's base name, because the CLI drops its own statuses by that name. |
|
|
@@ -176,11 +179,38 @@ The rule all of this keeps: [one verdict per tree](../CONVENTIONS.md#one-verdict
|
|
|
176
179
|
Opt out with `tree-reuse: off` (`project.schema.md`) when trunk's run proves something a branch
|
|
177
180
|
run cannot: secrets only trunk gets, `github.ref`-conditional steps, unpinned runner images.
|
|
178
181
|
|
|
182
|
+
### The reusable light lane — calling instead of copying (#721)
|
|
183
|
+
|
|
184
|
+
The guard above drifted copy by copy: measured across adopters (2026-11-09 → 11-11), missing in six
|
|
185
|
+
repositories and present but never skipping in three, and #717's fix reached a copy only through a manual
|
|
186
|
+
sync. `.github/workflows/ci-light.yml` carries the same guard, the same secret scan and the descriptor check
|
|
187
|
+
once, for every caller; `ci-node.yml`, `ci-python.yml` and `ci-laravel.yml` are its callers since #724, and
|
|
188
|
+
`ci-call.yml` is the generic one. What changes for you:
|
|
189
|
+
|
|
190
|
+
- **Only the caller is yours**: the triggers and `concurrency` (a called workflow cannot own either), the
|
|
191
|
+
`with:` block, and your own jobs beside the call. A job behind the gate reads `needs: ci` +
|
|
192
|
+
`if: ${{ !cancelled() && needs.ci.result == 'success' && needs.ci.outputs.tested != 'true' }}` (the
|
|
193
|
+
result term keeps it off a red call); a trunk-only job outside it is named in `trunk-only-jobs` (#717).
|
|
194
|
+
- **Pinned to a release tag, never `main`.** `colab template ci-<stack>` writes the version it stamps the
|
|
195
|
+
copy with; `colab update` moves a pristine copy's stamp and pin together — including a pristine full copy
|
|
196
|
+
from before #724, which it moves onto the caller. **Until a final release carries `ci-light.yml`** (the
|
|
197
|
+
stamp is always the latest final, never a candidate, #334), `colab template ci-<stack>` and `colab update`
|
|
198
|
+
write that release's *own* template — a full copy that runs today — never a caller pinned at a release
|
|
199
|
+
that cannot run it (#724).
|
|
200
|
+
- **The quick/full split is two jobs**: `quick` (descriptor check, lint, types, unit — the `quick` class)
|
|
201
|
+
and `full` (the light suite, the build — the `full` class); both run on every push the gate does not skip,
|
|
202
|
+
and both take the `trunk` class on a trunk ref under `runs-on: classes`.
|
|
203
|
+
- **The package caches moved too**: npm, pip and Composer, each on only on a GitHub-hosted runner and with
|
|
204
|
+
its lockfile present (#571), now in the call. Laravel's PHP extensions are the `php-extensions` input.
|
|
205
|
+
- A workflow still carrying its own copy of the gate is reported as drift — a suggestion until a handbook
|
|
206
|
+
release tag carries `ci-light.yml`, a warning from then on.
|
|
207
|
+
|
|
179
208
|
### Migration round-trip — have it from the first copy
|
|
180
209
|
|
|
181
210
|
`migration-grant: reviewer` grants only where a `Migration round-trip…` job passed at the
|
|
182
211
|
shipped head (condition R, [CONVENTIONS §5](../CONVENTIONS.md#migration-exemption--a-narrow-door-through-no-new-migrations-opened-by-a-role-98-402)).
|
|
183
|
-
`ci-laravel.yml` always carries it
|
|
212
|
+
`ci-laravel.yml` always carries it, as a job beside the call (`needs: ci`, behind the gate). `ci-node.yml`
|
|
213
|
+
and `ci-python.yml` carry it as an opt-in
|
|
184
214
|
block, and **the time to opt in is the copy** (#625):
|
|
185
215
|
|
|
186
216
|
```sh
|
|
@@ -192,7 +222,7 @@ colab template ci-python --dest .github/workflows/ci.yml --roundtrip --roundtrip
|
|
|
192
222
|
that can rewrite the job grading it never passes R — so that one branch, and its migration,
|
|
193
223
|
ships on a human grant. In the commit that creates the workflows, there is no such branch.
|
|
194
224
|
- **No migrations yet?** Leave out `--roundtrip-apply`. The job is written but **skipped**
|
|
195
|
-
until `ROUNDTRIP_APPLY` (
|
|
225
|
+
until `ROUNDTRIP_APPLY` (the `roundtrip-config` job's `env`, beside the call — a job-level `if:` cannot read `env`, so that small job hands it on) is set: a skipped leg never passes
|
|
196
226
|
R, so migrations ship on a human grant, and CI stays green — a fresh repo is not held red.
|
|
197
227
|
The build job prints a warning saying so. The cost while skipped: trunk does not reuse a
|
|
198
228
|
branch's identical-tree run (#511). A green no-op job would pass R without testing
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# CI (light lane) — CALLER of the handbook's reusable workflow (#721). Copy to .github/workflows/ci.yml
|
|
2
|
+
# with `colab template ci-call --dest .github/workflows/ci.yml`: it writes this repo's trunk refs and pins the call to the handbook
|
|
3
|
+
# release it stamps the copy with. Like templates/ci-<stack>.yml (callers too since #724, each with one
|
|
4
|
+
# stack's `with:` filled in — this one is the generic caller, for a hybrid), nothing below the `uses:` line is
|
|
5
|
+
# yours to maintain — the dedupe gate, the secret scan, the quick/full split and the job-class
|
|
6
|
+
# `runs-on` live once, in .github/workflows/ci-light.yml of the handbook, and a release moves them.
|
|
7
|
+
#
|
|
8
|
+
# EDIT POINTS are marked `# EDIT:` — the `with:` block is the only real one.
|
|
9
|
+
#
|
|
10
|
+
# Kept HERE because a called workflow cannot declare them (CONVENTIONS.md §7, "One verdict per tree"):
|
|
11
|
+
# - the triggers: every branch (#384 — a candidate gets a run of its own before the merge; '**'
|
|
12
|
+
# also covers `ship-batch/**`), no `pull_request` beside push (#512), and workflow_dispatch (the
|
|
13
|
+
# release workflow dispatches CI on a promotion its token cannot trigger, #440);
|
|
14
|
+
# - concurrency: one live run per branch, a trunk run never cancelled and in a group of its own (#512).
|
|
15
|
+
# Its trunk refs and the `trunk-branches` input name the same branches — `colab template` writes both.
|
|
16
|
+
name: CI
|
|
17
|
+
|
|
18
|
+
on:
|
|
19
|
+
push:
|
|
20
|
+
branches: ['**']
|
|
21
|
+
workflow_dispatch:
|
|
22
|
+
|
|
23
|
+
concurrency:
|
|
24
|
+
group: ci-${{ github.ref }}${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && format('-{0}', github.run_id) || '' }}
|
|
25
|
+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev' }}
|
|
26
|
+
|
|
27
|
+
# The called jobs can only narrow these: the gate lists this workflow's runs and reads git objects.
|
|
28
|
+
permissions:
|
|
29
|
+
actions: read
|
|
30
|
+
contents: read
|
|
31
|
+
|
|
32
|
+
jobs:
|
|
33
|
+
ci:
|
|
34
|
+
# Pinned to a handbook release, never a branch: a caller tracking `main` would take every gate
|
|
35
|
+
# change the moment it merges there, untested against this repo. Move the tag deliberately
|
|
36
|
+
# (`colab update` refreshes a pristine copy to the current release).
|
|
37
|
+
uses: futurelastic/colab-handbook/.github/workflows/ci-light.yml@HANDBOOK_TAG
|
|
38
|
+
with:
|
|
39
|
+
trunk-branches: '["main","dev"]'
|
|
40
|
+
# EDIT: one stack — keep the lines for yours, delete the rest. Versions are resolved from
|
|
41
|
+
# .github/project.yml, then the manifest (.nvmrc / engines.node, .python-version /
|
|
42
|
+
# requires-python, composer.json require.php); none declared fails the job, never a default.
|
|
43
|
+
#
|
|
44
|
+
# Node:
|
|
45
|
+
toolchain: node
|
|
46
|
+
install: auto # npm ci / pnpm install --frozen-lockfile, from the lockfile
|
|
47
|
+
quick: npm run --if-present typecheck && npm run --if-present lint
|
|
48
|
+
full: npm test --if-present && npm run --if-present build
|
|
49
|
+
#
|
|
50
|
+
# Python:
|
|
51
|
+
# toolchain: python
|
|
52
|
+
# install: auto # pip install -e . (or -r requirements.txt), then requirements-dev.txt
|
|
53
|
+
# quick: python -m ruff check . && python -m mypy src
|
|
54
|
+
# full: python -m pytest -q -m "not heavy" || [ $? -eq 5 ]
|
|
55
|
+
#
|
|
56
|
+
# Laravel (PHP + Vite):
|
|
57
|
+
# toolchain: php,node
|
|
58
|
+
# install: auto # composer install, then npm ci
|
|
59
|
+
# quick: vendor/bin/pint --test
|
|
60
|
+
# full: cp .env.example .env && php artisan key:generate && npm run build && php artisan migrate --force && vendor/bin/pest --ci --exclude-group=heavy
|
|
61
|
+
#
|
|
62
|
+
# EDIT: self-hosted runners — `classes` runs each job on ["self-hosted", <class>]: `trunk` on a
|
|
63
|
+
# trunk ref, else `quick` or `full` (CONVENTIONS.md §7, "Runner classes"). A public repo keeps
|
|
64
|
+
# the default, ubuntu-latest. A bare label or a JSON label list also works.
|
|
65
|
+
# runs-on: classes
|
|
66
|
+
# runner-lane: my-repo-lane # only for a capped lane (rule 3)
|
|
67
|
+
#
|
|
68
|
+
# EDIT: name your trunk-only jobs below (deploy, publish) when they sit outside the gate (#717).
|
|
69
|
+
# trunk-only-jobs: Deploy
|
|
70
|
+
|
|
71
|
+
# Your own jobs go here, beside the call. Behind the gate (they skip when the tree already passed):
|
|
72
|
+
# needs: ci
|
|
73
|
+
# if: ${{ !cancelled() && needs.ci.result == 'success' && needs.ci.outputs.tested != 'true' }}
|
|
74
|
+
# Trunk-only and ungated: no `if:` on the guard, and list the job's name in `trunk-only-jobs` above.
|