3 Commits
Author SHA1 Message Date
Alexandru DimaandCopilot fe721a5460 ci: only warm missing node_modules caches on main (#342747)
* ci: only warm missing node_modules caches on main

Every push to main started six cache warming jobs on 1ES and macOS runners, which found their caches present and exited in about 30 seconds in 93 of the last 100 runs, while waiting up to 29 minutes for runners shared with pull request jobs.

A job on a GitHub-hosted runner now computes the cache keys of each job, including the CRLF checkouts of the Windows runners, and lists the caches on main. Jobs only run when one of their caches is missing, and all jobs run when the detection fails. At most one run is in progress so that concurrent pushes don't install the same missing dependencies several times.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* ci: also match cache versions when detecting missing caches

actions/cache only restores a cache whose key and version both match, and the version depends on the cache path, compression method and OS. Detecting caches by key alone could skip warming a cache that the jobs can no longer restore, for example after a runner image changes its home directory.

The detection now also compares the cache versions, mirroring actions/cache with the cache paths of the runners. A cache with another version counts as missing, so the job runs and saves a compatible one.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-20 02:59:32 +02:00
Alexandru DimaandCopilot 175d3497e6 ci: Cache Electron downloads for PR tests (#336166)
Cache Electron downloads for PR tests

Warm platform-specific Electron archive caches on main and restore them in PR tests through a shared setup action. Preserve checksum validation, retries, and lookup-only dependency checks for already-warm jobs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-15 07:11:10 +00:00
Alexandru Dima 37e7e85b10 Optimize node_modules caching for CI & PR checks (#322074)
* CI: speed up node_modules cache with zstd + shared scripts

Switch the Linux/macOS node_modules cache from single-threaded gzip
(tar -czf) to multi-threaded zstd. The "Create node_modules archive"
step was spending ~5min of single-core gzip on a multi-GB tree on every
cache miss; zstd -T0 uses all cores and decompresses much faster, so
cache-hit jobs benefit too. Windows stays on 7-Zip (already threaded).

Extract the archive/extract commands into shared per-platform scripts
under .github/workflows/node_modules_cache/ (cache.sh / cache.ps1, each
dispatching on an archive|extract argument) so the format and flags live
in one place instead of being duplicated across ~8 workflows. Bump
build/.cachesalt to invalidate existing gzip caches.

Also remove the obsolete extensions/copilot CI workflows
(copilot-setup-steps.yml, ensure-node-modules-cache.yml, pr.yml) and the
unused build/listBuildCacheFiles.js, and drop their now-stale entries
(plus lit-html and signals-core) from .eslint-allowed-javascript-files.

* ci: seed copilot node_modules cache on main and rename cache keys

Add copilot-linux and copilot-windows jobs to pr-node-modules.yml so the
copilot node_modules cache is populated on main. Rename the copilot cache
keys to copilot-node_modules-linux / copilot-node_modules-windows in pr.yml.

* ci: extract node_modules cache into composite actions

Factor the repeated node_modules cache plumbing into two local composite
actions, restore-node-modules and save-node-modules, and migrate all
workflows that used the cache.sh/cache.ps1 archive flow (pr, pr-node-modules,
pr-{linux,darwin,win32}-test, copilot-setup-steps, component-fixtures,
css-order-scan).

- restore-node-modules computes the key, restores the cache, optionally
  extracts on a hit, and exports the resolved key via $GITHUB_ENV.
- save-node-modules archives node_modules and saves it to the cache, reusing
  the key exported by restore so callers don't repeat the prefix.
- Bespoke install steps stay in the workflows, so per-job env/secrets never
  cross the action boundary.
- Only seed the cache on branch pushes (component-fixtures skips PRs, whose
  caches aren't shared).

* save the node_modules cache for now to test it

* ci: fix node_modules cache save dropping the archive

cache.sh wrote its archive as cache.tzst, but actions/cache reserves that
name for its own tarball and passes --exclude cache.tzst, so our archive was
excluded and an empty (~200 B) cache was saved on Linux/macOS. Rename the
archive to node-modules.tzst and bump build/.cachesalt to invalidate the
broken cache entries.

* empty commit

* Remove again saving to the node modules cache from PR steps
2026-06-19 17:21:43 +02:00