mirror of
https://github.com/stablyai/orca.git
synced 2026-10-01 16:02:03 +00:00
perf(ci): cache pnpm verification records on Linux (#23568)
* perf(ci): pilot pnpm verification record caching on Linux * test(ci): review pnpm verification record in mobile cache audit
This commit is contained in:
@@ -2,6 +2,10 @@ name: Install Node dependencies
|
||||
description: Installs the Node toolchain and repository dependencies for CI jobs, with optional Electron archive caching.
|
||||
|
||||
inputs:
|
||||
cache-pnpm-verification:
|
||||
description: Restore pnpm's policy-checked lockfile verification record on Linux.
|
||||
required: false
|
||||
default: 'true'
|
||||
native-runtime:
|
||||
description: Native runtime to prepare after the script-free install (none, node, or electron).
|
||||
required: false
|
||||
@@ -24,6 +28,15 @@ inputs:
|
||||
default: 'false'
|
||||
|
||||
outputs:
|
||||
verification-cache-hit:
|
||||
description: Whether pnpm's verification record was restored.
|
||||
value: ${{ steps.verification-cache-restore.outputs.cache-hit }}
|
||||
verification-cache-path:
|
||||
description: The small pnpm-owned verification record, without registry metadata.
|
||||
value: ${{ steps.verification-cache.outputs.path }}
|
||||
verification-cache-key:
|
||||
description: Exact verification record key, also used by the isolated PR benchmark.
|
||||
value: ${{ steps.verification-cache.outputs.key }}
|
||||
node-version:
|
||||
description: Resolved Node.js version used for the install.
|
||||
value: ${{ steps.requested-node.outputs.node-version || steps.default-node.outputs.node-version }}
|
||||
@@ -86,6 +99,25 @@ runs:
|
||||
path: ${{ steps.pnpm-store.outputs.path }}
|
||||
key: node-cache-${{ runner.os }}-${{ steps.pnpm-store.outputs.arch }}-pnpm-${{ hashFiles(inputs.cache-dependency-path) }}
|
||||
|
||||
- name: Resolve pnpm verification cache
|
||||
id: verification-cache
|
||||
if: runner.os == 'Linux' && inputs.cache-pnpm-verification == 'true'
|
||||
shell: bash
|
||||
env:
|
||||
POLICY_HASH: ${{ hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', '.npmrc') }}
|
||||
run: |
|
||||
printf 'path=%s/lockfile-verified.jsonl\n' "$(pnpm cache path)" >> "$GITHUB_OUTPUT"
|
||||
printf 'key=pnpm-verification-v1-%s-%s-%s-%s\n' "$RUNNER_OS" "$RUNNER_ARCH" "$(pnpm --version)" "$POLICY_HASH" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Restore pnpm verification record
|
||||
id: verification-cache-restore
|
||||
if: steps.verification-cache.outputs.key != ''
|
||||
continue-on-error: true
|
||||
uses: actions/cache/restore@v5
|
||||
with:
|
||||
path: ${{ steps.verification-cache.outputs.path }}
|
||||
key: ${{ steps.verification-cache.outputs.key }}
|
||||
|
||||
- name: Validate native runtime
|
||||
shell: bash
|
||||
env:
|
||||
@@ -120,6 +152,15 @@ runs:
|
||||
git -C "$GITHUB_WORKSPACE" diff --exit-code -- package.json pnpm-lock.yaml pnpm-workspace.yaml
|
||||
fi
|
||||
|
||||
# pnpm checks the cached record's policy and validity; never bypass verification.
|
||||
- name: Save pnpm verification record on main
|
||||
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && steps.verification-cache.outputs.key != '' && steps.verification-cache-restore.outputs.cache-hit != 'true'
|
||||
continue-on-error: true
|
||||
uses: actions/cache/save@v5
|
||||
with:
|
||||
path: ${{ steps.verification-cache.outputs.path }}
|
||||
key: ${{ steps.verification-cache.outputs.key }}
|
||||
|
||||
- name: Resolve Electron package cache
|
||||
id: electron-package-cache
|
||||
if: inputs.native-runtime == 'electron' || inputs.cache-electron-package == 'true'
|
||||
|
||||
Reference in New Issue
Block a user