🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
⏪ revert(ci): remove the global pnpm store cache (#23434)
Inneib4ece3d180a7
diff --git a/.github/actions/desktop-build-setup/action.yml b/.github/actions/desktop-build-setup/action.ymlindex 5ebc1bfb963..4d8c306c539 100644--- a/.github/actions/desktop-build-setup/action.yml+++ b/.github/actions/desktop-build-setup/action.yml@@ -121,9 +121,17 @@ runs:echo "CLOUD_DESKTOP=1" >> "$GITHUB_ENV"echo "✅ Cloud repository $resolved_cloud_ref overlaid at $cloud_root"- # The pnpm store is cached by setup-env. The root `pnpm-lock.yaml` is gitignored- # and the overlay root has none, so the merged workspace is re-resolved on every- # run; the store is what saves the tarball downloads.+ # Shared with the isolated desktop install below. The root `pnpm-lock.yaml` is+ # gitignored, so hash the tracked dependency declarations — hashing an absent+ # file would pin one key forever and stop the store from ever taking new tarballs.+ - name: Cache pnpm store+ uses: actions/cache@v4+ with:+ path: ${{ runner.temp }}/pnpm-store+ key: pnpm-store-${{ runner.os }}-v1-${{ hashFiles('package.json', 'pnpm-workspace.yaml', 'apps/*/package.json', 'packages/*/package.json', 'patches/*.patch', 'apps/desktop/pnpm-lock.yaml') }}+ restore-keys: |+ pnpm-store-${{ runner.os }}-v1-+- name: Install dependenciesshell: bashrun: |@@ -131,7 +139,7 @@ runs:if [ "${CLOUD_DESKTOP:-}" = "1" ]; thencd ..fi- pnpm install --node-linker=hoisted+ pnpm install --node-linker=hoisted --store-dir "$RUNNER_TEMP/pnpm-store" --prefer-offline# 移除国内 electron 镜像配置,GitHub Actions 使用官方源更快- name: Remove China electron mirror from .npmrc@@ -146,6 +154,10 @@ runs:- name: Install deps on Desktopshell: bash+ env:+ # Reuse the store restored above instead of the ephemeral global one.+ # pnpm reads its own `pnpm_config_*` env namespace, not `npm_config_*`.+ pnpm_config_store_dir: ${{ runner.temp }}/pnpm-storerun: |set -euo pipefailif [ "${CLOUD_DESKTOP:-}" = "1" ]; thendiff --git a/.github/actions/overlay-type-check/action.yml b/.github/actions/overlay-type-check/action.ymlindex 631fdbf2b80..8b90d50dd01 100644--- a/.github/actions/overlay-type-check/action.yml+++ b/.github/actions/overlay-type-check/action.yml@@ -36,13 +36,21 @@ runs:overlay-ref: ${{ inputs.overlay-ref }}overlay-token: ${{ inputs.overlay-token }}- # The pnpm store is cached by setup-env, which caches the default store this- # install uses. The overlay root ships no lockfile, so pnpm resolves from the- # package.json ranges on every run; the content-addressed store is what saves- # the tarball downloads.+ # The overlay root ships no lockfile, so pnpm resolves from package.json ranges+ # on every run. The root `pnpm-lock.yaml` is gitignored, so the key hashes the+ # tracked dependency declarations instead — hashing an absent file would pin one+ # key forever and stop the store from ever taking new tarballs.+ - name: Cache pnpm store+ uses: actions/cache@v4+ with:+ path: ${{ runner.temp }}/pnpm-store+ key: pnpm-store-${{ runner.os }}-v1-${{ hashFiles('package.json', 'pnpm-workspace.yaml', 'apps/*/package.json', 'packages/*/package.json', 'patches/*.patch', 'apps/desktop/pnpm-lock.yaml') }}+ restore-keys: |+ pnpm-store-${{ runner.os }}-v1-+- name: Install dependenciesshell: bash- run: cd .. && pnpm install --node-linker=hoisted+ run: cd .. && pnpm install --node-linker=hoisted --store-dir "$RUNNER_TEMP/pnpm-store" --prefer-offline- name: Type check overlaid sourcesshell: bashdiff --git a/.github/actions/setup-env/action.yml b/.github/actions/setup-env/action.ymlindex 9914a574582..8e2544f12ec 100644--- a/.github/actions/setup-env/action.yml+++ b/.github/actions/setup-env/action.yml@@ -6,6 +6,10 @@ inputs:description: Node.js versionrequired: falsedefault: '24.11.1'+ package-manager-cache:+ description: Pass-through to actions/setup-node package-manager-cache+ required: false+ default: 'false'bun-version:description: Bun versionrequired: false@@ -24,19 +28,8 @@ runs:with:bun-version: ${{ inputs.bun-version }}- # setup-node only caches pnpm when `cache` is set explicitly; its automatic- # caching covers npm alone. The root `pnpm-lock.yaml` is gitignored, so the- # dependency path has to name the tracked declarations — a missing file makes- # the action fail rather than cache nothing.- name: Setup Node.jsuses: actions/setup-node@v6with:- cache: pnpm- cache-dependency-path: |- package.json- pnpm-workspace.yaml- apps/*/package.json- packages/*/package.json- patches/*.patch- apps/desktop/pnpm-lock.yamlnode-version: ${{ inputs.node-version }}+ package-manager-cache: ${{ inputs.package-manager-cache }}diff --git a/.github/scripts/desktop-overlay-type-check.test.mjs b/.github/scripts/desktop-overlay-type-check.test.mjsindex 28a29515a65..9051094bb5b 100644--- a/.github/scripts/desktop-overlay-type-check.test.mjs+++ b/.github/scripts/desktop-overlay-type-check.test.mjs@@ -1,11 +1,25 @@import assert from 'node:assert/strict';+import { execFileSync } from 'node:child_process';import { readFile } from 'node:fs/promises';import { test } from 'node:test';+import { fileURLToPath } from 'node:url';import { parse } from 'yaml';const load = async (path) => parse(await readFile(new URL(path, import.meta.url), 'utf8'));+const repoRoot = fileURLToPath(new URL('../..', import.meta.url));++/** CI only checks out tracked files, so a gitignored file hashes to nothing there. */+const isIgnored = (file) => {+ try {+ execFileSync('git', ['check-ignore', '--quiet', file], { cwd: repoRoot });+ return true;+ } catch {+ return false;+ }+};+const needsOf = (job) => [job.needs ?? []].flat();const stepUsing = (job, action) => job.steps.find((step) => step.uses === action);@@ -86,3 +100,39 @@ test('every pull request gets the overlay check, not only desktop builds', asyncassert.doesNotMatch(String(job.if ?? ''), /trigger:build-desktop|release\//);assert.ok([workflow.on.pull_request.types].flat().includes('opened'));});++for (const path of [+ '../actions/overlay-type-check/action.yml',+ '../actions/desktop-build-setup/action.yml',+]) {+ test(`${path} installs from a cached pnpm store`, async () => {+ const { runs } = await load(path);+ const cache = stepUsing(runs, 'actions/cache@v4');+ const install = runs.steps.find((step) =>+ /pnpm install --node-linker=hoisted/.test(step.run ?? ''),+ );++ assert.ok(cache, 'the store is cached');+ assert.match(String(cache.with.path), /pnpm-store/);+ assert.ok(+ runs.steps.indexOf(cache) < runs.steps.indexOf(install),+ 'the store is restored before install',+ );+ // The overlay root has no lockfile, so the store path must be passed explicitly.+ assert.match(String(install.run), /--store-dir "\$RUNNER_TEMP\/pnpm-store"/);+ assert.match(String(install.run), /--prefer-offline/);++ const hashed = String(cache.with.key)+ .match(/hashFiles\(([^)]*)\)/)[1]+ .split(',')+ .map((entry) => entry.trim().replaceAll("'", ''));++ assert.ok(+ hashed.some((entry) => entry.includes('package.json')),+ 'the key follows dependency declarations',+ );+ for (const file of hashed.filter((entry) => !entry.includes('*'))) {+ assert.ok(!isIgnored(file), `${file} is gitignored, so CI would hash nothing`);+ }+ });+}diff --git a/.github/scripts/setup-env-cache.test.mjs b/.github/scripts/setup-env-cache.test.mjsdeleted file mode 100644index e9c97642089..00000000000--- a/.github/scripts/setup-env-cache.test.mjs+++ /dev/null@@ -1,59 +0,0 @@-import assert from 'node:assert/strict';-import { execFileSync } from 'node:child_process';-import { readFile } from 'node:fs/promises';-import { test } from 'node:test';-import { fileURLToPath } from 'node:url';--import { parse } from 'yaml';--const load = async (path) => parse(await readFile(new URL(path, import.meta.url), 'utf8'));--const repoRoot = fileURLToPath(new URL('../..', import.meta.url));--const dependencyPaths = (node) =>- String(node.with['cache-dependency-path'] ?? '')- .split('\n')- .map((line) => line.trim())- .filter(Boolean);--/** CI only checks out tracked files, so a gitignored file hashes to nothing there. */-const isIgnored = (file) => {- try {- execFileSync('git', ['check-ignore', '--quiet', file], { cwd: repoRoot });- return true;- } catch {- return false;- }-};--test('setup-env caches the pnpm store from files CI actually checks out', async () => {- const { runs } = await load('../actions/setup-env/action.yml');- const node = runs.steps.find((step) => step.uses === 'actions/setup-node@v6');- const paths = dependencyPaths(node);-- // setup-node caches pnpm only when `cache` is set; its automatic caching is npm-only.- assert.equal(node.with.cache, 'pnpm');- assert.ok(- paths.some((path) => path.endsWith('package.json')),- 'the key follows dependency declarations',- );- for (const file of paths.filter((path) => !path.includes('*'))) {- assert.ok(!isIgnored(file), `${file} is gitignored, so CI would hash nothing`);- }-});--test('the overlay composites leave the store cache to setup-env', async () => {- for (const action of ['overlay-type-check', 'desktop-build-setup']) {- const { runs } = await load(`../actions/${action}/action.yml`);- const ownCache = runs.steps.find((step) => String(step.uses ?? '').startsWith('actions/cache'));- const storeDir = runs.steps.find((step) => String(step.run ?? '').includes('--store-dir'));-- assert.ok(- runs.steps.some((step) => step.uses === './.github/actions/setup-env'),- `${action} must set up the environment that caches the store`,- );- // A second cache step or store override would cache the same content twice.- assert.equal(ownCache, undefined, `${action} must not cache its own store`);- assert.equal(storeDir, undefined, `${action} must use the cached default store`);- }-});diff --git a/.github/workflows/test.yml b/.github/workflows/test.ymlindex 56f81b03ee4..bf215cf406a 100644--- a/.github/workflows/test.yml+++ b/.github/workflows/test.yml@@ -89,7 +89,7 @@ jobs:run: node --test .github/scripts/hotfixWorkflow.test.mjs- name: Verify desktop release workflows- run: node --test .github/scripts/desktop-publish-s3.test.mjs .github/scripts/release-desktop-canary.test.mjs .github/scripts/desktop-overlay-type-check.test.mjs .github/scripts/overlayTypeErrors.test.mjs .github/scripts/setup-env-cache.test.mjs+ run: node --test .github/scripts/desktop-publish-s3.test.mjs .github/scripts/release-desktop-canary.test.mjs .github/scripts/desktop-overlay-type-check.test.mjs .github/scripts/overlayTypeErrors.test.mjs- name: Test CLI build configuration, bundle and model-facing docsrun: bunx vitest run --config vitest.config.mts --silent='passed-only' tsdown.config.test.ts bundle.test.ts src/modelFacingDocs.test.ts