@@ -405,6 +405,29 @@ jobs:
405405 working-directory : turbopack/crates/turbopack-tracing/tests/node-file-trace
406406 run : pnpm install --recursive
407407
408+ # Tests running in /tmp use a separate store for hard links, so we need to copy the cache
409+ # there for it to be useful to tests. If we switch to using pnpm's global virtual store, we
410+ # shouldn't need this, as symlinks can cross mountpoints.
411+ - name : Copy pnpm cache to tmpfs
412+ id : copy-pnpm-cache
413+ background : true
414+ if : ${{ runner.os == 'Linux' && inputs.skipInstallBuild != 'yes' }}
415+ env :
416+ PNPM_STORE_PATH : ${{ steps.get-store-path.outputs.STORE_PATH }}
417+ run : |
418+ PROBE_SOURCE=$(mktemp "$PNPM_STORE_PATH/.hardlink-probe.XXXXXX")
419+ PROBE_DIR=$(mktemp -d /tmp/pnpm-hardlink-probe.XXXXXX)
420+ trap 'rm -f "$PROBE_SOURCE"; rm -rf "$PROBE_DIR"' EXIT
421+ if ln "$PROBE_SOURCE" "$PROBE_DIR/link"; then
422+ echo "::error::Hard links from the pnpm store to /tmp work; the fixture store copy should not be needed."
423+ exit 1
424+ fi
425+ rm -f "$PROBE_SOURCE"
426+ rm -rf "$PROBE_DIR"
427+ FIXTURE_STORE_PATH="/tmp/.pnpm-store"
428+ mkdir -p "$FIXTURE_STORE_PATH"
429+ cp -a "$PNPM_STORE_PATH" "$FIXTURE_STORE_PATH/"
430+
408431 - name : Install Playwright browsers
409432 background : true
410433 if : ${{ inputs.skipInstallBuild != 'yes' && inputs.needsPlaywright != 'no' }}
@@ -431,6 +454,10 @@ jobs:
431454 fi
432455 echo "Test timings loaded ($(wc -c < test-timings.json) bytes)"
433456
457+ - name : Wait for pnpm cache copy
458+ wait : copy-pnpm-cache
459+ if : ${{ runner.os == 'Linux' && inputs.skipInstallBuild != 'yes' }}
460+
434461 - name : Fetch test timings via turbo
435462 background : true
436463 if : ${{ inputs.testTimingsArtifact == '' }}
0 commit comments