Files
vscode/.github/workflows/pr.yml
Alexandru Dima 044134364a ci: split Electron PR test jobs into unit/integration and smoke (#322145)
* ci: split Electron test jobs into unit/integration and smoke

The Linux, Windows and macOS Electron PR test jobs are the slowest in CI,
dominated by the smoke test run. Split each into two parallel jobs - one
running unit + integration tests, the other running smoke tests - to cut
wall-clock time.

Done via two new parameters on the reusable workflows
(unit_and_integration_tests and smoke_tests, both defaulting to true) so
Browser and Remote jobs are unchanged. Artifact names get a -smoke suffix
on the smoke-only job to avoid upload collisions.

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

* ci: gate build and diagnostics to correct Electron test phase

Follow-up to the Electron job split. Ensure each half only does the work
it needs:

- Gate "Build integration tests" on unit_and_integration_tests so the
  smoke-only job skips it.
- Scope the before/after diagnostics steps to their phase (combined with
  always()) so they don't run in the wrong job.
- Move the Copilot extension build into the smoke phase (gated on
  smoke_tests) instead of compiling it unconditionally; align Linux,
  Windows and macOS on the same ordering.

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

* ci: drop space and parens from Electron-Smoke job name

The Windows 1ES runner builds its JobId label from job_name, producing
"windows-test-Electron (Smoke)-...". The space and parentheses prevented
the runner from picking up the job. Rename the smoke job to Electron-Smoke
on all three platforms so the JobId is a plain slug.

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

* Fixes

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-19 23:40:20 +02:00

423 lines
12 KiB
YAML

name: Code OSS
on:
pull_request:
branches:
- main
- 'release/*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
VSCODE_QUALITY: 'oss'
jobs:
compile:
name: Compile & Hygiene
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-ubuntu-22.04-x64, "JobId=compile-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" ]
steps:
- name: Checkout microsoft/vscode
uses: actions/checkout@v6
with:
lfs: true
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
- name: Restore node_modules cache
id: cache-node-modules
uses: ./.github/actions/restore-node-modules
with:
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'
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: Type check /build/ scripts
run: npm run typecheck
working-directory: build
- name: Prepare built-in extensions cache key
shell: pwsh
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: Compile & Hygiene
run: npm exec -- npm-run-all2 -lp core-ci hygiene eslint valid-layers-check define-class-fields-check vscode-dts-compile-check tsec-compile-check test-build-scripts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check cyclic dependencies
run: node build/lib/checkCyclicDependencies.ts out-build
linux-cli-tests:
name: Linux
uses: ./.github/workflows/pr-linux-cli-test.yml
with:
job_name: CLI
rustup_toolchain: 1.88
linux-electron-tests:
name: Linux
uses: ./.github/workflows/pr-linux-test.yml
with:
job_name: Electron
electron_tests: true
smoke_tests: false
linux-electron-smoke-tests:
name: Linux
uses: ./.github/workflows/pr-linux-test.yml
with:
job_name: Electron-Smoke
electron_tests: true
unit_and_integration_tests: false
linux-browser-tests:
name: Linux
uses: ./.github/workflows/pr-linux-test.yml
with:
job_name: Browser
browser_tests: true
linux-remote-tests:
name: Linux
uses: ./.github/workflows/pr-linux-test.yml
with:
job_name: Remote
remote_tests: true
macos-electron-tests:
name: macOS
uses: ./.github/workflows/pr-darwin-test.yml
with:
job_name: Electron
electron_tests: true
smoke_tests: false
macos-electron-smoke-tests:
name: macOS
uses: ./.github/workflows/pr-darwin-test.yml
with:
job_name: Electron-Smoke
electron_tests: true
unit_and_integration_tests: false
macos-browser-tests:
name: macOS
uses: ./.github/workflows/pr-darwin-test.yml
with:
job_name: Browser
browser_tests: true
macos-remote-tests:
name: macOS
uses: ./.github/workflows/pr-darwin-test.yml
with:
job_name: Remote
remote_tests: true
windows-electron-tests:
name: Windows
uses: ./.github/workflows/pr-win32-test.yml
with:
job_name: Electron
electron_tests: true
smoke_tests: false
windows-electron-smoke-tests:
name: Windows
uses: ./.github/workflows/pr-win32-test.yml
with:
job_name: Electron-Smoke
electron_tests: true
unit_and_integration_tests: false
windows-browser-tests:
name: Windows
uses: ./.github/workflows/pr-win32-test.yml
with:
job_name: Browser
browser_tests: true
windows-remote-tests:
name: Windows
uses: ./.github/workflows/pr-win32-test.yml
with:
job_name: Remote
remote_tests: true
copilot-check-test-cache:
name: Copilot - Check Test Cache
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-ubuntu-22.04-x64, "JobId=copilot-check-test-cache-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" ]
permissions:
contents: read
pull-requests: read
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
lfs: true
- 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: Ensure no duplicate cache keys
working-directory: extensions/copilot
run: npx tsx test/base/cache-cli check
- name: Ensure no untrusted cache changes
if: github.event_name == 'pull_request'
working-directory: extensions/copilot
run: npx tsx build/pr-check-cache-files.ts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ github.repository }}
PULL_REQUEST: ${{ github.event.pull_request.number }}
copilot-check-telemetry:
name: Copilot - Check Telemetry
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-ubuntu-22.04-x64, "JobId=copilot-check-telemetry-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" ]
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
lfs: true
- uses: actions/setup-node@v6
with:
node-version-file: extensions/copilot/.nvmrc
- name: Validate telemetry events
working-directory: extensions/copilot
run: npx --package=@vscode/telemetry-extractor --yes vscode-telemetry-extractor -s . > /dev/null
copilot-linux-tests:
name: Copilot - Test (Linux)
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-ubuntu-22.04-x64, "JobId=copilot-linux-tests-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" ]
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
lfs: true
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: extensions/copilot/.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: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y xvfb libgtk-3-0 libgbm1
- 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: TypeScript type checking
working-directory: extensions/copilot
run: npm run typecheck
- name: Lint
working-directory: extensions/copilot
run: npm run lint
- name: Compile
working-directory: extensions/copilot
run: npm run compile
- name: Run vitest unit tests
working-directory: extensions/copilot
run: npm run test:unit
- name: Run simulation tests with cache
working-directory: extensions/copilot
run: npm run simulate-ci
- name: Run Completions Core prompt tests
working-directory: extensions/copilot
run: npm run test:prompt
- name: Run Completions Core lib tests using VS Code
working-directory: extensions/copilot
run: xvfb-run -a npm run test:completions-core
- name: Archive simulation output
if: always()
working-directory: extensions/copilot
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: copilot-simulation-output-linux-${{ github.run_attempt }}
path: extensions/copilot/.simulation-archive/simulation.tgz
copilot-windows-tests:
name: Copilot - Test (Windows)
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-windows-2022-x64, "JobId=copilot-windows-tests-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" ]
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
lfs: true
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: extensions/copilot/.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 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: TypeScript type checking
working-directory: extensions/copilot
run: npm run typecheck
- name: Lint
working-directory: extensions/copilot
run: npm run lint
- name: Compile
working-directory: extensions/copilot
run: npm run compile
- name: Run vitest unit tests
working-directory: extensions/copilot
run: npm run test:unit
- name: Run simulation tests with cache
working-directory: extensions/copilot
run: npm run simulate-ci
- name: Run Completions Core prompt tests
working-directory: extensions/copilot
run: npm run test:prompt
- name: Run Completions Core lib tests using VS Code
working-directory: extensions/copilot
run: npm run test:completions-core