ci: isolate the Windows pnpm setup destination per job

The windows-* jobs keep a separate standalone pnpm executable under
runner.temp/setup-pnpm-js. A previous job on the same self-hosted runner
can leave a locked @reflink native module there, so the next job's
pnpm/action-setup fails with EPERM during unlink before any test runs.
Suffix the destination with run_id, run_attempt, and job so every job
gets a fresh directory even when sequential jobs land on the same
runner; apply the same to the python SDK exe build. Update the pnpm
setup isolation note to record the Windows-specific destination.
This commit is contained in:
Chinesezjc
2026-08-26 16:39:30 +08:00
parent 5661b7a972
commit e87a47692d
6 changed files with 29 additions and 10 deletions
+20 -1
View File
@@ -5,7 +5,7 @@ import { describe, expect, it } from 'vitest'
const root = resolve(import.meta.dirname, '..')
const runnerPrivatePnpmDestination = '${{ runner.temp }}/setup-pnpm'
const nativeWindowsPnpmDestination = '${{ runner.temp }}/setup-pnpm-js'
const nativeWindowsPnpmDestination = '${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}'
describe('CI workflow', () => {
it('isolates every pnpm action setup destination per runner', () => {
@@ -36,6 +36,25 @@ describe('CI workflow', () => {
}
})
it('isolates the python SDK exe pnpm setup destination per job', () => {
const workflow: unknown = yaml.load(readFileSync(resolve(root, '.github/workflows/build-exe-for-python-sdk.yml'), 'utf8'))
if (!isRecord(workflow) || !isRecord(workflow.jobs)) throw new TypeError('build-exe-for-python-sdk.yml must define jobs')
const setups: Array<{ step: unknown }> = []
for (const job of Object.values(workflow.jobs)) {
if (!isRecord(job) || !Array.isArray(job.steps)) continue
for (const step of job.steps) {
if (!isRecord(step) || typeof step.uses !== 'string' || !step.uses.startsWith('pnpm/action-setup@')) continue
setups.push({ step })
}
}
expect(setups.length).toBeGreaterThan(0)
for (const { step } of setups) {
expect(step).toMatchObject({
with: { dest: nativeWindowsPnpmDestination },
})
}
})
it('keeps required Wine and split native Windows jobs with failover, plus a master-only standby', () => {
const workflow = loadWorkflow('.github/workflows/ci.yml')
const masterWorkflow = loadWorkflow('.github/workflows/ci-master.yml')