mirror of
https://github.com/microsoft/vscode.git
synced 2026-06-29 02:45:58 +01:00
37e7e85b10
* 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
139 lines
4.7 KiB
YAML
139 lines
4.7 KiB
YAML
name: "Copilot Setup Steps"
|
|
|
|
# Automatically run the setup steps when they are changed to allow for easy validation, and
|
|
# allow manual testing through the repository's "Actions" tab
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
paths:
|
|
- .github/workflows/copilot-setup-steps.yml
|
|
pull_request:
|
|
paths:
|
|
- .github/workflows/copilot-setup-steps.yml
|
|
|
|
jobs:
|
|
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
|
|
copilot-setup-steps:
|
|
runs-on: vscode-large-runners
|
|
|
|
# Set the permissions to the lowest permissions possible needed for your steps.
|
|
# Copilot will be given its own token for its operations.
|
|
permissions:
|
|
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
|
|
contents: read
|
|
|
|
# You can define any steps you want, and they will run before the agent starts.
|
|
# If you do not check out your code, Copilot will do this for you.
|
|
steps:
|
|
- name: Checkout microsoft/vscode
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version-file: .nvmrc
|
|
|
|
- name: Setup system services
|
|
run: |
|
|
set -e
|
|
# Start X server
|
|
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get update
|
|
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get install -y pkg-config \
|
|
xvfb \
|
|
libgtk-3-0 \
|
|
libxkbfile-dev \
|
|
libkrb5-dev \
|
|
libgbm1 \
|
|
rpm
|
|
sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
|
|
sudo chmod +x /etc/init.d/xvfb
|
|
sudo update-rc.d xvfb defaults
|
|
sudo service xvfb start
|
|
|
|
- name: Restore node_modules cache
|
|
id: cache-node-modules
|
|
uses: ./.github/actions/restore-node-modules
|
|
with:
|
|
key-prefix: node_modules-linux
|
|
key-args: "linux x64 $(node -p process.arch)"
|
|
|
|
- name: Install build dependencies
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
working-directory: build
|
|
run: |
|
|
set -e
|
|
|
|
for i in {1..5}; do # try 5 times
|
|
npm ci && break
|
|
if [ $i -eq 5 ]; then
|
|
echo "Npm install failed too many times" >&2
|
|
exit 1
|
|
fi
|
|
echo "Npm install failed $i, trying again..."
|
|
done
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install dependencies
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
run: |
|
|
set -e
|
|
|
|
source ./build/azure-pipelines/linux/setup-env.sh
|
|
|
|
for i in {1..5}; do # try 5 times
|
|
npm ci && break
|
|
if [ $i -eq 5 ]; then
|
|
echo "Npm install failed too many times" >&2
|
|
exit 1
|
|
fi
|
|
echo "Npm install failed $i, trying again..."
|
|
done
|
|
env:
|
|
npm_config_arch: x64
|
|
VSCODE_ARCH: x64
|
|
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Create .build folder
|
|
run: mkdir -p .build
|
|
|
|
- name: Prepare built-in extensions cache key
|
|
run: node build/azure-pipelines/common/computeBuiltInDepsCacheKey.ts > .build/builtindepshash
|
|
|
|
- name: Restore built-in extensions cache
|
|
id: cache-builtin-extensions
|
|
uses: actions/cache/restore@v5
|
|
with:
|
|
enableCrossOsArchive: true
|
|
path: .build/builtInExtensions
|
|
key: "builtin-extensions-${{ hashFiles('.build/builtindepshash') }}"
|
|
|
|
- name: Download built-in extensions
|
|
if: steps.cache-builtin-extensions.outputs.cache-hit != 'true'
|
|
run: node build/lib/builtInExtensions.ts
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Download Electron and Playwright
|
|
run: |
|
|
set -e
|
|
|
|
for i in {1..3}; do # try 3 times (matching retryCountOnTaskFailure: 3)
|
|
if npm exec -- npm-run-all2 -lp "electron x64" "playwright-install"; then
|
|
echo "Download successful on attempt $i"
|
|
break
|
|
fi
|
|
|
|
if [ $i -eq 3 ]; then
|
|
echo "Download failed after 3 attempts" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Download failed on attempt $i, retrying..."
|
|
sleep 5 # optional: add a small delay between retries
|
|
done
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|