-
Notifications
You must be signed in to change notification settings - Fork 38.3k
278 lines (245 loc) · 9.3 KB
/
pr-win32-test.yml
File metadata and controls
278 lines (245 loc) · 9.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
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
jobs:
windows-test:
name: ${{ inputs.job_name }}
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-windows-2022-x64 ]
env:
ARTIFACT_NAME: ${{ (inputs.electron_tests && 'electron') || (inputs.browser_tests && 'browser') || (inputs.remote_tests && 'remote') || 'unknown' }}
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/restore@v5
id: node-modules-cache
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
- 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.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
- 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: Transpile client and extensions
shell: pwsh
run: npm run gulp "transpile-client-esbuild" "transpile-extensions"
- name: Download Electron and Playwright
shell: pwsh
run: |
for ($i = 1; $i -le 3; $i++) {
try {
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 }}
shell: pwsh
run: .\scripts\test.bat --tfs "Unit Tests"
timeout-minutes: 15
- name: 🧪 Run unit tests (node.js)
if: ${{ inputs.electron_tests }}
shell: pwsh
run: npm run test-node
timeout-minutes: 15
- name: 🧪 Run unit tests (Browser, Chromium)
if: ${{ inputs.browser_tests }}
shell: pwsh
run: node test/unit/browser/index.js --browser chromium --tfs "Browser Unit Tests"
env:
DEBUG: "*browser*"
timeout-minutes: 20
- name: Build integration 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
shell: pwsh
run: .\build\azure-pipelines\win32\listprocesses.bat
continue-on-error: true
if: always()
- name: 🧪 Run integration tests (Electron)
if: ${{ inputs.electron_tests }}
shell: pwsh
run: .\scripts\test-integration.bat --tfs "Integration Tests"
timeout-minutes: 20
- name: 🧪 Run integration tests (Browser, Chromium)
if: ${{ inputs.browser_tests }}
shell: pwsh
run: .\scripts\test-web-integration.bat --browser chromium
timeout-minutes: 20
- name: 🧪 Run integration tests (Remote)
if: ${{ inputs.remote_tests }}
shell: pwsh
run: .\scripts\test-remote-integration.bat
timeout-minutes: 20
- name: Diagnostics after integration test runs
shell: pwsh
run: .\build\azure-pipelines\win32\listprocesses.bat
continue-on-error: true
if: always()
- name: Diagnostics before smoke test run
shell: pwsh
run: .\build\azure-pipelines\win32\listprocesses.bat
continue-on-error: true
if: always()
- name: Compile smoke tests
working-directory: test/smoke
shell: pwsh
run: npm run compile
- name: Compile extensions for smoke tests
shell: pwsh
run: npm run gulp compile-extension-media
- name: 🧪 Run smoke tests (Electron)
if: ${{ inputs.electron_tests }}
timeout-minutes: 20
shell: pwsh
run: npm run smoketest-no-compile -- --tracing
- name: 🧪 Run smoke tests (Browser, Chromium)
if: ${{ inputs.browser_tests }}
timeout-minutes: 20
shell: pwsh
run: npm run smoketest-no-compile -- --web --tracing --headless
- name: 🧪 Run smoke tests (Remote)
if: ${{ inputs.remote_tests }}
timeout-minutes: 20
shell: pwsh
run: npm run smoketest-no-compile -- --remote --tracing
- name: Diagnostics after smoke test run
shell: pwsh
run: .\build\azure-pipelines\win32\listprocesses.bat
continue-on-error: true
if: always()
- name: Publish Crash Reports
uses: actions/upload-artifact@v7
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@v7
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@v7
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