perf(ci): cache npm downloads and portable builds in Ghidra, readiness, mutation, and recovery jobs

This commit is contained in:
morluto committed 2026-11-17 19:58:40 +08:00
1 parent fea7648f68
commit f5285e6a54
6 files changed
+78 -7

No files matched your search

+10 -2
View File
@@ -433,7 +433,8 @@ jobs:
needs.changes.outputs.agentenv == 'true' ||
needs.changes.outputs.packet_capture == 'true' ||
needs.changes.outputs.signal_recording == 'true' ||
needs.changes.outputs.go_binary == 'true'
needs.changes.outputs.go_binary == 'true' ||
needs.changes.outputs.ghidra_bridge == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
@@ -936,6 +937,8 @@ jobs:
id: npm-cache
uses: ./.github/actions/npm-cache
- run: npm ci
- name: Reuse portable build outputs across runs
uses: ./.github/actions/portable-build-cache
- name: Verify static CLI/MCP journeys and synthetic report conformance
env:
REA_READINESS_REPORT_PATH: readiness-report.json
@@ -1280,9 +1283,14 @@ jobs:
uses: ./.github/workflows/nativeaot-fixtures.yml
ghidra_bridge:
needs: [changes, static]
needs: [changes, static, build]
if: needs.changes.outputs.ghidra_bridge == 'true'
secrets:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
uses: ./.github/workflows/ghidra-bridge-sources.yml
with:
build_cache_artifact: rea-build-cache
remote_cache_write: ${{ inputs.remote_cache_write == true || (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')) }}
android_metadata:
needs: [changes, static]
+29 -1
View File
@@ -1,14 +1,36 @@
name: Ghidra bridge source compilation
on:
workflow_dispatch:
workflow_call:
inputs:
build_cache_artifact:
description: Portable build cache artifact from the calling CI run.
required: false
type: string
default: ""
remote_cache_write:
description: Trusted release qualification may publish the remote cache.
required: false
type: boolean
default: false
secrets:
TURBO_TOKEN:
description: Remote cache token. Only trusted callers pass it.
required: false
workflow_dispatch:
permissions:
contents: read
env:
HUSKY: "0"
# A called workflow sees the caller event, so workflow_call is not an event
# name here. Writes when remote_cache_write is set, or on the default branch
# for push, schedule, and manual dispatch. Open pull requests stay empty-token
# and use the local cache only.
TURBO_TOKEN: "${{ (inputs.remote_cache_write == true || (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'))) && secrets.TURBO_TOKEN || '' }}"
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_CACHE: "${{ (inputs.remote_cache_write == true || (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'))) && 'local:rw,remote:rw' || 'local:rw' }}"
jobs:
ghidra-bridge-sources:
@@ -23,6 +45,9 @@ jobs:
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version-file: .nvmrc
- name: Cache npm package downloads
id: npm-cache
uses: ./.github/actions/npm-cache
- name: Validate the SDK pin against the provider's verified release
run: node scripts/verify-ghidra-bridge-sources.mjs --check-sdk-pin >> "$GITHUB_ENV"
# The bridge probe imports only source-owned ARM, Thumb and MIPS bytes and never
@@ -48,6 +73,9 @@ jobs:
JAVA_HOME="${!java_home_variable}" npm run verify:ghidra:bridge-sources -- --verified-sdk
- name: Install locked dependencies for loader relocation regression
run: npm ci
- uses: ./.github/actions/portable-build-cache
with:
build_cache_artifact: ${{ inputs.build_cache_artifact }}
- name: Verify loader relocation handling with the native decompiler
shell: bash
run: |
+2
View File
@@ -42,6 +42,8 @@ jobs:
- name: Cache npm package downloads
uses: ./.github/actions/npm-cache
- run: npm ci
- name: Reuse portable build outputs across runs
uses: ./.github/actions/portable-build-cache
- run: npm run test:prepare
- name: Run the complete configuration
env:
+3
View File
@@ -37,6 +37,9 @@ jobs:
with:
node-version-file: .nvmrc
package-manager-cache: false
- name: Cache npm package downloads
id: npm-cache
uses: ./.github/actions/npm-cache
- run: npm ci
- name: Validate original release authority
id: release
@@ -731,8 +731,38 @@ it("exports turbo remote-cache credentials wherever a workflow runs turbo", asyn
const files = (await readdir(directory)).filter((file) =>
/\.ya?ml$/u.test(file),
);
const turboCommand =
/\bturbo\b|build:cached|check:ci|docs:check|docs:generate|docs:prepare|test:prepare/u;
const packageScripts = z
.object({ scripts: z.record(z.string(), z.string()) })
.parse(
JSON.parse(await readFile(join(repository, "package.json"), "utf8")),
).scripts;
const turboScripts = new Set<string>();
let discovered = true;
while (discovered) {
discovered = false;
for (const [scriptName, scriptCommand] of Object.entries(packageScripts)) {
if (turboScripts.has(scriptName)) continue;
if (/\bturbo\b|run-turbo\.mjs/u.test(scriptCommand)) {
turboScripts.add(scriptName);
discovered = true;
continue;
}
for (const match of scriptCommand.matchAll(/\bnpm run ([\w:-]+)/gu))
if (match[1] !== undefined && turboScripts.has(match[1])) {
turboScripts.add(scriptName);
discovered = true;
break;
}
}
}
const runsTurboCommand = (command: string): boolean => {
if (/\bturbo\b/u.test(command)) return true;
for (const match of command.matchAll(
/\bnpm run (?:--silent\s+)?(?!--)([\w:-]+)/gu,
))
if (match[1] !== undefined && turboScripts.has(match[1])) return true;
return false;
};
const workflowSchema = z.object({
env: z.record(z.string(), z.unknown()).optional(),
jobs: z.record(
@@ -751,7 +781,7 @@ it("exports turbo remote-cache credentials wherever a workflow runs turbo", asyn
);
for (const [name, job] of Object.entries(workflow.jobs)) {
const runsTurbo = job.steps?.some(
(step) => step.run !== undefined && turboCommand.test(step.run),
(step) => step.run !== undefined && runsTurboCommand(step.run),
);
if (!runsTurbo) continue;
const env = { ...workflow.env, ...job.env };
@@ -374,7 +374,6 @@ async function assertProviderCacheCallers(
for (const name of [
"sqlite-runtime",
"nativeaot",
"ghidra_bridge",
"android_metadata",
"website",
])
@@ -432,6 +431,7 @@ it("binds provider build reuse to the current run while keeping standalone dispa
"packet_capture",
"signal_recording",
"go_binary",
"ghidra_bridge",
];
const buildTerms = z
.string()