mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-23 23:56:09 +01:00
Make the Windows Electron download retry actually retry
The step wraps the download in a 3-attempt loop, but the retry never
fired. `npm exec` is a native command, and a non-zero exit code from a
native command does not raise a terminating error in PowerShell, so the
`catch` block was unreachable: the first attempt fell through to `break`
and the step then failed on the non-zero exit code.
Wrap the call in `exec { }` from build/azure-pipelines/win32/exec.ps1,
which checks $lastexitcode and throws. This is the same shape the `npm
ci` retry in this file already uses, and it is why that one works.
Seen on a PR run where a transient socket close while fetching Electron
from github.com failed the job on the first attempt, with no retry:
TypeError: fetch failed
cause: SocketError: other side closed (UND_ERR_SOCKET)
at @vscode/gulp-electron/src/download.js
The Linux and macOS workflows are unaffected: their loops use
`if npm exec ...; then`, which tests the exit code directly.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3c35355f-4d36-46e5-8d7a-cb0bc7207449
290 lines
10 KiB
YAML
290 lines
10 KiB
YAML
on:
|
|
workflow_call:
|
|
inputs:
|
|
job_name:
|
|
type: string
|
|
required: true
|
|
electron_tests:
|
|
type: boolean
|
|
default: false
|
|
browser_tests:
|
|
type: boolean
|
|
default: false
|
|
remote_tests:
|
|
type: boolean
|
|
default: false
|
|
unit_and_integration_tests:
|
|
type: boolean
|
|
default: true
|
|
smoke_tests:
|
|
type: boolean
|
|
default: true
|
|
|
|
jobs:
|
|
windows-test:
|
|
name: ${{ inputs.job_name }}
|
|
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-windows-2022-x64, "JobId=windows-test-${{ inputs.job_name }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" ]
|
|
env:
|
|
ARTIFACT_NAME: ${{ (inputs.electron_tests && 'electron') || (inputs.browser_tests && 'browser') || (inputs.remote_tests && 'remote') || 'unknown' }}${{ (!inputs.unit_and_integration_tests && inputs.smoke_tests) && '-smoke' || '' }}
|
|
NPM_ARCH: x64
|
|
VSCODE_ARCH: x64
|
|
steps:
|
|
- name: Checkout microsoft/vscode
|
|
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
|
with:
|
|
lfs: true
|
|
|
|
- name: Detect Agent Host E2E changes
|
|
if: ${{ inputs.electron_tests && inputs.unit_and_integration_tests }}
|
|
id: agent-host-e2e-changes
|
|
uses: ./.github/actions/detect-agent-host-e2e-changes
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
|
|
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-windows
|
|
key-args: "win32 ${{ env.VSCODE_ARCH }} $(node -p process.arch)"
|
|
|
|
- name: Install dependencies
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
shell: pwsh
|
|
run: |
|
|
. build/azure-pipelines/win32/exec.ps1
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
# Run preinstall script before root dependencies are installed
|
|
# so that Electron/v8 headers are patched correctly for native modules.
|
|
exec { node build/npm/preinstall.ts }
|
|
|
|
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.GITHUB_TOKEN }}
|
|
|
|
- name: Create .build folder
|
|
shell: pwsh
|
|
run: mkdir .build -ea 0
|
|
|
|
- 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@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
|
|
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: Transpile client and extensions
|
|
shell: pwsh
|
|
run: npm run gulp "transpile-client-esbuild" "transpile-extensions"
|
|
|
|
- name: Download Electron and Playwright
|
|
shell: pwsh
|
|
run: |
|
|
. build/azure-pipelines/win32/exec.ps1
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
for ($i = 1; $i -le 3; $i++) {
|
|
try {
|
|
exec { npm exec -- npm-run-all2 -lp "electron ${{ env.VSCODE_ARCH }}" "playwright-install" }
|
|
break
|
|
}
|
|
catch {
|
|
if ($i -eq 3) {
|
|
Write-Error "Download failed after 3 attempts"
|
|
throw
|
|
}
|
|
Write-Host "Download failed attempt $i, retrying..."
|
|
Start-Sleep -Seconds 2
|
|
}
|
|
}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: 🧪 Run unit tests (Electron)
|
|
if: ${{ inputs.electron_tests && inputs.unit_and_integration_tests }}
|
|
timeout-minutes: 15
|
|
shell: pwsh
|
|
run: .\scripts\test.bat --tfs "Unit Tests"
|
|
env:
|
|
VSCODE_SKIP_PRELAUNCH: '1'
|
|
|
|
- name: 🧪 Run unit tests (node.js)
|
|
if: ${{ inputs.electron_tests && inputs.unit_and_integration_tests }}
|
|
timeout-minutes: 15
|
|
shell: pwsh
|
|
run: npm run test-node
|
|
|
|
- name: 🧪 Run unit tests (Browser, Chromium)
|
|
if: ${{ inputs.browser_tests && inputs.unit_and_integration_tests }}
|
|
timeout-minutes: 20
|
|
shell: pwsh
|
|
run: node test/unit/browser/index.js --browser chromium --tfs "Browser Unit Tests"
|
|
env:
|
|
DEBUG: "*browser*"
|
|
|
|
- name: Compile extensions for integration tests & smoke tests
|
|
shell: pwsh
|
|
run: |
|
|
. build/azure-pipelines/win32/exec.ps1
|
|
$ErrorActionPreference = "Stop"
|
|
exec { npm run gulp `
|
|
compile-extension:configuration-editing `
|
|
compile-extension:css-language-features-server `
|
|
compile-extension:emmet `
|
|
compile-extension:git `
|
|
compile-extension:github-authentication `
|
|
compile-extension:html-language-features-server `
|
|
compile-extension:ipynb `
|
|
compile-extension:notebook-renderers `
|
|
compile-extension:json-language-features-server `
|
|
compile-extension:markdown-language-features `
|
|
compile-extension-media `
|
|
compile-extension:microsoft-authentication `
|
|
compile-extension:typescript-language-features `
|
|
compile-extension:vscode-api-tests `
|
|
compile-extension:vscode-colorize-tests `
|
|
compile-extension:vscode-colorize-perf-tests `
|
|
compile-extension:vscode-test-resolver `
|
|
}
|
|
|
|
- name: Diagnostics before integration test runs
|
|
if: ${{ inputs.unit_and_integration_tests && always() }}
|
|
shell: pwsh
|
|
run: .\build\azure-pipelines\win32\listprocesses.bat
|
|
continue-on-error: true
|
|
|
|
- name: 🧪 Run integration tests (Electron)
|
|
if: ${{ inputs.electron_tests && inputs.unit_and_integration_tests }}
|
|
timeout-minutes: 20
|
|
shell: pwsh
|
|
run: .\scripts\test-integration.bat --tfs "Integration Tests"
|
|
env:
|
|
VSCODE_SKIP_AGENT_HOST_E2E: ${{ steps.agent-host-e2e-changes.outputs.affected == 'false' && '1' || '0' }}
|
|
VSCODE_SKIP_PRELAUNCH: '1'
|
|
|
|
- name: 🧪 Run integration tests (Browser, Chromium)
|
|
if: ${{ inputs.browser_tests && inputs.unit_and_integration_tests }}
|
|
timeout-minutes: 20
|
|
shell: pwsh
|
|
run: .\scripts\test-web-integration.bat --browser chromium
|
|
|
|
- name: 🧪 Run integration tests (Remote)
|
|
if: ${{ inputs.remote_tests && inputs.unit_and_integration_tests }}
|
|
timeout-minutes: 20
|
|
shell: pwsh
|
|
run: .\scripts\test-remote-integration.bat
|
|
env:
|
|
VSCODE_SKIP_PRELAUNCH: '1'
|
|
|
|
- name: Diagnostics after integration test runs
|
|
if: ${{ inputs.unit_and_integration_tests && always() }}
|
|
shell: pwsh
|
|
run: .\build\azure-pipelines\win32\listprocesses.bat
|
|
continue-on-error: true
|
|
|
|
|
|
- name: Compile smoke tests
|
|
if: ${{ inputs.smoke_tests }}
|
|
working-directory: test/smoke
|
|
shell: pwsh
|
|
run: npm run compile
|
|
|
|
- name: Compile Copilot Chat extension for smoke tests
|
|
if: ${{ inputs.smoke_tests }}
|
|
working-directory: extensions/copilot
|
|
run: npm run compile
|
|
|
|
- name: Diagnostics before smoke test run
|
|
if: ${{ inputs.smoke_tests && always() }}
|
|
shell: pwsh
|
|
run: .\build\azure-pipelines\win32\listprocesses.bat
|
|
continue-on-error: true
|
|
|
|
- name: 🧪 Run smoke tests (Electron)
|
|
if: ${{ inputs.electron_tests && inputs.smoke_tests }}
|
|
timeout-minutes: 20
|
|
shell: pwsh
|
|
run: npm run smoketest-no-compile -- --tracing
|
|
|
|
- name: 🧪 Run smoke tests (Browser, Chromium)
|
|
if: ${{ inputs.browser_tests && inputs.smoke_tests }}
|
|
timeout-minutes: 20
|
|
shell: pwsh
|
|
run: npm run smoketest-no-compile -- --web --tracing --headless
|
|
|
|
- name: 🧪 Run smoke tests (Remote)
|
|
if: ${{ inputs.remote_tests && inputs.smoke_tests }}
|
|
timeout-minutes: 20
|
|
shell: pwsh
|
|
run: npm run smoketest-no-compile -- --remote --tracing
|
|
|
|
- name: Diagnostics after smoke test run
|
|
if: ${{ inputs.smoke_tests && always() }}
|
|
shell: pwsh
|
|
run: .\build\azure-pipelines\win32\listprocesses.bat
|
|
continue-on-error: true
|
|
|
|
- name: Publish Crash Reports
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
if: failure()
|
|
continue-on-error: true
|
|
with:
|
|
name: ${{ format('crash-dump-windows-{0}-{1}-{2}', env.VSCODE_ARCH, env.ARTIFACT_NAME, github.run_attempt) }}
|
|
path: .build/crashes
|
|
if-no-files-found: ignore
|
|
|
|
# In order to properly symbolify above crash reports
|
|
# (if any), we need the compiled native modules too
|
|
- name: Publish Node Modules
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
if: failure()
|
|
continue-on-error: true
|
|
with:
|
|
name: ${{ format('node-modules-windows-{0}-{1}-{2}', env.VSCODE_ARCH, env.ARTIFACT_NAME, github.run_attempt) }}
|
|
path: node_modules
|
|
if-no-files-found: ignore
|
|
|
|
- name: Publish Log Files
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
if: always()
|
|
continue-on-error: true
|
|
with:
|
|
name: ${{ format('logs-windows-{0}-{1}-{2}', env.VSCODE_ARCH, env.ARTIFACT_NAME, github.run_attempt) }}
|
|
path: .build/logs
|
|
if-no-files-found: ignore
|