From a2231d04f8b8853e97786b9ba53d3383327c6b4b Mon Sep 17 00:00:00 2001 From: Rinse Date: Sat, 22 Aug 2026 04:18:12 +0000 Subject: [PATCH] ci: install the packed tarball to the fast volume on windows (#136) The windows job intermittently hit timeout-minutes: 20 inside "Verify global install from pack", before running a single test. When that happened on a master push, CI-build.yml - gated on workflow_run.conclusion == 'success' - was skipped, so no release was published. It silently blocked the pkc-js 0.0.85 release. The step has been chronically slow, not newly slow: 8-13m across the last 40 runs going back to June, against a 20m cap, with the whole test suite taking 2.5m. It had already timed out on 2026-07-30 and 2026-08-13. Cause is the destination volume. Windows defaults the npm global prefix to C:\npm\prefix on the OS disk, while npm ci writes a larger tree to the workspace on D:. Measured on windows-latest with an identical warm cache, varying only the destination: C:\npm\prefix 9.1m D:\npm-global 1.4m D:, non-global 1.0m Everything else was ruled out first: dependency resolution is 12s, --ignore-scripts is no faster, npm 12.0.2 is no faster, and --offline succeeds in ~10m - so none of the cost was registry traffic. Note ff6aa9b's --prefer-offline did not fix this. Median step time was ~10.0m before it and ~10.7m after; it was credited with a 17.1m outlier in an already noisy distribution. The flag is kept, since reusing the cache is still correct, but its comment no longer claims to be the fix. Also add .github/** to the pull_request paths. Without it a PR that only touches a workflow does not run CI, so this change could not be tested by its own PR. --- .github/workflows/CI.yml | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7110c79..ee30273 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -12,6 +12,7 @@ on: - 'config/**' - 'ci-bin/**' - 'ci-bin/*' + - '.github/**' - 'package.json' - 'package-lock.json' - 'Dockerfile' @@ -69,18 +70,42 @@ jobs: - run: npm run build - run: npx oclif manifest + # Windows defaults the npm global prefix to C:\npm\prefix, on the OS + # volume. Installing this package's ~1386 dependencies there took ~9m, + # while `npm ci` writes a larger tree (2054 packages) to the workspace on + # D:, the runner's fast volume, in ~55s. That gap repeatedly pushed the + # job past timeout-minutes, and a cancelled CI run on master silently + # skips CI-build.yml, so no release is published (issue #136). + # + # Measured on windows-latest, same warm cache, only the destination + # differing: C: 9.1m, D: 1.4m, and a plain non-global install on D: 1.0m. + # Resolution (12s), postinstall scripts, npm version and the network were + # each ruled out first - `--offline` succeeds in ~10m, so none of the cost + # was registry traffic. + # + # setup-node exports npm_config_prefix, which takes precedence over + # `npm config set prefix`, so the env var itself has to be overridden. + - name: Put the npm global prefix on the fast volume (windows) + if: matrix.os == 'windows-latest' + shell: bash + run: | + mkdir -p /d/npm-global + echo 'npm_config_prefix=D:\npm-global' >> $GITHUB_ENV + echo 'D:\npm-global' >> $GITHUB_PATH + - name: Verify global install from pack shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + echo "npm global prefix: $(npm config get prefix)" TARBALL=$(npm pack | tail -1) # Retry: the kubo postinstall downloads its binary from dist.ipfs.tech, # which intermittently returns 5xx and aborts the install with no retry # of its own (issue #110). - # --prefer-offline reuses the cache primed by `npm ci` above, which - # skips the registry round trips that made this step take 17m on - # Windows and blow the job timeout. + # --prefer-offline reuses the cache primed by `npm ci` above. Note it + # is not what makes this step fast - see #136; the destination volume + # is. Kept because reusing the cache is still the right default. for attempt in 1 2 3; do npm install -g --prefer-offline --no-audit --no-fund "./$TARBALL" && break echo "global install attempt $attempt failed; retrying in 15s..."