Engineering - add job the maintain the node_modules cache for the Compile stage and builtin extensions cache (#254126)

* Engineering - add job the maintain the node_modules cache for the Compile stage and builtin extensions cache

* Fix typo
This commit is contained in:
Ladislau Szomoru
2025-07-04 14:17:51 +00:00
committed by GitHub
parent 6c0cbe007a
commit 2380d75ac8

View File

@@ -8,6 +8,79 @@ on:
permissions: {}
jobs:
compile:
name: Compile
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-ubuntu-22.04-x64 ]
steps:
- name: Checkout microsoft/vscode
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
env:
NODEJS_ORG_MIRROR: https://github.com/joaomoreno/node-mirror/releases/download
- name: Prepare node_modules cache key
run: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.js compile $(node -p process.arch) > .build/packagelockhash
- name: Restore node_modules cache
id: cache-node-modules
uses: actions/cache@v4
with:
path: .build/node_modules_cache
key: "node_modules-${{ hashFiles('.build/packagelockhash') }}"
- name: Install build tools
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: sudo apt update -y && sudo apt install -y build-essential pkg-config libx11-dev libx11-xcb-dev libxkbfile-dev libnotify-bin libkrb5-dev
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
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:
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create node_modules archive
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: |
set -e
node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt
mkdir -p .build/node_modules_cache
tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt
- name: Prepare built-in extensions cache key
run: |
set -e
mkdir -p .build
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
- name: Restore built-in extensions cache
id: cache-builtin-extensions
uses: actions/cache@v4
with:
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.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
linux:
name: Linux
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-ubuntu-22.04-x64 ]