@rightkit/ci 0.3.1 → 0.3.3
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/README.md +3 -26
- package/install.mjs +1 -1
- package/manifest.mjs +46 -105
- package/manifest.schema.json +1 -7
- package/package.json +3 -4
- package/templates/profiles/rust-hybrid/ci.yml +2 -2
- package/templates/profiles/rust-hybrid/regenerate.yml +11 -6
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Public-repository-only GitHub Actions workflow layer for Right Suite products. T
|
|
|
26
26
|
Each lane that compiles or tests renders a `check` job right after `private-repo-guard`, and every other job of that workflow needs it, directly or through a job that does. Nothing builds or qualifies a tree the check refused (pipeline invariant P1, rightkit#833).
|
|
27
27
|
|
|
28
28
|
- **What it runs.** `actions/checkout` at depth 1 (`persist-credentials: false`), `setup-node` (first `matrix.node`), the package manager, a frozen install without lifecycle scripts (`pnpm install --frozen-lockfile --ignore-scripts`; `npm ci --ignore-scripts`; `yarn install --frozen-lockfile --ignore-scripts`), then `pnpm exec rightkit-gate check --commit HEAD`. Committed files only: no network after the install, no compile, no broker, no secret. The job runs where the workflow's guard runs, times out after 15 minutes and pins its actions like the other jobs of the same file (tags in the node lane files, commits in `swift-check` and the rust-hybrid files).
|
|
29
|
-
- **Dependencies.** It needs only `private-repo-guard`. `test` (node `ci`), `ci`
|
|
29
|
+
- **Dependencies.** It needs only `private-repo-guard`. `test` (node `ci`), `ci` (rust-hybrid), `qualification`, `clean-tarball`, `candidate`, `swift-check`, `publish-npm`, the release chain's `admission` and the parallel `dev-artifact-*` jobs list it in `needs`.
|
|
30
30
|
- **The repository must depend on `@rightkit/release` 0.6.5 or later**, the first release with `rightkit-gate check`. Sync the new render only after the app has bumped it, or every run fails at the last step. `right-git sync` and `right-git install` read the pin from `package.json` (`devDependencies`, else `dependencies`) whenever a lane that renders the check job is declared: an exact pin below 0.6.5 is refused at stage `dependency` and nothing is written; a range, a non-registry spec or no `@rightkit/release` dependency prints a `warn:` line to stderr and the sync goes on, because the install may still resolve a new enough version. (`candidate.releaseChain` keeps its own, stricter rule: a direct devDependency pinned to an exact published version.) The install is not filtered to `@rightkit/release`: `pnpm install --filter` selects workspace projects, and in a consumer `@rightkit/release` is a registry dependency, so the filter matches no project, installs nothing and exits 0. npm and yarn call `./node_modules/.bin/rightkit-gate` by path, because `npm exec` fetches an unknown name from the registry in CI.
|
|
31
31
|
- **A release-candidate checks the revision it builds** (`inputs.source_revision`, or the pushed commit in the node lane's tag push). Its checkout is the one shallow checkout among the jobs of an admitted revision: the check only reads the committed files of HEAD and never runs `right-release`, so it has no reachability to prove.
|
|
32
32
|
- **publish-npm checks the release tag it publishes.** The lane checks out `github.event.release.tag_name`, installs, rebuilds the tarball from source (`build-candidate.mjs`), runs `check-release.mjs` and publishes with `id-token: write`, so it builds and tests like the other lanes. Its `check` job checks out the same tag, has no permission beyond the workflow's `contents: read`, no environment and no secret, and the publish job needs it: a tag whose committed files the check refuses never reaches the OIDC token or the registry.
|
|
@@ -81,32 +81,9 @@ Set `"ciAllOs": true` to run the rust-hybrid `ci` gate on every `matrix.os` runn
|
|
|
81
81
|
|
|
82
82
|
Omit the key, or set it to `false`, and the rendered `ci.yml` keeps one runner, preferring the first `windows-*` entry. `ciAllOs: true` is rejected for other profiles.
|
|
83
83
|
|
|
84
|
-
##
|
|
84
|
+
## One door (rust-hybrid)
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
```json
|
|
89
|
-
{
|
|
90
|
-
"profile": "rust-hybrid",
|
|
91
|
-
"ciAllOs": true,
|
|
92
|
-
"gate": {
|
|
93
|
-
"path": "scripts/gate.sh",
|
|
94
|
-
"quick": true,
|
|
95
|
-
"shards": [{ "id": "workspace" }, { "id": "linters" }, { "id": "rust-tools" }]
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
- **Shards.** Each shard is one more `matrix.shard` value, so the gate runs once per shard per runner as `bash <path> --group <id>`. `fail-fast: false` still applies, and all legs share one Rust cache key, so one leg's build warms the others.
|
|
101
|
-
- **Per-leg state.** Each leg keeps its own last-green marker and its own QA evidence artifact (the shard id is in both names). On a default-branch push each leg is its own concurrency slot.
|
|
102
|
-
- **`quick: true`.** Adds a `quick` job (`bash <path> --quick`, on `ubuntu-24.04`, after the check job) for the fast deterministic checks. Every leg needs it, so a formatting or record error stops the run before any shard starts.
|
|
103
|
-
- **`ci-summary`.** Passes only when every leg passed (and `quick`, when set). Use it as the one required status check: matrix job names change with the shard list.
|
|
104
|
-
- **Validation.**
|
|
105
|
-
- 2 to 16 shards.
|
|
106
|
-
- Ids are lowercase letters, digits and `-`, at most 32 characters, and unique.
|
|
107
|
-
- `quick` needs `shards`.
|
|
108
|
-
- A `devArtifact` must use `parallel: true`, because a dev artifact staged inside the ci job would be built once per shard.
|
|
109
|
-
- **Without `shards`.** The rendered `ci.yml` is byte-identical.
|
|
86
|
+
The `ci` job (and the `regenerate` lane's re-check) runs exactly one build step: `rightkit-gate --to compile` from the installed `@rightkit/release`. The gate runs class A first, then every compile, lint and test scan, on the runner's plain cargo (a CI runner has no broker). `gate.path` only names a file whose change counts as a Rust change; the repository's own script never runs. `gate.shards` and `gate.quick` are gone and are refused.
|
|
110
87
|
|
|
111
88
|
## Incremental CI and dev artifacts (rust-hybrid)
|
|
112
89
|
|
package/install.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { MANIFEST_FILENAME, validateManifest } from "./manifest.mjs";
|
|
|
12
12
|
import { applyPlan, planSync } from "./sync.mjs";
|
|
13
13
|
|
|
14
14
|
export const DEFAULT_MATRIX = { os: ["ubuntu-latest", "macos-latest", "windows-latest"], node: ["22.13", "24"] };
|
|
15
|
-
export const DEFAULT_PACKAGE_MANAGER = "pnpm@
|
|
15
|
+
export const DEFAULT_PACKAGE_MANAGER = "pnpm@12.16.1";
|
|
16
16
|
export const DEFAULT_TEMPLATE_VERSION = "1.8.0";
|
|
17
17
|
|
|
18
18
|
/**
|
package/manifest.mjs
CHANGED
|
@@ -92,42 +92,10 @@ const QA_EVIDENCE_MAX_RETENTION_DAYS = 90;
|
|
|
92
92
|
// Pinned to the same upload-artifact release the rust-hybrid release-candidate template uses.
|
|
93
93
|
export const UPLOAD_ARTIFACT_PIN = "actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4";
|
|
94
94
|
const GATE_PATH_RE = /^(?!.*\.\.)(?!.*\s)[A-Za-z0-9][A-Za-z0-9._/-]*$/;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
// gate.shards (rust-hybrid ci only): the gate runs once per shard per matrix.os runner, as
|
|
100
|
-
// `bash <gate.path> --group <id>`, on one shared Rust cache key, and a ci-summary job passes only when every
|
|
101
|
-
// leg passed. gate.quick: true adds a `quick` job (`bash <gate.path> --quick`) that every leg needs, for the
|
|
102
|
-
// fast deterministic checks. Steps that run inside the ci job once per runner (a non-parallel devArtifact)
|
|
103
|
-
// would run once per shard, so shards require devArtifact.parallel.
|
|
104
|
-
function validateGateShards(manifest, errors) {
|
|
105
|
-
const { shards, quick } = manifest.gate;
|
|
106
|
-
if (quick !== undefined && quick !== true) errors.push("gate.quick must be true when set");
|
|
107
|
-
if (shards === undefined) {
|
|
108
|
-
if (quick === true) errors.push("gate.quick requires gate.shards");
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
if (!Array.isArray(shards) || shards.length < 2 || shards.length > GATE_MAX_SHARDS) {
|
|
112
|
-
errors.push(`gate.shards must list 2 to ${GATE_MAX_SHARDS} shards`);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const seen = new Set();
|
|
116
|
-
for (const [index, shard] of shards.entries()) {
|
|
117
|
-
if (shard === null || typeof shard !== "object" || Array.isArray(shard) || Object.keys(shard).some((key) => key !== "id") || typeof shard.id !== "string" || !GATE_SHARD_ID_RE.test(shard.id)) {
|
|
118
|
-
errors.push(`gate.shards[${index}] must be { id } with a lowercase id of letters, digits and '-' (at most 32)`);
|
|
119
|
-
} else if (seen.has(shard.id)) {
|
|
120
|
-
errors.push(`gate.shards[${index}].id '${shard.id}' is listed twice`);
|
|
121
|
-
} else {
|
|
122
|
-
seen.add(shard.id);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
if (manifest.devArtifact !== undefined && manifest.devArtifact?.parallel !== true) {
|
|
126
|
-
errors.push("gate.shards requires devArtifact.parallel: true (a dev artifact built inside the ci job would be built once per shard)");
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const gateShardIds = (manifest) => (Array.isArray(manifest.gate?.shards) ? manifest.gate.shards.map((shard) => shard.id) : []);
|
|
95
|
+
// gate.path is the paths filter of the Rust-change detector only. The ci job runs the one door, `rightkit-gate --to compile`
|
|
96
|
+
// (class A, then every compile, lint and test scan), never the repository's own script; there are no shards or quick legs.
|
|
97
|
+
const GATE_KEYS = new Set(["path"]);
|
|
98
|
+
const gateShardIds = () => [];
|
|
131
99
|
const RUST_WORKSPACE_PATH_RE = /^(?:\.|(?!.*\.\.)(?!.*\s)[A-Za-z0-9][A-Za-z0-9._/-]*)$/;
|
|
132
100
|
const PACKAGE_SCRIPT_RE = /^[A-Za-z0-9][A-Za-z0-9:_-]*$/;
|
|
133
101
|
const QA_SURFACE_SCRIPT_RE = /qa-native|qa-control|dev-native|dev-inspect|test-mode/i;
|
|
@@ -223,13 +191,11 @@ export function validateManifest(manifest) {
|
|
|
223
191
|
errors.push("profile 'rust-hybrid' requires lane 'ci' and supports optional lanes 'release-candidate', 'regenerate' and 'sign-existing'");
|
|
224
192
|
}
|
|
225
193
|
if (!manifest.gate || typeof manifest.gate !== "object" || Array.isArray(manifest.gate) || Object.keys(manifest.gate).some((key) => !GATE_KEYS.has(key)) || typeof manifest.gate.path !== "string" || !GATE_PATH_RE.test(manifest.gate.path)) {
|
|
226
|
-
errors.push("profile 'rust-hybrid' requires gate.path with a safe relative path (gate keys: path
|
|
227
|
-
} else {
|
|
228
|
-
validateGateShards(manifest, errors);
|
|
194
|
+
errors.push("profile 'rust-hybrid' requires gate.path with a safe relative path (gate keys: path; gate.shards and gate.quick are gone: the ci job runs the one door, rightkit-gate --to compile)");
|
|
229
195
|
}
|
|
230
196
|
} else {
|
|
231
197
|
if (manifest.gate !== undefined) errors.push("gate is only valid for profile 'rust-hybrid'");
|
|
232
|
-
if (lanes.some((lane) => RUST_HYBRID_ONLY_LANES.includes(lane))) errors.push(
|
|
198
|
+
if (lanes.some((lane) => RUST_HYBRID_ONLY_LANES.includes(lane))) errors.push(`lanes ${RUST_HYBRID_ONLY_LANES.map((lane) => `'${lane}'`).join(" and ")} are only valid for profile 'rust-hybrid'`);
|
|
233
199
|
}
|
|
234
200
|
|
|
235
201
|
validateCheckout(manifest.checkout, errors);
|
|
@@ -581,7 +547,7 @@ export function parsePackageManager(spec) {
|
|
|
581
547
|
}[name];
|
|
582
548
|
const runPrefix = { pnpm: "pnpm run", npm: "npm run", yarn: "yarn run" }[name];
|
|
583
549
|
const setup = {
|
|
584
|
-
pnpm: ` - uses: pnpm/action-setup@
|
|
550
|
+
pnpm: ` - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0\n with:\n version: ${version}`,
|
|
585
551
|
npm: "",
|
|
586
552
|
yarn: ` - run: corepack enable && corepack prepare yarn@${version} --activate`,
|
|
587
553
|
}[name];
|
|
@@ -1461,7 +1427,7 @@ ${pm.setup ? `${pm.setup}\n` : ""} - run: ${pm.installCommand}${ownershipSt
|
|
|
1461
1427
|
git cat-file -e "$head_sha^{commit}" 2>/dev/null || fail "source commit $head_sha is not in this repository's history"
|
|
1462
1428
|
git merge-base --is-ancestor "$head_sha" "$GITHUB_SHA" || fail "source commit $head_sha is not an ancestor of the signing revision $GITHUB_SHA"
|
|
1463
1429
|
mkdir -p "$RUNNER_TEMP/dev-signed"
|
|
1464
|
-
jq -n --arg
|
|
1430
|
+
jq -n --arg r "$GITHUB_REPOSITORY" --arg n "$run_id" --argjson a "$artifact_id" --arg m "$artifact_name" --arg s "$head_sha" --arg q "$INPUT_SOURCE_SHA" --arg g "$GITHUB_SHA" '{schema: 1, repository: $r, runId: $n, artifactId: $a, artifactName: $m, sourceSha: $s, requestedSourceSha: $q, signingRevision: $g}' > "$RUNNER_TEMP/dev-signed/source-verification.json"
|
|
1465
1431
|
{
|
|
1466
1432
|
printf 'run_id=%s\\n' "$run_id"
|
|
1467
1433
|
printf 'artifact_id=%s\\n' "$artifact_id"
|
|
@@ -2214,6 +2180,35 @@ const CHECK_ACTION_PINS = Object.freeze({
|
|
|
2214
2180
|
// are admitted by @rightkit/release only in their exact rendered shape (`needs: [private-repo-guard]`), and
|
|
2215
2181
|
// `publish-package-managers` builds and tests nothing (it installs, syntax-checks the committed formula and opens a tap pull
|
|
2216
2182
|
// request, or submits a WinGet manifest, for a version that is already released).
|
|
2183
|
+
// Class A's scan tools, the same pins RightKit's own CI uses: the check is class A in full (cargo-deny, cargo-audit, actionlint),
|
|
2184
|
+
// and a missing tool fails the check rather than skipping the scan.
|
|
2185
|
+
const CLASS_A_TOOL_STEPS = Object.freeze([
|
|
2186
|
+
" - name: Install the pinned class A scan tools",
|
|
2187
|
+
" uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29",
|
|
2188
|
+
" with:",
|
|
2189
|
+
" tool: cargo-deny@0.20.2,cargo-audit@0.22.2,shellcheck@0.11.0",
|
|
2190
|
+
" - name: Install the pinned workflow linter",
|
|
2191
|
+
" shell: bash",
|
|
2192
|
+
" env:",
|
|
2193
|
+
" ACTIONLINT_VERSION: \"1.7.12\"",
|
|
2194
|
+
" run: |",
|
|
2195
|
+
" set -euo pipefail",
|
|
2196
|
+
" case \"$RUNNER_OS-$RUNNER_ARCH\" in",
|
|
2197
|
+
" Linux-X64) asset=linux_amd64.tar.gz; sum=8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 ;;",
|
|
2198
|
+
" macOS-ARM64) asset=darwin_arm64.tar.gz; sum=aba9ced2dee8d27fecca3dc7feb1a7f9a52caefa1eb46f3271ea66b6e0e6953f ;;",
|
|
2199
|
+
" macOS-X64) asset=darwin_amd64.tar.gz; sum=5b44c3bc2255115c9b69e30efc0fecdf498fdb63c5d58e17084fd5f16324c644 ;;",
|
|
2200
|
+
" Windows-X64) asset=windows_amd64.zip; sum=6e7241b51e6817ea6a047693d8e6fed13b31819c9a0dd6c5a726e1592d22f6e9 ;;",
|
|
2201
|
+
" *) echo \"::error::no pinned actionlint for $RUNNER_OS-$RUNNER_ARCH\"; exit 1 ;;",
|
|
2202
|
+
" esac",
|
|
2203
|
+
" archive=\"$RUNNER_TEMP/actionlint-$asset\"",
|
|
2204
|
+
" curl --fail --silent --show-error --location --output \"$archive\" \"https://github.com/rhysd/actionlint/releases/download/v$ACTIONLINT_VERSION/actionlint_\"\"$ACTIONLINT_VERSION\"\"_$asset\"",
|
|
2205
|
+
" actual=\"$( (sha256sum \"$archive\" 2>/dev/null || shasum -a 256 \"$archive\") | cut -d' ' -f1)\"",
|
|
2206
|
+
" [ \"$actual\" = \"$sum\" ] || { echo \"::error::actionlint archive checksum mismatch\"; exit 1; }",
|
|
2207
|
+
" mkdir -p \"$RUNNER_TEMP/actionlint-bin\"",
|
|
2208
|
+
" case \"$asset\" in *.zip) unzip -o -q \"$archive\" actionlint.exe -d \"$RUNNER_TEMP/actionlint-bin\" ;; *) tar -xzf \"$archive\" -C \"$RUNNER_TEMP/actionlint-bin\" actionlint ;; esac",
|
|
2209
|
+
" echo \"$RUNNER_TEMP/actionlint-bin\" >> \"$GITHUB_PATH\"",
|
|
2210
|
+
]);
|
|
2211
|
+
|
|
2217
2212
|
export const CHECK_JOB_LANES = Object.freeze(["ci", "qualification", "package-smoke", "release-candidate", "swift-check", "publish-npm"]);
|
|
2218
2213
|
|
|
2219
2214
|
/**
|
|
@@ -2247,7 +2242,7 @@ export function checkJob(manifest, lane = "ci") {
|
|
|
2247
2242
|
const lockfilePatch = lane === "ci" ? lockfilePatchStep(manifest) : "";
|
|
2248
2243
|
return [
|
|
2249
2244
|
" check:",
|
|
2250
|
-
" # RightKit check: committed files only, no compile; every finding in one run. Every other job needs it.",
|
|
2245
|
+
" # RightKit check: class A over committed files only, no compile; every finding in one run. Every other job needs it.",
|
|
2251
2246
|
" needs: [private-repo-guard]",
|
|
2252
2247
|
` runs-on: ${runner}`,
|
|
2253
2248
|
" timeout-minutes: 15",
|
|
@@ -2264,6 +2259,7 @@ export function checkJob(manifest, lane = "ci") {
|
|
|
2264
2259
|
...(pm.setup ? [pm.setup] : []),
|
|
2265
2260
|
` - run: ${install}`,
|
|
2266
2261
|
...(lockfilePatch ? lockfilePatch.slice(1).split("\n") : []),
|
|
2262
|
+
...CLASS_A_TOOL_STEPS,
|
|
2267
2263
|
` - run: ${gate} check --commit HEAD`,
|
|
2268
2264
|
"",
|
|
2269
2265
|
].join("\n");
|
|
@@ -2334,67 +2330,10 @@ export function swiftPrivatePackagesCleanupStep(manifest) {
|
|
|
2334
2330
|
].join("\n");
|
|
2335
2331
|
}
|
|
2336
2332
|
|
|
2337
|
-
/**
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
function gateShardContext(manifest, pm, lane) {
|
|
2342
|
-
const shardIds = gateShardIds(manifest);
|
|
2343
|
-
if (lane !== "ci" || shardIds.length === 0) {
|
|
2344
|
-
return { CI_NEEDS: "[private-repo-guard, check]", CI_SHARD_KEY: "", GATE_ARGS: "", CI_QUICK_JOB: "", CI_SUMMARY_JOB: "" };
|
|
2345
|
-
}
|
|
2346
|
-
const quick = manifest.gate.quick === true;
|
|
2347
|
-
const quickJob = quick ? [
|
|
2348
|
-
" quick:",
|
|
2349
|
-
" # gate.quick: the fast deterministic checks, before any gate shard starts.",
|
|
2350
|
-
" needs: [private-repo-guard, check]",
|
|
2351
|
-
" runs-on: ubuntu-24.04",
|
|
2352
|
-
" timeout-minutes: 20",
|
|
2353
|
-
" steps:",
|
|
2354
|
-
" - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1",
|
|
2355
|
-
" with:",
|
|
2356
|
-
" fetch-depth: 0",
|
|
2357
|
-
" - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0",
|
|
2358
|
-
" with:",
|
|
2359
|
-
` node-version: ${JSON.stringify(String(manifest.matrix.node[0]))}`,
|
|
2360
|
-
" package-manager-cache: false",
|
|
2361
|
-
...(pm.setup ? [pm.setup] : []),
|
|
2362
|
-
` - run: ${pm.installCommand}`,
|
|
2363
|
-
" - uses: dtolnay/rust-toolchain@f8be11a05b1d4f3fcebe6410cc16743212b999b0",
|
|
2364
|
-
" with:",
|
|
2365
|
-
" components: rustfmt, clippy",
|
|
2366
|
-
` - run: bash ./${manifest.gate.path} --quick`,
|
|
2367
|
-
" env:",
|
|
2368
|
-
" RIGHT_GIT_GATE_QUICK: \"true\"",
|
|
2369
|
-
"",
|
|
2370
|
-
].join("\n") : "";
|
|
2371
|
-
const needs = quick ? "[ci, quick]" : "[ci]";
|
|
2372
|
-
const summaryJob = [
|
|
2373
|
-
"",
|
|
2374
|
-
" ci-summary:",
|
|
2375
|
-
" # gate.shards: passes only when every shard passed on every runner" + (quick ? " and the quick checks passed." : "."),
|
|
2376
|
-
` needs: ${needs}`,
|
|
2377
|
-
" if: ${{ always() }}",
|
|
2378
|
-
" runs-on: ubuntu-24.04",
|
|
2379
|
-
" timeout-minutes: 5",
|
|
2380
|
-
" steps:",
|
|
2381
|
-
" - name: Every gate shard passed on every runner",
|
|
2382
|
-
" env:",
|
|
2383
|
-
" CI_RESULT: ${{ needs.ci.result }}",
|
|
2384
|
-
...(quick ? [" QUICK_RESULT: ${{ needs.quick.result }}"] : []),
|
|
2385
|
-
" run: |",
|
|
2386
|
-
" set -euo pipefail",
|
|
2387
|
-
" test \"$CI_RESULT\" = success",
|
|
2388
|
-
...(quick ? [" test \"$QUICK_RESULT\" = success"] : []),
|
|
2389
|
-
"",
|
|
2390
|
-
].join("\n");
|
|
2391
|
-
return {
|
|
2392
|
-
CI_NEEDS: quick ? "[private-repo-guard, check, quick]" : "[private-repo-guard, check]",
|
|
2393
|
-
CI_SHARD_KEY: "-${{ matrix.shard }}",
|
|
2394
|
-
GATE_ARGS: " --group ${{ matrix.shard }}",
|
|
2395
|
-
CI_QUICK_JOB: quickJob,
|
|
2396
|
-
CI_SUMMARY_JOB: summaryJob,
|
|
2397
|
-
};
|
|
2333
|
+
/** The ci job's needs and its one door step (rightkit-gate --to compile), run by the repository's package manager. */
|
|
2334
|
+
function gateShardContext(manifest, pm) {
|
|
2335
|
+
const door = { pnpm: "pnpm exec rightkit-gate", npm: "./node_modules/.bin/rightkit-gate", yarn: "./node_modules/.bin/rightkit-gate" }[pm.name];
|
|
2336
|
+
return { CI_NEEDS: "[private-repo-guard, check]", CI_SHARD_KEY: "", GATE_DOOR: `${door} --to compile`, CI_QUICK_JOB: "", CI_SUMMARY_JOB: "" };
|
|
2398
2337
|
}
|
|
2399
2338
|
|
|
2400
2339
|
/**
|
|
@@ -2480,9 +2419,11 @@ export function buildRenderContext(manifest, repoPath, lane = "ci") {
|
|
|
2480
2419
|
: "",
|
|
2481
2420
|
CI_CONCURRENCY_GROUP: manifest.concurrency?.mainPushes === "queue" ? CI_GROUP_PER_REF : CI_GROUP_SUPERSEDE,
|
|
2482
2421
|
CHECK_JOB: checkJob(manifest, lane),
|
|
2422
|
+
// The door's compile stage runs class A first on the job's own runner, so that runner needs class A's pinned tools too.
|
|
2423
|
+
CLASS_A_TOOLS_STEP: `\n${CLASS_A_TOOL_STEPS.join("\n")}`,
|
|
2483
2424
|
CI_SUPERSEDE_JOB: manifest.concurrency?.mainPushes === "queue" ? "" : supersedeJob(manifest),
|
|
2484
2425
|
CI_JOB_CONCURRENCY: manifest.concurrency?.mainPushes === "queue" ? "" : ciJobConcurrency(manifest),
|
|
2485
|
-
...gateShardContext(manifest, pm
|
|
2426
|
+
...gateShardContext(manifest, pm),
|
|
2486
2427
|
RUST_CACHE_KEY: cacheKeyLine ? `${cacheKeyLine}\n` : "",
|
|
2487
2428
|
};
|
|
2488
2429
|
|
package/manifest.schema.json
CHANGED
|
@@ -249,13 +249,7 @@
|
|
|
249
249
|
"gate": {
|
|
250
250
|
"type": "object", "required": ["path"], "additionalProperties": false,
|
|
251
251
|
"properties": {
|
|
252
|
-
"path": { "type": "string", "pattern": "^(?!.*\\.\\.)(?!.*\\s)[A-Za-z0-9][A-Za-z0-9._/-]*$" }
|
|
253
|
-
"shards": {
|
|
254
|
-
"type": "array", "minItems": 2, "maxItems": 16,
|
|
255
|
-
"description": "rust-hybrid ci only. The gate runs once per shard per matrix.os runner as `bash <path> --group <id>` on one shared Rust cache; a ci-summary job passes only when every leg passed. Requires devArtifact.parallel when devArtifact is set.",
|
|
256
|
-
"items": { "type": "object", "required": ["id"], "additionalProperties": false, "properties": { "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,31}$" } } }
|
|
257
|
-
},
|
|
258
|
-
"quick": { "const": true, "description": "Needs shards. A `quick` job runs `bash <path> --quick` (the fast deterministic checks) before any shard starts." }
|
|
252
|
+
"path": { "type": "string", "pattern": "^(?!.*\\.\\.)(?!.*\\s)[A-Za-z0-9][A-Za-z0-9._/-]*$" }
|
|
259
253
|
}
|
|
260
254
|
},
|
|
261
255
|
"qaEvidencePath": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rightkit/ci",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Public-repo-only GitHub Actions workflow layer: templates, visibility gate, sync/drift/adopt/uninstall for right-git.",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
"templates",
|
|
23
23
|
"*.mjs",
|
|
24
24
|
"*.json",
|
|
25
|
-
"!*.test.mjs"
|
|
26
|
-
"!test-support.mjs"
|
|
25
|
+
"!*.test.mjs"
|
|
27
26
|
],
|
|
28
27
|
"sideEffects": false,
|
|
29
28
|
"publishConfig": {
|
|
@@ -36,6 +35,6 @@
|
|
|
36
35
|
"directory": "packages/ci"
|
|
37
36
|
},
|
|
38
37
|
"scripts": {
|
|
39
|
-
"test": "node --test
|
|
38
|
+
"test": "node --test pack-smoke.test.mjs"
|
|
40
39
|
}
|
|
41
40
|
}
|
|
@@ -101,8 +101,8 @@ ${RUST_CACHE_KEY} cache-workspace-crates: ${CI_CACHE_WORKSPACE_CRATES}
|
|
|
101
101
|
- uses: Mozilla-Actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
|
|
102
102
|
if: steps.rust-changes.outputs.required == 'true'
|
|
103
103
|
with:
|
|
104
|
-
version: "v0.16.0"${SWIFT_PRIVATE_CONFIGURE_STEP}
|
|
105
|
-
- run:
|
|
104
|
+
version: "v0.16.0"${CLASS_A_TOOLS_STEP}${SWIFT_PRIVATE_CONFIGURE_STEP}
|
|
105
|
+
- run: ${GATE_DOOR}
|
|
106
106
|
env:
|
|
107
107
|
RIGHT_GIT_RUST_CHANGED: ${{ steps.rust-changes.outputs.changed }}
|
|
108
108
|
RIGHT_GIT_RUST_REQUIRED: ${{ steps.rust-changes.outputs.required }}
|
|
@@ -67,9 +67,19 @@ ${RUST_CACHE_KEY} cache-workspace-crates: ${CI_CACHE_WORKSPACE_CRATES}
|
|
|
67
67
|
else
|
|
68
68
|
printf 'changed=true\n' >> "$GITHUB_OUTPUT"
|
|
69
69
|
fi
|
|
70
|
+
- name: Commit the regenerated tree locally (the door works on a commit)
|
|
71
|
+
if: steps.changes.outputs.changed == 'true'
|
|
72
|
+
shell: bash
|
|
73
|
+
run: |
|
|
74
|
+
set -euo pipefail
|
|
75
|
+
git config user.name "github-actions[bot]"
|
|
76
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
77
|
+
git checkout -b "right-git/regenerate-${{ github.run_id }}-${{ github.run_attempt }}"
|
|
78
|
+
git add -A
|
|
79
|
+
git commit -m "Regenerate derived artifacts"${CLASS_A_TOOLS_STEP}
|
|
70
80
|
- name: Gate the regenerated tree
|
|
71
81
|
if: steps.changes.outputs.changed == 'true'
|
|
72
|
-
run:
|
|
82
|
+
run: ${GATE_DOOR}
|
|
73
83
|
env:
|
|
74
84
|
RIGHT_GIT_RUST_CHANGED: "true"
|
|
75
85
|
RIGHT_GIT_RUST_REQUIRED: "true"
|
|
@@ -86,11 +96,6 @@ ${RUST_CACHE_KEY} cache-workspace-crates: ${CI_CACHE_WORKSPACE_CRATES}
|
|
|
86
96
|
run: |
|
|
87
97
|
set -euo pipefail
|
|
88
98
|
branch="right-git/regenerate-${{ github.run_id }}-${{ github.run_attempt }}"
|
|
89
|
-
git config user.name "github-actions[bot]"
|
|
90
|
-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
91
|
-
git checkout -b "$branch"
|
|
92
|
-
git add -A
|
|
93
|
-
git commit -m "Regenerate derived artifacts"
|
|
94
99
|
git push origin "HEAD:refs/heads/$branch"
|
|
95
100
|
gh pr create --base "$RIGHT_GIT_DEFAULT_BRANCH" --head "$branch" \
|
|
96
101
|
--title "Regenerate derived artifacts" \
|