Skip to content

Merge pull request #1 from AthilioDev/dependabot/github_actions/actio… #4

Merge pull request #1 from AthilioDev/dependabot/github_actions/actio…

Merge pull request #1 from AthilioDev/dependabot/github_actions/actio… #4

name: Code OSS (node_modules) - Windows only
on:
push:
branches:
- main
permissions: {}
jobs:
windows:
name: Windows
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-windows-2022-x64 ]
env:
NPM_ARCH: x64
VSCODE_ARCH: x64
steps:
- name: Checkout microsoft/vscode
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
- name: Prepare node_modules cache key
shell: pwsh
run: |
mkdir .build -ea 0
node build/azure-pipelines/common/computeNodeModulesCacheKey.ts win32 ${{ env.VSCODE_ARCH }} $(node -p process.arch) > .build/packagelockhash
- name: Restore node_modules cache
uses: actions/cache@v5
id: node-modules-cache
with:
path: .build/node_modules_cache
key: "node_modules-windows-${{ hashFiles('.build/packagelockhash') }}"
- name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
shell: pwsh
run: |
. build/azure-pipelines/win32/exec.ps1
$ErrorActionPreference = "Stop"
for ($i = 1; $i -le 5; $i++) {
try {
exec { npm ci }
break
}
catch {
if ($i -eq 5) {
Write-Error "npm ci failed after 5 attempts"
throw
}
Write-Host "npm ci failed attempt $i, retrying..."
Start-Sleep -Seconds 2
}
}
env:
npm_config_arch: ${{ env.NPM_ARCH }}
npm_config_foreground_scripts: "true"
VSCODE_ARCH: ${{ env.VSCODE_ARCH }}
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
GITHUB_TOKEN: ${{ secrets.VSCODE_OSS }}
- name: Create node_modules archive
if: steps.node-modules-cache.outputs.cache-hit != 'true'
shell: pwsh
run: |
. build/azure-pipelines/win32/exec.ps1
$ErrorActionPreference = "Stop"
exec { node build/azure-pipelines/common/listNodeModules.ts .build/node_modules_list.txt }
exec { mkdir -Force .build/node_modules_cache }
exec { 7z.exe a .build/node_modules_cache/cache.7z -mx3 `@.build/node_modules_list.txt }