ci: pre-seed node-gyp headers on Linux too (#55202)

The Linux build/test images ship a node-gyp header cache built with the
image builder's host Node (currently 22.23.3), but the containers run
the nodesource Node (22.23.4), so the cache never matches. Every
native-addon fixture then downloads the headers itself and copies them
into the shared devdir in parallel, truncating headers that an
already-configured fixture is compiling against.

Run the pre-seed on every platform and pass --ensure so it is a no-op
when the cache already matches.


Claude-Session: https://claude.ai/code/session_01Xtmcutqr2Yx3gWuQ7LyDad

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
claude[bot]andClaude authored and GitHub committed 2026-10-22 14:26:21 -07:00
1 parent a89731b06c
commit 35ac258e35
1 file changed
+18 -16
+18 -16
View File
@@ -20,20 +20,22 @@ runs:
cd src/electron
node script/yarn.js install --immutable --mode=skip-build
# Pre-seed the node-gyp header cache so the parallel native-addon
# builds below don't race on a cold cache. Linux build containers
# already ship a warm cache (electron/build-images#68), so only do
# this on macOS / Windows runners.
if [ "$(uname -s)" != "Linux" ]; then
for i in 1 2 3; do
if node node_modules/node-gyp/bin/node-gyp.js install; then
break
fi
if [ "$i" = "3" ]; then
echo "node-gyp header pre-seed failed after 3 attempts" >&2
exit 1
fi
echo "node-gyp header pre-seed failed (attempt $i), retrying in 5s..." >&2
sleep 5
done
fi
# builds below don't race on a cold cache: when the headers are missing,
# every concurrent node-gyp copies them into the shared devdir, truncating
# headers that an already-configured addon is compiling against.
# The Linux containers ship a pre-warmed cache (electron/build-images#68),
# but it is keyed by the Node version of the host that built the image,
# which does not always match the Node inside the container, so do this
# everywhere. --ensure makes it a no-op when the cache is already warm.
for i in 1 2 3; do
if node node_modules/node-gyp/bin/node-gyp.js install --ensure; then
break
fi
if [ "$i" = "3" ]; then
echo "node-gyp header pre-seed failed after 3 attempts" >&2
exit 1
fi
echo "node-gyp header pre-seed failed (attempt $i), retrying in 5s..." >&2
sleep 5
done
node script/yarn.js install --immutable