diff --git a/.eslint-allowed-javascript-files b/.eslint-allowed-javascript-files index a90f84180f1..7d31572290d 100644 --- a/.eslint-allowed-javascript-files +++ b/.eslint-allowed-javascript-files @@ -20,7 +20,6 @@ extensions/copilot/.mocha-multi-reporters.js extensions/copilot/.mocharc.js extensions/copilot/.vscode-test.mjs extensions/copilot/.vscode/extensions/visualization-runner/entry.js -extensions/copilot/build/listBuildCacheFiles.js extensions/copilot/script/electron/simulationWorkbenchMain.js extensions/copilot/src/extension/completions-core/vscode-node/extension/test/run.js extensions/copilot/src/extension/test/node/fixtures/gitdiff/generate-diffs.js @@ -98,13 +97,8 @@ scripts/code-sessions-web.js scripts/code-web.js scripts/xterm-update.js src/vs/base/browser/dompurify/dompurify.js -src/vs/base/common/lit-html/directive-helpers.js -src/vs/base/common/lit-html/directive.js -src/vs/base/common/lit-html/directives/repeat.js -src/vs/base/common/lit-html/lit-html.js src/vs/base/common/marked/marked.js src/vs/base/common/semver/semver.js -src/vs/base/common/signals-core/signals-core.js src/vs/base/test/common/filters.perf.data.js src/vs/editor/test/node/diffing/fixtures/difficult-move/1.js src/vs/editor/test/node/diffing/fixtures/difficult-move/2.js diff --git a/.github/actions/restore-node-modules/action.yml b/.github/actions/restore-node-modules/action.yml new file mode 100644 index 00000000000..1e4e483f6e9 --- /dev/null +++ b/.github/actions/restore-node-modules/action.yml @@ -0,0 +1,60 @@ +name: Restore node_modules cache +description: Computes the node_modules cache key, restores the cache, and extracts it on a hit. + +inputs: + key-prefix: + description: Prefix for the cache key. The package-lock hash is appended automatically. + required: true + key-args: + description: Arguments passed to build/azure-pipelines/common/computeNodeModulesCacheKey.ts. + required: true + extract: + description: When 'true', the restored archive is extracted into node_modules on a cache hit. + default: 'true' + +outputs: + cache-hit: + description: "'true' when the node_modules cache was restored from an exact key match." + value: ${{ steps.restore.outputs.cache-hit }} + +runs: + using: composite + steps: + - name: Prepare node_modules cache key + if: runner.os != 'Windows' + shell: bash + run: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts ${{ inputs.key-args }} > .build/packagelockhash + + - name: Prepare node_modules cache key + if: runner.os == 'Windows' + shell: pwsh + run: | + mkdir .build -ea 0 + node build/azure-pipelines/common/computeNodeModulesCacheKey.ts ${{ inputs.key-args }} > .build/packagelockhash + + - name: Restore node_modules cache + id: restore + uses: actions/cache/restore@v5 + with: + path: .build/node_modules_cache + key: "${{ inputs.key-prefix }}-${{ hashFiles('.build/packagelockhash') }}" + + - name: Export node_modules cache key + if: runner.os != 'Windows' + shell: bash + run: echo "NODE_MODULES_CACHE_KEY=${{ steps.restore.outputs.cache-primary-key }}" >> "$GITHUB_ENV" + + - name: Export node_modules cache key + if: runner.os == 'Windows' + shell: pwsh + run: Add-Content -Path $env:GITHUB_ENV -Value "NODE_MODULES_CACHE_KEY=${{ steps.restore.outputs.cache-primary-key }}" + + - name: Extract node_modules cache + if: runner.os != 'Windows' && inputs.extract == 'true' && steps.restore.outputs.cache-hit == 'true' + shell: bash + run: ./.github/workflows/node_modules_cache/cache.sh extract + + - name: Extract node_modules cache + if: runner.os == 'Windows' && inputs.extract == 'true' && steps.restore.outputs.cache-hit == 'true' + shell: pwsh + run: ./.github/workflows/node_modules_cache/cache.ps1 extract diff --git a/.github/actions/save-node-modules/action.yml b/.github/actions/save-node-modules/action.yml new file mode 100644 index 00000000000..16d8ce96d83 --- /dev/null +++ b/.github/actions/save-node-modules/action.yml @@ -0,0 +1,21 @@ +name: Save node_modules cache +description: Archives node_modules and saves the archive to the GitHub Actions cache. + +runs: + using: composite + steps: + - name: Create node_modules archive + if: runner.os != 'Windows' + shell: bash + run: ./.github/workflows/node_modules_cache/cache.sh archive + + - name: Create node_modules archive + if: runner.os == 'Windows' + shell: pwsh + run: ./.github/workflows/node_modules_cache/cache.ps1 archive + + - name: Save node_modules cache + uses: actions/cache/save@v5 + with: + path: .build/node_modules_cache + key: ${{ env.NODE_MODULES_CACHE_KEY }} diff --git a/.github/workflows/component-fixtures.yml b/.github/workflows/component-fixtures.yml index 04bac6ac7d6..e42f20b623d 100644 --- a/.github/workflows/component-fixtures.yml +++ b/.github/workflows/component-fixtures.yml @@ -38,19 +38,12 @@ jobs: with: node-version-file: .nvmrc - - name: Prepare node_modules cache key - run: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts compile $(node -p process.arch) > .build/packagelockhash - - name: Restore node_modules cache id: cache-node-modules - uses: actions/cache@v5 + uses: ./.github/actions/restore-node-modules with: - path: .build/node_modules_cache - key: "node_modules-component-fixtures-${{ hashFiles('.build/packagelockhash') }}" - - - name: Extract node_modules cache - if: steps.cache-node-modules.outputs.cache-hit == 'true' - run: tar -xzf .build/node_modules_cache/cache.tgz + key-prefix: node_modules-component-fixtures + key-args: "compile $(node -p process.arch)" - name: Install dependencies if: steps.cache-node-modules.outputs.cache-hit != 'true' @@ -70,13 +63,10 @@ jobs: run: npm ci working-directory: build/rspack - - name: Create node_modules archive - if: steps.cache-node-modules.outputs.cache-hit != 'true' - run: | - set -e - node build/azure-pipelines/common/listNodeModules.ts .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: Save node_modules cache + # Only seed the cache on branch pushes — PR-scoped caches are not shared with other refs. + if: github.event_name != 'pull_request' && steps.cache-node-modules.outputs.cache-hit != 'true' + uses: ./.github/actions/save-node-modules - name: Copy codicons run: cp node_modules/@vscode/codicons/dist/codicon.ttf src/vs/base/browser/ui/codicons/codicon/codicon.ttf diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index c3a390e905f..0f1b025b10a 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -50,19 +50,12 @@ jobs: sudo update-rc.d xvfb defaults sudo service xvfb start - - name: Prepare node_modules cache key - run: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts linux x64 $(node -p process.arch) > .build/packagelockhash - - name: Restore node_modules cache id: cache-node-modules - uses: actions/cache/restore@v5 + uses: ./.github/actions/restore-node-modules with: - path: .build/node_modules_cache - key: "node_modules-linux-${{ hashFiles('.build/packagelockhash') }}" - - - name: Extract node_modules cache - if: steps.cache-node-modules.outputs.cache-hit == 'true' - run: tar -xzf .build/node_modules_cache/cache.tgz + 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' @@ -103,14 +96,6 @@ jobs: 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.ts .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: Create .build folder run: mkdir -p .build diff --git a/.github/workflows/css-order-scan.yml b/.github/workflows/css-order-scan.yml index 4be9a52ad4d..49f6b27e0aa 100644 --- a/.github/workflows/css-order-scan.yml +++ b/.github/workflows/css-order-scan.yml @@ -29,19 +29,12 @@ jobs: with: node-version-file: .nvmrc - - name: Prepare node_modules cache key - run: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts compile $(node -p process.arch) > .build/packagelockhash - - name: Restore node_modules cache id: cache-node-modules - uses: actions/cache@v5 + uses: ./.github/actions/restore-node-modules with: - path: .build/node_modules_cache - key: "node_modules-css-order-scan-${{ hashFiles('.build/packagelockhash') }}" - - - name: Extract node_modules cache - if: steps.cache-node-modules.outputs.cache-hit == 'true' - run: tar -xzf .build/node_modules_cache/cache.tgz + key-prefix: node_modules-css-order-scan + key-args: "compile $(node -p process.arch)" - name: Install dependencies if: steps.cache-node-modules.outputs.cache-hit != 'true' @@ -61,13 +54,9 @@ jobs: run: npm ci working-directory: build/rspack - - name: Create node_modules archive + - name: Save node_modules cache if: steps.cache-node-modules.outputs.cache-hit != 'true' - run: | - set -e - node build/azure-pipelines/common/listNodeModules.ts .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 + uses: ./.github/actions/save-node-modules - name: Copy codicons run: cp node_modules/@vscode/codicons/dist/codicon.ttf src/vs/base/browser/ui/codicons/codicon/codicon.ttf diff --git a/.github/workflows/node_modules_cache/README.md b/.github/workflows/node_modules_cache/README.md new file mode 100644 index 00000000000..00ea9681119 --- /dev/null +++ b/.github/workflows/node_modules_cache/README.md @@ -0,0 +1,35 @@ +# node_modules cache scripts + +Shared helpers used by the GitHub Actions workflows to store and restore the +`node_modules` cache. They exist so the archive format and compression flags +live in a single place instead of being duplicated across every workflow. + +Each script takes an action argument: + +| Script | Platform | `archive` | `extract` | +| ------ | -------- | --------- | --------- | +| `cache.sh ` | Linux / macOS | Create `node-modules.tzst` (cache miss) | Restore `node-modules.tzst` (cache hit) | +| `cache.ps1 ` | Windows | Create `cache.7z` (cache miss) | Restore `cache.7z` (cache hit) | + +Linux/macOS use multi-threaded `zstd` (`node-modules.tzst`); Windows uses 7-Zip +(`cache.7z`). The archive must NOT be named `cache.tzst`: `actions/cache` names +its own tarball `cache.tzst` and passes `--exclude cache.tzst`, which would drop +our archive and save an empty cache. The two families are not interchangeable, +so the cache key already encodes the OS (`node_modules-linux-*`, +`node_modules-windows-*`, …). + +Example usage from a workflow step: + +```yaml +- name: Extract node_modules cache + if: steps.cache-node-modules.outputs.cache-hit == 'true' + run: ./.github/workflows/node_modules_cache/cache.sh extract + +- name: Create node_modules archive + if: steps.cache-node-modules.outputs.cache-hit != 'true' + run: ./.github/workflows/node_modules_cache/cache.sh archive +``` + +If you change the archive format or flags, update both the `archive` and +`extract` branch of the script, and bump `build/.cachesalt` to invalidate +existing caches. diff --git a/.github/workflows/node_modules_cache/cache.ps1 b/.github/workflows/node_modules_cache/cache.ps1 new file mode 100644 index 00000000000..a0355d6dc9b --- /dev/null +++ b/.github/workflows/node_modules_cache/cache.ps1 @@ -0,0 +1,27 @@ +# Store or restore the node_modules cache on Windows. +# +# Usage: +# cache.ps1 archive # create .build/node_modules_cache/cache.7z (cache miss) +# cache.ps1 extract # restore .build/node_modules_cache/cache.7z (cache hit) +# +# Uses 7-Zip. The archive and extract format must stay compatible; if you change +# the format here, bump build/.cachesalt to invalidate old caches. +param( + [Parameter(Mandatory = $true)] + [ValidateSet("archive", "extract")] + [string]$Action +) + +. build/azure-pipelines/win32/exec.ps1 +$ErrorActionPreference = "Stop" + +switch ($Action) { + "archive" { + 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 } + } + "extract" { + exec { 7z.exe x .build/node_modules_cache/cache.7z -aoa } + } +} diff --git a/.github/workflows/node_modules_cache/cache.sh b/.github/workflows/node_modules_cache/cache.sh new file mode 100755 index 00000000000..19d109f6709 --- /dev/null +++ b/.github/workflows/node_modules_cache/cache.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# Store or restore the node_modules cache on Linux / macOS. +# +# Usage: +# cache.sh archive # create .build/node_modules_cache/node-modules.tzst (cache miss) +# cache.sh extract # restore .build/node_modules_cache/node-modules.tzst (cache hit) +# +# Uses multi-threaded zstd. The archive must NOT be named cache.tzst because +# actions/cache reserves that name and excludes it from the saved cache. The +# archive and extract flags must stay compatible; if you change the format +# here, bump build/.cachesalt to invalidate old caches. +set -e + +case "$1" in + archive) + node build/azure-pipelines/common/listNodeModules.ts .build/node_modules_list.txt + mkdir -p .build/node_modules_cache + tar --use-compress-program='zstd -T0 -3' -cf .build/node_modules_cache/node-modules.tzst --files-from .build/node_modules_list.txt + ;; + extract) + tar --use-compress-program='zstd -d -T0' -xf .build/node_modules_cache/node-modules.tzst + ;; + *) + echo "Usage: $0 {archive|extract}" >&2 + exit 1 + ;; +esac diff --git a/.github/workflows/pr-darwin-test.yml b/.github/workflows/pr-darwin-test.yml index c9622e23a89..c36da018996 100644 --- a/.github/workflows/pr-darwin-test.yml +++ b/.github/workflows/pr-darwin-test.yml @@ -33,19 +33,12 @@ jobs: with: node-version-file: .nvmrc - - name: Prepare node_modules cache key - run: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts darwin $VSCODE_ARCH $(node -p process.arch) > .build/packagelockhash - - name: Restore node_modules cache id: cache-node-modules - uses: actions/cache/restore@v5 + uses: ./.github/actions/restore-node-modules with: - path: .build/node_modules_cache - key: "node_modules-macos-${{ hashFiles('.build/packagelockhash') }}" - - - name: Extract node_modules cache - if: steps.cache-node-modules.outputs.cache-hit == 'true' - run: tar -xzf .build/node_modules_cache/cache.tgz + key-prefix: node_modules-macos + key-args: "darwin ${{ env.VSCODE_ARCH }} $(node -p process.arch)" - name: Install dependencies if: steps.cache-node-modules.outputs.cache-hit != 'true' @@ -75,14 +68,6 @@ jobs: # on macOS. GYP_DEFINES: "kerberos_use_rtld=false" - - name: Create node_modules archive - if: steps.cache-node-modules.outputs.cache-hit != 'true' - run: | - set -e - node build/azure-pipelines/common/listNodeModules.ts .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: Create .build folder run: mkdir -p .build diff --git a/.github/workflows/pr-linux-test.yml b/.github/workflows/pr-linux-test.yml index 665bfd36550..452f974f802 100644 --- a/.github/workflows/pr-linux-test.yml +++ b/.github/workflows/pr-linux-test.yml @@ -55,19 +55,12 @@ jobs: sudo update-rc.d xvfb defaults sudo service xvfb start - - name: Prepare node_modules cache key - run: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts linux $VSCODE_ARCH $(node -p process.arch) > .build/packagelockhash - - name: Restore node_modules cache id: cache-node-modules - uses: actions/cache/restore@v5 + uses: ./.github/actions/restore-node-modules with: - path: .build/node_modules_cache - key: "node_modules-linux-${{ hashFiles('.build/packagelockhash') }}" - - - name: Extract node_modules cache - if: steps.cache-node-modules.outputs.cache-hit == 'true' - run: tar -xzf .build/node_modules_cache/cache.tgz + key-prefix: node_modules-linux + key-args: "linux ${{ env.VSCODE_ARCH }} $(node -p process.arch)" - name: Install build dependencies if: steps.cache-node-modules.outputs.cache-hit != 'true' @@ -108,14 +101,6 @@ jobs: 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.ts .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: Create .build folder run: mkdir -p .build diff --git a/.github/workflows/pr-node-modules.yml b/.github/workflows/pr-node-modules.yml index 1f83561abb1..000c17b3782 100644 --- a/.github/workflows/pr-node-modules.yml +++ b/.github/workflows/pr-node-modules.yml @@ -20,19 +20,12 @@ jobs: with: node-version-file: .nvmrc - - name: Prepare node_modules cache key - run: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts compile $(node -p process.arch) > .build/packagelockhash - - name: Restore node_modules cache id: cache-node-modules - uses: actions/cache@v5 + uses: ./.github/actions/restore-node-modules with: - path: .build/node_modules_cache - key: "node_modules-compile-${{ hashFiles('.build/packagelockhash') }}" - - - name: Extract node_modules cache - if: steps.cache-node-modules.outputs.cache-hit == 'true' - run: tar -xzf .build/node_modules_cache/cache.tgz + key-prefix: node_modules-compile + key-args: "compile $(node -p process.arch)" - name: Install build tools if: steps.cache-node-modules.outputs.cache-hit != 'true' @@ -56,13 +49,9 @@ jobs: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 GITHUB_TOKEN: ${{ secrets.VSCODE_OSS }} - - name: Create node_modules archive + - name: Save node_modules cache if: steps.cache-node-modules.outputs.cache-hit != 'true' - run: | - set -e - node build/azure-pipelines/common/listNodeModules.ts .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 + uses: ./.github/actions/save-node-modules - name: Prepare built-in extensions cache key run: | @@ -99,15 +88,13 @@ jobs: with: node-version-file: .nvmrc - - name: Prepare node_modules cache key - run: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts linux $VSCODE_ARCH $(node -p process.arch) > .build/packagelockhash - - name: Restore node_modules cache id: cache-node-modules - uses: actions/cache@v5 + uses: ./.github/actions/restore-node-modules with: - path: .build/node_modules_cache - key: "node_modules-linux-${{ hashFiles('.build/packagelockhash') }}" + key-prefix: node_modules-linux + key-args: "linux ${{ env.VSCODE_ARCH }} $(node -p process.arch)" + extract: 'false' - name: Install build dependencies if: steps.cache-node-modules.outputs.cache-hit != 'true' @@ -148,13 +135,9 @@ jobs: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 GITHUB_TOKEN: ${{ secrets.VSCODE_OSS }} - - name: Create node_modules archive + - name: Save node_modules cache if: steps.cache-node-modules.outputs.cache-hit != 'true' - run: | - set -e - node build/azure-pipelines/common/listNodeModules.ts .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 + uses: ./.github/actions/save-node-modules macOS: name: macOS @@ -171,15 +154,13 @@ jobs: with: node-version-file: .nvmrc - - name: Prepare node_modules cache key - run: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts darwin $VSCODE_ARCH $(node -p process.arch) > .build/packagelockhash - - name: Restore node_modules cache id: cache-node-modules - uses: actions/cache@v5 + uses: ./.github/actions/restore-node-modules with: - path: .build/node_modules_cache - key: "node_modules-macos-${{ hashFiles('.build/packagelockhash') }}" + key-prefix: node_modules-macos + key-args: "darwin ${{ env.VSCODE_ARCH }} $(node -p process.arch)" + extract: 'false' - name: Install dependencies if: steps.cache-node-modules.outputs.cache-hit != 'true' @@ -209,13 +190,9 @@ jobs: # on macOS. GYP_DEFINES: "kerberos_use_rtld=false" - - name: Create node_modules archive + - name: Save node_modules cache if: steps.cache-node-modules.outputs.cache-hit != 'true' - run: | - set -e - node build/azure-pipelines/common/listNodeModules.ts .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 + uses: ./.github/actions/save-node-modules windows: name: Windows @@ -232,18 +209,13 @@ jobs: 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 + uses: ./.github/actions/restore-node-modules with: - path: .build/node_modules_cache - key: "node_modules-windows-${{ hashFiles('.build/packagelockhash') }}" + key-prefix: node_modules-windows + key-args: "win32 ${{ env.VSCODE_ARCH }} $(node -p process.arch)" + extract: 'false' - name: Install dependencies if: steps.node-modules-cache.outputs.cache-hit != 'true' @@ -273,12 +245,70 @@ jobs: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 GITHUB_TOKEN: ${{ secrets.VSCODE_OSS }} - - name: Create node_modules archive + - name: Save node_modules cache 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 } + uses: ./.github/actions/save-node-modules + + copilot-linux: + name: Copilot (Linux) + runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-ubuntu-22.04-x64, "JobId=copilot-linux-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" ] + steps: + - name: Checkout microsoft/vscode + uses: actions/checkout@v6 + + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version-file: extensions/copilot/.nvmrc + + - name: Restore node_modules cache + id: cache-node-modules + uses: ./.github/actions/restore-node-modules + with: + key-prefix: copilot-node_modules-linux + key-args: "$(node -p process.platform) $(node -p process.arch)" + + - name: Install root dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' + run: npm ci --ignore-scripts --no-workspaces + + - name: Install copilot dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' + working-directory: extensions/copilot + run: npm ci + + - name: Save node_modules cache + if: steps.cache-node-modules.outputs.cache-hit != 'true' + uses: ./.github/actions/save-node-modules + + copilot-windows: + name: Copilot (Windows) + runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-windows-2022-x64, "JobId=copilot-windows-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" ] + steps: + - name: Checkout microsoft/vscode + uses: actions/checkout@v6 + + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version-file: extensions/copilot/.nvmrc + + - name: Restore node_modules cache + id: cache-node-modules + uses: ./.github/actions/restore-node-modules + with: + key-prefix: copilot-node_modules-windows + key-args: "$(node -p process.platform) $(node -p process.arch)" + + - name: Install root dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' + run: npm ci --ignore-scripts --no-workspaces + + - name: Install copilot dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' + working-directory: extensions/copilot + run: npm ci + + - name: Save node_modules cache + if: steps.cache-node-modules.outputs.cache-hit != 'true' + uses: ./.github/actions/save-node-modules diff --git a/.github/workflows/pr-win32-test.yml b/.github/workflows/pr-win32-test.yml index fbd1479b6af..a1255348f21 100644 --- a/.github/workflows/pr-win32-test.yml +++ b/.github/workflows/pr-win32-test.yml @@ -33,26 +33,15 @@ jobs: 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/restore@v5 - id: node-modules-cache + id: cache-node-modules + uses: ./.github/actions/restore-node-modules with: - path: .build/node_modules_cache - key: "node_modules-windows-${{ hashFiles('.build/packagelockhash') }}" - - - name: Extract node_modules cache - if: steps.node-modules-cache.outputs.cache-hit == 'true' - shell: pwsh - run: 7z.exe x .build/node_modules_cache/cache.7z -aoa + key-prefix: node_modules-windows + key-args: "win32 ${{ env.VSCODE_ARCH }} $(node -p process.arch)" - name: Install dependencies - if: steps.node-modules-cache.outputs.cache-hit != 'true' + if: steps.cache-node-modules.outputs.cache-hit != 'true' shell: pwsh run: | . build/azure-pipelines/win32/exec.ps1 @@ -84,16 +73,6 @@ jobs: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - 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 } - - name: Create .build folder shell: pwsh run: mkdir .build -ea 0 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d6e29e867dd..96fb9a707d1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -31,19 +31,12 @@ jobs: with: node-version-file: .nvmrc - - name: Prepare node_modules cache key - run: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts compile $(node -p process.arch) > .build/packagelockhash - - name: Restore node_modules cache id: cache-node-modules - uses: actions/cache/restore@v5 + uses: ./.github/actions/restore-node-modules with: - path: .build/node_modules_cache - key: "node_modules-compile-${{ hashFiles('.build/packagelockhash') }}" - - - name: Extract node_modules cache - if: steps.cache-node-modules.outputs.cache-hit == 'true' - run: tar -xzf .build/node_modules_cache/cache.tgz + key-prefix: node_modules-compile + key-args: "compile $(node -p process.arch)" - name: Install build tools if: steps.cache-node-modules.outputs.cache-hit != 'true' @@ -67,14 +60,6 @@ jobs: 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.ts .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: Type check /build/ scripts run: npm run typecheck working-directory: build @@ -191,20 +176,19 @@ jobs: with: node-version-file: extensions/copilot/.nvmrc - - name: Restore build cache - uses: actions/cache/restore@v5 - id: build-cache + - name: Restore node_modules cache + id: cache-node-modules + uses: ./.github/actions/restore-node-modules with: - key: copilot-build_cache-${{ hashFiles('extensions/copilot/build/.cachesalt', 'extensions/copilot/package-lock.json') }} - path: extensions/copilot/.build/build_cache + key-prefix: copilot-node_modules-linux + key-args: "$(node -p process.platform) $(node -p process.arch)" - - name: Extract build cache - if: steps.build-cache.outputs.cache-hit == 'true' - working-directory: extensions/copilot - run: tar -xzf .build/build_cache/cache.tgz + - name: Install root dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' + run: npm ci --ignore-scripts --no-workspaces - - name: Install dependencies - if: steps.build-cache.outputs.cache-hit != 'true' + - name: Install copilot dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' working-directory: extensions/copilot run: npm ci @@ -275,36 +259,22 @@ jobs: sudo apt-get update sudo apt-get install -y xvfb libgtk-3-0 libgbm1 - - name: Restore build cache - uses: actions/cache/restore@v5 - id: build-cache + - name: Restore node_modules cache + id: cache-node-modules + uses: ./.github/actions/restore-node-modules with: - key: copilot-build_cache-${{ hashFiles('extensions/copilot/build/.cachesalt', 'extensions/copilot/package-lock.json') }} - path: extensions/copilot/.build/build_cache - - - name: Extract build cache - if: steps.build-cache.outputs.cache-hit == 'true' - working-directory: extensions/copilot - run: tar -xzf .build/build_cache/cache.tgz + key-prefix: copilot-node_modules-linux + key-args: "$(node -p process.platform) $(node -p process.arch)" - name: Install root dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' run: npm ci --ignore-scripts --no-workspaces - - name: Install dependencies - if: steps.build-cache.outputs.cache-hit != 'true' + - name: Install copilot dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' working-directory: extensions/copilot run: npm ci - - name: Create build cache archive - if: steps.build-cache.outputs.cache-hit != 'true' - working-directory: extensions/copilot - run: | - set -e - mkdir -p .build - node build/listBuildCacheFiles.js .build/build_cache_list.txt - mkdir -p .build/build_cache - tar -czf .build/build_cache/cache.tgz --files-from .build/build_cache_list.txt - - name: TypeScript type checking working-directory: extensions/copilot run: npm run typecheck @@ -378,35 +348,22 @@ jobs: - name: Install setuptools run: pip install setuptools - - name: Restore build cache - uses: actions/cache/restore@v5 - id: build-cache + - name: Restore node_modules cache + id: cache-node-modules + uses: ./.github/actions/restore-node-modules with: - key: copilot-windows-build_cache-${{ hashFiles('extensions/copilot/build/.cachesalt', 'extensions/copilot/package-lock.json') }} - path: extensions/copilot/.build/build_cache - - - name: Extract build cache - if: steps.build-cache.outputs.cache-hit == 'true' - working-directory: extensions/copilot - run: 7z.exe x .build/build_cache/cache.7z -aoa + key-prefix: copilot-node_modules-windows + key-args: "$(node -p process.platform) $(node -p process.arch)" - name: Install root dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' run: npm ci --ignore-scripts --no-workspaces - - name: Install dependencies - if: steps.build-cache.outputs.cache-hit != 'true' + - name: Install copilot dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' working-directory: extensions/copilot run: npm ci - - name: Create build cache archive - if: steps.build-cache.outputs.cache-hit != 'true' - working-directory: extensions/copilot - run: | - mkdir -Force .build - node build/listBuildCacheFiles.js .build/build_cache_list.txt - mkdir -Force .build/build_cache - 7z.exe a .build/build_cache/cache.7z -mx3 `@.build/build_cache_list.txt - - name: TypeScript type checking working-directory: extensions/copilot run: npm run typecheck diff --git a/build/.cachesalt b/build/.cachesalt index 57519bc2df2..df1d8c82aab 100644 --- a/build/.cachesalt +++ b/build/.cachesalt @@ -1 +1 @@ -2026-05-27T16:21:42.961Z +2026-06-19T12:30:00.000Z diff --git a/build/azure-pipelines/common/computeNodeModulesCacheKey.ts b/build/azure-pipelines/common/computeNodeModulesCacheKey.ts index 0dbe8b1b421..e5dbc06aa94 100644 --- a/build/azure-pipelines/common/computeNodeModulesCacheKey.ts +++ b/build/azure-pipelines/common/computeNodeModulesCacheKey.ts @@ -12,7 +12,6 @@ const ROOT = path.join(import.meta.dirname, '../../../'); const shasum = crypto.createHash('sha256'); shasum.update(fs.readFileSync(path.join(ROOT, 'build/.cachesalt'))); -shasum.update(fs.readFileSync(path.join(ROOT, 'extensions/copilot/build/.cachesalt'))); // TODO: remove this one when all build scripts are cleaned up shasum.update(fs.readFileSync(path.join(ROOT, '.npmrc'))); shasum.update(fs.readFileSync(path.join(ROOT, 'build', '.npmrc'))); shasum.update(fs.readFileSync(path.join(ROOT, 'remote', '.npmrc'))); diff --git a/extensions/copilot/.github/workflows/copilot-setup-steps.yml b/extensions/copilot/.github/workflows/copilot-setup-steps.yml deleted file mode 100644 index 1c99b58e538..00000000000 --- a/extensions/copilot/.github/workflows/copilot-setup-steps.yml +++ /dev/null @@ -1,72 +0,0 @@ -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: - copilot-setup-steps: - name: Setup Development Environment - runs-on: vscode-large-runners - steps: - - name: Checkout repository - uses: actions/checkout@v6 - with: - lfs: true - - - name: Setup Node.js - uses: actions/setup-node@v6 - with: - node-version-file: .nvmrc - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: '3.12' - architecture: 'x64' - - - name: Setup .NET - uses: actions/setup-dotnet@v5 - with: - dotnet-version: '10.0' - - - name: Install setuptools - run: pip install setuptools - - - name: Restore build cache - uses: actions/cache/restore@v5 - id: build-cache - with: - key: build_cache-${{ hashFiles('build/.cachesalt', 'package-lock.json') }} - path: .build/build_cache - - - name: Extract build cache - if: steps.build-cache.outputs.cache-hit == 'true' - run: tar -xzf .build/build_cache/cache.tgz - - - name: Install dependencies - if: steps.build-cache.outputs.cache-hit != 'true' - run: npm ci - - - name: Create build cache archive - if: steps.build-cache.outputs.cache-hit != 'true' - run: | - set -e - mkdir -p .build - node build/listBuildCacheFiles.js .build/build_cache_list.txt - mkdir -p .build/build_cache - tar -czf .build/build_cache/cache.tgz --files-from .build/build_cache_list.txt - - - name: Verify installation - run: | - node --version - npm --version - python --version - dotnet --version \ No newline at end of file diff --git a/extensions/copilot/.github/workflows/ensure-node-modules-cache.yml b/extensions/copilot/.github/workflows/ensure-node-modules-cache.yml deleted file mode 100644 index a82dab5344b..00000000000 --- a/extensions/copilot/.github/workflows/ensure-node-modules-cache.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Ensure node modules cache - -on: - push: - branches: - - main - -permissions: - contents: read - -jobs: - linux: - name: Linux - runs-on: [ self-hosted, 1ES.Pool=1es-vscode-ubuntu-22.04-x64 ] - steps: - - name: Checkout repository - uses: actions/checkout@v6 - with: - lfs: true - - - name: Setup Node.js - uses: actions/setup-node@v6 - with: - node-version-file: .nvmrc - - - name: Restore build cache - uses: actions/cache@v5 - id: build-cache - with: - key: build_cache-${{ hashFiles('build/.cachesalt', 'package-lock.json') }} - path: .build/build_cache - - - name: Install dependencies - if: steps.build-cache.outputs.cache-hit != 'true' - run: npm ci - - - name: Create build cache archive - if: steps.build-cache.outputs.cache-hit != 'true' - run: | - set -e - mkdir -p .build - node build/listBuildCacheFiles.js .build/build_cache_list.txt - mkdir -p .build/build_cache - tar -czf .build/build_cache/cache.tgz --files-from .build/build_cache_list.txt - - windows: - name: Windows - runs-on: [ self-hosted, 1ES.Pool=1es-vscode-windows-2022-x64 ] - steps: - - name: Checkout repository - uses: actions/checkout@v6 - with: - lfs: true - - - name: Setup Node.js - uses: actions/setup-node@v6 - with: - node-version: '22.21.x' - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: '3.12' - architecture: 'x64' - - - name: Restore build cache - uses: actions/cache@v5 - id: build-cache - with: - key: windows-build_cache-${{ hashFiles('build/.cachesalt', 'package-lock.json') }} - path: .build/build_cache - - - name: Install dependencies - if: steps.build-cache.outputs.cache-hit != 'true' - run: npm ci - - - name: Create build cache archive - if: steps.build-cache.outputs.cache-hit != 'true' - run: | - mkdir -Force .build - node build/listBuildCacheFiles.js .build/build_cache_list.txt - mkdir -Force .build/build_cache - 7z.exe a .build/build_cache/cache.7z -mx3 `@.build/build_cache_list.txt diff --git a/extensions/copilot/.github/workflows/pr.yml b/extensions/copilot/.github/workflows/pr.yml deleted file mode 100644 index 8bb30f5ae88..00000000000 --- a/extensions/copilot/.github/workflows/pr.yml +++ /dev/null @@ -1,235 +0,0 @@ -name: PR Checks - -on: - push: - branches: - - 'gh-readonly-queue/main/*' - pull_request: - branches: - - main - - 'release/*' - -permissions: - contents: read - pull-requests: read - -jobs: - check-test-cache: - name: Check test cache - runs-on: ubuntu-22.04 - steps: - - name: Checkout code - uses: actions/checkout@v6 - with: - lfs: true - - - uses: actions/setup-node@v6 - with: - node-version-file: .nvmrc - - - name: Restore build cache - uses: actions/cache/restore@v5 - id: build-cache - with: - key: build_cache-${{ hashFiles('build/.cachesalt', 'package-lock.json') }} - path: .build/build_cache - - - name: Extract build cache - if: steps.build-cache.outputs.cache-hit == 'true' - run: tar -xzf .build/build_cache/cache.tgz - - - name: Install dependencies - if: steps.build-cache.outputs.cache-hit != 'true' - run: npm ci - - - name: Ensure no duplicate cache keys - run: npx tsx test/base/cache-cli check - - - name: Ensure no untrusted cache changes - run: npx tsx build/pr-check-cache-files.ts - if: github.event_name == 'pull_request' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPOSITORY: ${{ github.repository }} - PULL_REQUEST: ${{ github.event.pull_request.number }} - - check-telemetry: - name: Check telemetry events - runs-on: ubuntu-22.04 - steps: - - name: Checkout code - uses: actions/checkout@v6 - with: - lfs: true - - - uses: actions/setup-node@v6 - with: - node-version-file: .nvmrc - - - name: Validate telemetry events - run: npx --package=@vscode/telemetry-extractor --yes vscode-telemetry-extractor -s . > /dev/null - - linux-tests: - name: Test (Linux) - runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@v6 - with: - lfs: true - - - name: Setup Node.js - uses: actions/setup-node@v6 - with: - node-version-file: .nvmrc - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: '3.12' - architecture: 'x64' - - - name: Setup .NET - uses: actions/setup-dotnet@v5 - with: - dotnet-version: '10.0' - - - name: Install setuptools - run: pip install setuptools - - - name: Restore build cache - uses: actions/cache/restore@v5 - id: build-cache - with: - key: build_cache-${{ hashFiles('build/.cachesalt', 'package-lock.json') }} - path: .build/build_cache - - - name: Extract build cache - if: steps.build-cache.outputs.cache-hit == 'true' - run: tar -xzf .build/build_cache/cache.tgz - - - name: Install dependencies - if: steps.build-cache.outputs.cache-hit != 'true' - run: npm ci - - - name: Create build cache archive - if: steps.build-cache.outputs.cache-hit != 'true' - run: | - set -e - mkdir -p .build - node build/listBuildCacheFiles.js .build/build_cache_list.txt - mkdir -p .build/build_cache - tar -czf .build/build_cache/cache.tgz --files-from .build/build_cache_list.txt - - - name: TypeScript type checking - run: npm run typecheck - - - name: Lint - run: npm run lint - - - name: Compile - run: npm run compile - - - name: Run vitest unit tests - run: npm run test:unit - - - name: Run simulation tests with cache - run: npm run simulate-ci - - - name: Run extension tests using VS Code - run: xvfb-run -a npm run test:extension - - - name: Run Completions Core prompt tests - run: npm run test:prompt - - - name: Run Completions Core lib tests using VS Code - run: xvfb-run -a npm run test:completions-core - - - name: Archive simulation output - if: always() - run: | - set -e - mkdir -p .simulation-archive - tar -czf .simulation-archive/simulation.tgz -C .simulation . - - - name: Upload simulation output - if: always() - uses: actions/upload-artifact@v7 - with: - name: simulation-output-linux-${{ github.run_attempt }} - path: .simulation-archive/simulation.tgz - - windows-tests: - name: Test (Windows) - runs-on: windows-latest - steps: - - name: Checkout repository - uses: actions/checkout@v6 - with: - lfs: true - - - name: Setup Node.js - uses: actions/setup-node@v6 - with: - node-version-file: .nvmrc - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: '3.12' - architecture: 'x64' - - - name: Setup .NET - uses: actions/setup-dotnet@v5 - with: - dotnet-version: '10.0' - - - name: Install setuptools - run: pip install setuptools - - - name: Restore build cache - uses: actions/cache/restore@v5 - id: build-cache - with: - key: windows-build_cache-${{ hashFiles('build/.cachesalt', 'package-lock.json') }} - path: .build/build_cache - - - name: Extract build cache - if: steps.build-cache.outputs.cache-hit == 'true' - run: 7z.exe x .build/build_cache/cache.7z -aoa - - - name: Install dependencies - if: steps.build-cache.outputs.cache-hit != 'true' - run: npm ci - - - name: Create build cache archive - if: steps.build-cache.outputs.cache-hit != 'true' - run: | - mkdir -Force .build - node build/listBuildCacheFiles.js .build/build_cache_list.txt - mkdir -Force .build/build_cache - 7z.exe a .build/build_cache/cache.7z -mx3 `@.build/build_cache_list.txt - - - name: TypeScript type checking - run: npm run typecheck - - - name: Lint - run: npm run lint - - - name: Compile - run: npm run compile - - - name: Run vitest unit tests - run: npm run test:unit - - - name: Run simulation tests with cache - run: npm run simulate-ci - - - name: Run extension tests using VS Code - run: npm run test:extension - - - name: Run Completions Core prompt tests - run: npm run test:prompt - - - name: Run Completions Core lib tests using VS Code - run: npm run test:completions-core diff --git a/extensions/copilot/build/.cachesalt b/extensions/copilot/build/.cachesalt deleted file mode 100644 index 08be458a78b..00000000000 --- a/extensions/copilot/build/.cachesalt +++ /dev/null @@ -1 +0,0 @@ -2026-06-06T10:06:34.000Z diff --git a/extensions/copilot/build/listBuildCacheFiles.js b/extensions/copilot/build/listBuildCacheFiles.js deleted file mode 100644 index 8cb1797e583..00000000000 --- a/extensions/copilot/build/listBuildCacheFiles.js +++ /dev/null @@ -1,48 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -//@ts-check -'use strict'; - -const fs = require('fs'); -const path = require('path'); - -if (process.argv.length !== 3) { - console.error('Usage: node listBuildCacheFiles.js OUTPUT_FILE'); - process.exit(-1); -} - -const ROOT = path.join(__dirname, '../'); - -/** - * @param {string} location - * @param {string[]} result - */ -function listAllFiles(location, result) { - const entries = fs.readdirSync(path.join(ROOT, location)); - for (const entry of entries) { - const entryPath = `${location}/${entry}`; - - /** @type {import('fs').Stats} */ - let stat; - try { - stat = fs.statSync(path.join(ROOT, entryPath)); - } catch (err) { - continue; - } - - if (stat.isDirectory()) { - listAllFiles(entryPath, result); - } else { - result.push(entryPath); - } - } -} - -/** @type {string[]} */ -const result = []; -listAllFiles('node_modules', result); // node modules -listAllFiles('dist', result); // contains wasm files -fs.writeFileSync(process.argv[2], result.join('\n') + '\n');