mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-26 01:39:51 +01:00
perf(ci): skip prebaked pnpm setup, move rollups to ubuntu-slim, and narrow dep cache inputs (#22958)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Live 8-core runs on `paperclip-public-ci-fleetd:29` (`ami-09dfb1e62707f576c`, runs `45665466678` & `45668834558`) revealed three zero-hot-instance sources of wasted PR wall-clock time: > 1. `pnpm/action-setup@v6` still spent `4.1–5.0s` on all 68 jobs switching its bundled `v11.19.0` to `v9.15.4` even though the pre-baked AMI already has `pnpm@9.15.4` installed at `$HOME/setup-pnpm/node_modules/.bin/pnpm`. > 2. `ci / verify` and `ci / e2e` rollups booted fresh 8-core AWS EC2 VMs (`18–23s` cold queue after all tests already finished!) just to run a 1-second inline Node `assert` check with zero repo checkout and zero secrets. > 3. `scripts/ci-dependency-cache.mjs` hashed blanket `scripts/**`, `server/scripts/**`, and `packages/paperclip-runner/scripts/**`, causing every merge touching any CI script or shard duration manifest to invalidate the ~944 MB `ci-dependencies-v1` cache for all 70 jobs (`35–40s` cold restore vs `10s` hit) until `release-verify.yml` rebuilt it 15–20 minutes later. > - This pull request eliminates all three bottlenecks with zero hot/standby instances and zero security-boundary changes (`ci-routing.yml`, `pr.yml`, `CODEOWNERS`, and read-only PR caches untouched). ## Linked Issues or Issue Description Refs #22804 **What existing behavior does this improve?** PR job startup latency, rollup tail latency, and `ci-dependencies-v1` cache hit rate across `.github/workflows/pr-trusted.yml`, `.github/actions/setup-ci-dependencies/action.yml`, and `scripts/ci-dependency-cache.mjs`. **Subsystem affected** CI — PR workflow bootstrap, rollup jobs, and materialized dependency cache key inputs **Current behavior** All 11 `Setup pnpm` steps run `pnpm/action-setup@v6` unconditionally (`4–5s` each); `ci / verify` and `ci / e2e` boot full AWS EC2 runners (`18–23s` queue) after tests complete; `ci-dependency-cache.mjs` hashes blanket `scripts/**` globs so unrelated CI script edits bust `node_modules` caching across all 70 PR jobs. **Proposed behavior** Dynamically compare `$HOME/setup-pnpm/node_modules/.bin/pnpm --version` against `package.json`'s `packageManager` before all 11 `Setup pnpm` steps (skipping `pnpm/action-setup` on pre-baked runners while preserving identical `PNPM_HOME` and failing closed on version bumps); run `ci / verify` and `ci / e2e` rollups on `ubuntu-slim`; narrow `ci-dependency-cache.mjs` script inputs to the exact 8-file `DEPENDENCY_SCRIPT_INPUTS` closure enforced by a static relative-import test plus `--prefer-offline` on cold-install fallback. ## What Changed - **Skip redundant `pnpm/action-setup` on pre-baked AMIs (`.github/workflows/pr-trusted.yml`):** - Added inline `Check preinstalled pnpm` (`id: pnpm_preinstalled`) before all 11 `Setup pnpm` steps: parses `package.json`'s `packageManager` (`^pnpm@([^+\s]+)(?:\+.*)?$`) dynamically, compares against `$HOME/setup-pnpm/node_modules/.bin/pnpm --version`, exports identical `PNPM_HOME` + `$GITHUB_PATH` on match, and fails closed to `pnpm/action-setup@v6` on version bump or `ubuntu-latest`. - **Move `ci / verify` & `ci / e2e` rollups to `ubuntu-slim` (`.github/workflows/pr-trusted.yml`):** - Switched both zero-checkout rollup jobs from `needs.gate.outputs.runner` to `ubuntu-slim` (~2–4s container start instead of `18–23s` EC2 VM boot). - **Narrow dependency cache script inputs (`scripts/ci-dependency-cache.mjs`, `.github/actions/setup-ci-dependencies/action.yml`):** - Replaced blanket `scripts/**`, `server/scripts/**`, and `packages/paperclip-runner/scripts/**` hashes with exported `DEPENDENCY_SCRIPT_INPUTS` (the exact 8 scripts invoked during dependency materialization/postinstall), kept `scripts/ensure-plugin-build-deps.mjs` on `buildKey` only, and added `--prefer-offline` on cold-install fallback. - **Tests (`.github/scripts/tests/ci-dependency-cache.test.mjs`, `.github/scripts/tests/ci-plan.test.mjs`):** - Added automated static relative-import closure verification for `DEPENDENCY_SCRIPT_INPUTS`, `ubuntu-slim` rollup checks, and execution tests of the extracted `Check preinstalled pnpm` snippet across matching, `+sha512`, bumped, missing `packageManager`, and missing binary cases. ## Verification - `ruby -ryaml -e 'YAML.load_file(".github/workflows/pr-trusted.yml"); YAML.load_file(".github/actions/setup-ci-dependencies/action.yml")'` — **YAML OK** - `node --test .github/scripts/tests/*.test.mjs scripts/ci/test-selection-workflow.test.mjs scripts/__tests__/{ci-typecheck-lane,e2e-shard,run-vitest-stable-shard,run-vitest-stable-pr-mode,merge-queue-checks-workflow,runner-release-crate-cache,runner-debug-crate-cache,public-install-closure}.test.mjs scripts/check-test-budget.test.mjs scripts/docker-image-metadata.test.mjs` — **942/942 PASS** - Live PR CI proves `ubuntu-slim` rollup execution, pre-baked `Check preinstalled pnpm` skip (`hit=true`), and `ci-dependencies-v1` restore parity end-to-end. ## Risks - Low risk: `Check preinstalled pnpm` dynamically reads `package.json`'s `packageManager` and fails closed on mismatch or version bump; `ci-dependency-cache.test.mjs` statically enforces that no relative import from `DEPENDENCY_SCRIPT_INPUTS` can escape the cache key; `ci / verify` and `ci / e2e` check out no code and use no secrets. ## Model Used - Gemini 4 Neon (High) via Antigravity agent swarm (`typecheck-opt`, `verifier`, `ci-pipeline`). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge
This commit is contained in:
1 parent
1fca3a6d8c
commit
3773d0f40f
5 files changed
+244
-13
No files matched your search
@@ -57,12 +57,12 @@ runs:
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.working-directory }}
|
||||
run: |
|
||||
if pnpm install --frozen-lockfile; then
|
||||
if pnpm install --frozen-lockfile --prefer-offline; then
|
||||
echo 'frozen=true' >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo '::notice title=Lockfile::checked-in lockfile is stale for this merge tree; resolving it inline'
|
||||
pnpm install --resolution-only --ignore-scripts --no-frozen-lockfile
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm install --frozen-lockfile --prefer-offline
|
||||
fi
|
||||
|
||||
- name: Replay workspace install hooks after restore
|
||||
|
||||
@@ -3,7 +3,7 @@ import test from "node:test";
|
||||
import { mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { cachePlan } from "../../../scripts/ci-dependency-cache.mjs";
|
||||
import { DEPENDENCY_SCRIPT_INPUTS, cachePlan } from "../../../scripts/ci-dependency-cache.mjs";
|
||||
import { findWorkspacePostinstallScripts, replayWorkspacePostinstalls } from "../../../scripts/replay-workspace-postinstall.mjs";
|
||||
|
||||
const entries = {
|
||||
@@ -69,11 +69,43 @@ test('unmodelled workspace lifecycle scripts disable materialized reuse', () =>
|
||||
assert.equal(plan({ ...entries, 'server/package.json': JSON.stringify({ scripts: { [hook]: 'node custom.mjs' } }) }).cacheable, false);
|
||||
}
|
||||
assert.equal(plan({ ...entries, 'package.json': '{"scripts":{"postinstall":"node other.mjs"}}' }).cacheable, false);
|
||||
for (const file of ['scripts/ensure-plugin-build-deps.mjs', 'scripts/new-install-helper.mjs', '.pnpmfile.cjs']) {
|
||||
assert.notEqual(plan({ ...entries, [file]: 'changed' }).dependencyKey, plan().dependencyKey);
|
||||
assert.notEqual(plan({ ...entries, '.pnpmfile.cjs': 'changed' }).dependencyKey, plan().dependencyKey);
|
||||
|
||||
const buildOnly = plan({ ...entries, 'scripts/ensure-plugin-build-deps.mjs': 'changed' });
|
||||
assert.equal(buildOnly.dependencyKey, plan().dependencyKey);
|
||||
assert.notEqual(buildOnly.buildKey, plan().buildKey);
|
||||
|
||||
for (const file of [
|
||||
'scripts/general-server-shard-durations.json',
|
||||
'scripts/ci-typecheck-lane.mjs',
|
||||
'server/scripts/typecheck-layers.mjs',
|
||||
'packages/paperclip-runner/scripts/run-check-static.mjs',
|
||||
]) {
|
||||
assert.deepEqual(plan({ ...entries, [file]: 'changed' }), plan(), file);
|
||||
}
|
||||
});
|
||||
|
||||
test('DEPENDENCY_SCRIPT_INPUTS covers the full local import closure of install/postinstall scripts', () => {
|
||||
const repoRoot = path.resolve(new URL('../../..', import.meta.url).pathname);
|
||||
const visited = new Set();
|
||||
const queue = [...DEPENDENCY_SCRIPT_INPUTS];
|
||||
const importPattern = /(?:from\s+|import\s*\(\s*|require\s*\(\s*)["'](\.[^"']+)["']/g;
|
||||
while (queue.length > 0) {
|
||||
const rel = queue.shift();
|
||||
if (visited.has(rel)) continue;
|
||||
visited.add(rel);
|
||||
assert.ok(DEPENDENCY_SCRIPT_INPUTS.has(rel), `missing transitive install helper from DEPENDENCY_SCRIPT_INPUTS: ${rel}`);
|
||||
const abs = path.join(repoRoot, rel);
|
||||
const source = readFileSync(abs, 'utf8');
|
||||
for (const match of source.matchAll(importPattern)) {
|
||||
const target = path.relative(repoRoot, path.resolve(path.dirname(abs), match[1])).split(path.sep).join('/');
|
||||
if (!visited.has(target)) queue.push(target);
|
||||
}
|
||||
}
|
||||
const action = readFileSync(new URL('../../actions/setup-ci-dependencies/action.yml', import.meta.url), 'utf8');
|
||||
assert.equal((action.match(/pnpm install --frozen-lockfile --prefer-offline/g) ?? []).length, 2);
|
||||
});
|
||||
|
||||
test('known Copilot hooks permit caching, track their helpers, and still run on restore', () => {
|
||||
const files = { ...entries,
|
||||
'server/package.json': JSON.stringify({ scripts: { postinstall: 'node scripts/install-copilot-assets.mjs' } }),
|
||||
|
||||
@@ -440,8 +440,56 @@ test("required aggregates reject omitted, failed and cancelled selected work", (
|
||||
assert.notEqual(failedGate.status, 0, `${id}: an absent routing output must not pass`);
|
||||
assert.match(failedGate.stderr, /CI routing must succeed/);
|
||||
}
|
||||
assert.match(block, /^ {4}runs-on: \$\{\{ needs\.gate\.outputs\.runner \|\| 'ubuntu-latest' \}\}$/m,
|
||||
`${id}: the always-run summary must have a runner when routing produces no output`);
|
||||
assert.match(block, /^ {4}runs-on: ubuntu-slim$/m,
|
||||
`${id}: the always-run summary runs on ubuntu-slim without booting a PR VM`);
|
||||
}
|
||||
});
|
||||
|
||||
test("pr-trusted skips pnpm/action-setup only when pre-baked pnpm matches package.json packageManager", () => {
|
||||
const workflow = readFileSync(new URL(".github/workflows/pr-trusted.yml", root), "utf8");
|
||||
const checkBlocks = [...workflow.matchAll(/ - name: Check preinstalled pnpm\n id: pnpm_preinstalled\n(?: if: [^\n]+\n)? run: \|\n((?: [^\n]+\n)+)/g)];
|
||||
const setupMatches = workflow.match(/ - name: Setup pnpm\n if: [^\n]*steps\.pnpm_preinstalled\.outputs\.hit != 'true'\n uses: pnpm\/action-setup@/g) ?? [];
|
||||
const allPnpmActions = workflow.match(/uses: pnpm\/action-setup@/g) ?? [];
|
||||
assert.equal(allPnpmActions.length, 11);
|
||||
assert.equal(checkBlocks.length, allPnpmActions.length);
|
||||
assert.equal(setupMatches.length, allPnpmActions.length);
|
||||
const script = checkBlocks[0][1].split("\n").map((line) => line.slice(10)).join("\n");
|
||||
for (const [, body] of checkBlocks) {
|
||||
assert.equal(body, checkBlocks[0][1], "all preinstalled pnpm checks must stay identical");
|
||||
assert.doesNotMatch(body, /"9\.15\.4"/, "must compare against package.json packageManager, not a hardcoded version");
|
||||
}
|
||||
const dir = mkdtempSync(path.join(tmpdir(), "ci-pnpm-check-"));
|
||||
try {
|
||||
const binDir = path.join(dir, "home/setup-pnpm/node_modules/.bin");
|
||||
mkdirSync(binDir, { recursive: true });
|
||||
writeFileSync(path.join(binDir, "pnpm"), "#!/bin/sh\necho 9.15.4\n", { mode: 0o755 });
|
||||
const run = (pkg, home) => {
|
||||
const work = mkdtempSync(path.join(dir, "work-"));
|
||||
writeFileSync(path.join(work, "package.json"), JSON.stringify(pkg));
|
||||
const envFile = path.join(work, "env");
|
||||
const pathFile = path.join(work, "path");
|
||||
const outFile = path.join(work, "out");
|
||||
writeFileSync(envFile, ""); writeFileSync(pathFile, ""); writeFileSync(outFile, "");
|
||||
const res = spawnSync("bash", ["-e", "-c", script], {
|
||||
cwd: work, encoding: "utf8",
|
||||
env: { ...process.env, HOME: home, GITHUB_ENV: envFile, GITHUB_PATH: pathFile, GITHUB_OUTPUT: outFile },
|
||||
});
|
||||
assert.equal(res.status, 0, res.stderr);
|
||||
return { env: readFileSync(envFile, "utf8"), path: readFileSync(pathFile, "utf8"), out: readFileSync(outFile, "utf8").trim() };
|
||||
};
|
||||
const home = path.join(dir, "home");
|
||||
const hit = run({ packageManager: "pnpm@9.15.4" }, home);
|
||||
assert.equal(hit.out, "hit=true");
|
||||
assert.equal(hit.env.trim(), `PNPM_HOME=${binDir}`);
|
||||
assert.equal(hit.path.trim(), binDir);
|
||||
assert.equal(run({ packageManager: "pnpm@9.15.4+sha512.abc" }, home).out, "hit=true");
|
||||
const bumped = run({ packageManager: "pnpm@9.15.5" }, home);
|
||||
assert.equal(bumped.out, "hit=false");
|
||||
assert.equal(bumped.env, "");
|
||||
assert.equal(run({}, home).out, "hit=false");
|
||||
assert.equal(run({ packageManager: "pnpm@9.15.4" }, path.join(dir, "empty-home")).out, "hit=false");
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -70,8 +70,20 @@ jobs:
|
||||
with:
|
||||
node-version: 24
|
||||
package-manager-cache: false
|
||||
- name: Setup pnpm
|
||||
- name: Check preinstalled pnpm
|
||||
id: pnpm_preinstalled
|
||||
if: steps.eligible.outputs.enabled == 'true'
|
||||
run: |
|
||||
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
||||
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
||||
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
||||
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
||||
echo "hit=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "hit=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- name: Setup pnpm
|
||||
if: steps.eligible.outputs.enabled == 'true' && steps.pnpm_preinstalled.outputs.hit != 'true'
|
||||
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
||||
env:
|
||||
NPM_CONFIG_AUDIT: "false"
|
||||
@@ -198,7 +210,20 @@ jobs:
|
||||
node-version: 24
|
||||
package-manager-cache: false
|
||||
|
||||
- name: Check preinstalled pnpm
|
||||
id: pnpm_preinstalled
|
||||
run: |
|
||||
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
||||
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
||||
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
||||
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
||||
echo "hit=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "hit=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Setup pnpm
|
||||
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
||||
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
||||
env:
|
||||
NPM_CONFIG_AUDIT: "false"
|
||||
@@ -345,7 +370,20 @@ jobs:
|
||||
node-version: 24
|
||||
package-manager-cache: false
|
||||
|
||||
- name: Check preinstalled pnpm
|
||||
id: pnpm_preinstalled
|
||||
run: |
|
||||
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
||||
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
||||
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
||||
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
||||
echo "hit=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "hit=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Setup pnpm
|
||||
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
||||
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
||||
env:
|
||||
NPM_CONFIG_AUDIT: "false"
|
||||
@@ -599,7 +637,20 @@ jobs:
|
||||
node-version: 24
|
||||
package-manager-cache: false
|
||||
|
||||
- name: Check preinstalled pnpm
|
||||
id: pnpm_preinstalled
|
||||
run: |
|
||||
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
||||
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
||||
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
||||
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
||||
echo "hit=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "hit=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Setup pnpm
|
||||
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
||||
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
||||
env:
|
||||
NPM_CONFIG_AUDIT: "false"
|
||||
@@ -764,7 +815,20 @@ jobs:
|
||||
node-version: 24
|
||||
package-manager-cache: false
|
||||
|
||||
- name: Check preinstalled pnpm
|
||||
id: pnpm_preinstalled
|
||||
run: |
|
||||
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
||||
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
||||
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
||||
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
||||
echo "hit=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "hit=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Setup pnpm
|
||||
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
||||
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
||||
env:
|
||||
NPM_CONFIG_AUDIT: "false"
|
||||
@@ -836,7 +900,20 @@ jobs:
|
||||
node-version: 24
|
||||
package-manager-cache: false
|
||||
|
||||
- name: Check preinstalled pnpm
|
||||
id: pnpm_preinstalled
|
||||
run: |
|
||||
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
||||
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
||||
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
||||
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
||||
echo "hit=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "hit=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Setup pnpm
|
||||
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
||||
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
||||
env:
|
||||
NPM_CONFIG_AUDIT: "false"
|
||||
@@ -876,7 +953,7 @@ jobs:
|
||||
name: verify
|
||||
if: ${{ always() }}
|
||||
needs: [gate, test_selection, policy, typecheck_release_registry, general_tests, verify_paperclip_runner, build, docker_context_integrity, sandbox_provider_tests, verify_serialized_server, canary_dry_run, verify_runner_e2e_support]
|
||||
runs-on: ${{ needs.gate.outputs.runner || 'ubuntu-latest' }}
|
||||
runs-on: ubuntu-slim
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Validate every planned suite result
|
||||
@@ -934,7 +1011,20 @@ jobs:
|
||||
node-version: 24
|
||||
package-manager-cache: false
|
||||
|
||||
- name: Check preinstalled pnpm
|
||||
id: pnpm_preinstalled
|
||||
run: |
|
||||
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
||||
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
||||
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
||||
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
||||
echo "hit=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "hit=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Setup pnpm
|
||||
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
||||
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
||||
env:
|
||||
NPM_CONFIG_AUDIT: "false"
|
||||
@@ -1174,7 +1264,20 @@ jobs:
|
||||
node-version: 24
|
||||
package-manager-cache: false
|
||||
|
||||
- name: Check preinstalled pnpm
|
||||
id: pnpm_preinstalled
|
||||
run: |
|
||||
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
||||
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
||||
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
||||
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
||||
echo "hit=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "hit=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Setup pnpm
|
||||
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
||||
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
||||
env:
|
||||
NPM_CONFIG_AUDIT: "false"
|
||||
@@ -1407,7 +1510,20 @@ jobs:
|
||||
node-version: 24
|
||||
package-manager-cache: false
|
||||
|
||||
- name: Check preinstalled pnpm
|
||||
id: pnpm_preinstalled
|
||||
run: |
|
||||
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
||||
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
||||
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
||||
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
||||
echo "hit=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "hit=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Setup pnpm
|
||||
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
||||
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
||||
env:
|
||||
NPM_CONFIG_AUDIT: "false"
|
||||
@@ -1503,7 +1619,20 @@ jobs:
|
||||
node-version: 24
|
||||
package-manager-cache: false
|
||||
|
||||
- name: Check preinstalled pnpm
|
||||
id: pnpm_preinstalled
|
||||
run: |
|
||||
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
||||
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
||||
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
||||
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
||||
echo "hit=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "hit=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Setup pnpm
|
||||
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
||||
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
||||
env:
|
||||
NPM_CONFIG_AUDIT: "false"
|
||||
@@ -1725,7 +1854,20 @@ jobs:
|
||||
node-version: 24
|
||||
package-manager-cache: false
|
||||
|
||||
- name: Check preinstalled pnpm
|
||||
id: pnpm_preinstalled
|
||||
run: |
|
||||
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
||||
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
||||
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
||||
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
||||
echo "hit=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "hit=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Setup pnpm
|
||||
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
||||
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
||||
env:
|
||||
NPM_CONFIG_AUDIT: "false"
|
||||
@@ -1841,7 +1983,7 @@ jobs:
|
||||
name: e2e
|
||||
if: ${{ always() }}
|
||||
needs: [gate, policy, e2e_shards]
|
||||
runs-on: ${{ needs.gate.outputs.runner || 'ubuntu-latest' }}
|
||||
runs-on: ubuntu-slim
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Validate every planned suite result
|
||||
|
||||
@@ -16,13 +16,22 @@ const postinstallHooks = new Map([
|
||||
["packages/paperclip-runner", "node scripts/install-copilot-assets.mjs"],
|
||||
]);
|
||||
|
||||
export const DEPENDENCY_SCRIPT_INPUTS = new Set([
|
||||
"scripts/ci-dependency-cache.mjs",
|
||||
"scripts/link-plugin-dev-sdk.mjs",
|
||||
"scripts/ensure-workspace-package-links.mjs",
|
||||
"scripts/replay-workspace-postinstall.mjs",
|
||||
"server/scripts/install-copilot-assets.mjs",
|
||||
"packages/paperclip-runner/scripts/install-copilot-assets.mjs",
|
||||
"packages/paperclip-runner/scripts/materialize-copilot-binary.mjs",
|
||||
"packages/paperclip-runner/scripts/copilot-inner-distribution.mjs",
|
||||
]);
|
||||
|
||||
export function cachePlan({ files, read, scope, packageDirs }) {
|
||||
const dependencyInputs = files.filter((file) =>
|
||||
/(^|\/)package\.json$/.test(file)
|
||||
|| ["pnpm-lock.yaml", "pnpm-workspace.yaml", ".npmrc", ".pnpmfile.cjs", "pnpmfile.cjs"].includes(file)
|
||||
|| file.startsWith("scripts/")
|
||||
|| file.startsWith("server/scripts/")
|
||||
|| file.startsWith("packages/paperclip-runner/scripts/")
|
||||
|| DEPENDENCY_SCRIPT_INPUTS.has(file)
|
||||
|| file.startsWith("patches/"));
|
||||
const digest = (inputs, salt) => {
|
||||
const hash = createHash("sha256").update(JSON.stringify(salt));
|
||||
|
||||
Reference in new issue
Block a user