From f094797dd19084a97e1f94545cdd699d9604734a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ad=C3=A1mek?= Date: Thu, 10 Sep 2026 12:03:35 +0200 Subject: [PATCH] perf(pnpm-install): use the runner's local disk for temp files on Windows The default Windows temp dir sits on a network-backed disk that is 4-6x slower at small-file writes than the local SSD behind RUNNER_TEMP. Pointing TMP/TEMP there for the rest of the job removes that cost for anything that unpacks many files into the temp dir. Measured on apify/actor-templates#907, where it took the Windows legs from ~20m to ~11m. No-op on Linux and macOS. Also documents gating playwright's --with-deps on Linux: on Windows the flag installs the Media Foundation feature, ~3 minutes per job. --- pnpm-install/README.md | 11 +++++++++++ pnpm-install/action.yaml | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/pnpm-install/README.md b/pnpm-install/README.md index 35ed6c7..97fd3c4 100644 --- a/pnpm-install/README.md +++ b/pnpm-install/README.md @@ -29,3 +29,14 @@ steps: with: github-registry-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_REGISTRY_TOKEN }} ``` + +## Windows runners + +On Windows the action also points `TMP` and `TEMP` at `RUNNER_TEMP` for the rest of the job. The default temp dir lives on a network-backed disk that is several times slower at small-file writes than the runner's local SSD, which matters for anything that unpacks a project or a `node_modules` tree into the temp dir. + +If the job installs Playwright browsers, gate `--with-deps` on Linux. On Windows the flag enables the Media Foundation feature, which takes about three minutes and only adds video codecs: + +```yaml + - name: Install Playwright browsers + run: pnpm exec playwright install chromium ${{ runner.os == 'Linux' && '--with-deps' || '' }} +``` diff --git a/pnpm-install/action.yaml b/pnpm-install/action.yaml index 0310b27..789f490 100644 --- a/pnpm-install/action.yaml +++ b/pnpm-install/action.yaml @@ -32,6 +32,14 @@ runs: with: swap-size-gb: 10 + # The default Windows temp dir is a network disk, ~5x slower at small files than RUNNER_TEMP (apify/actor-templates#907). + - name: Use the runner's local disk for temp files + if: runner.os == 'Windows' + shell: bash + run: | + echo "TMP=$RUNNER_TEMP" >> "$GITHUB_ENV" + echo "TEMP=$RUNNER_TEMP" >> "$GITHUB_ENV" + - uses: pnpm/action-setup@v6.0.8 name: Install pnpm with: