Repository navigation
468 lines (416 loc) · 20.4 KB
/
Copy pathpr-darwin-test.yml
File metadata and controls
468 lines (416 loc) · 20.4 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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
# pr.yml does not call this workflow for now: its macos-tests job is commented out (see there).
on:
workflow_call:
inputs:
electron_unit_affected:
description: Whether the pull request can affect the Electron-Unit job, which is skipped when false
type: boolean
default: true
electron_affected:
description: Whether the pull request can affect the Electron job, which is skipped when false
type: boolean
default: true
electron_smoke_affected:
description: Whether the pull request can affect the Electron-Smoke jobs, which are skipped when false
type: boolean
default: true
browser_unit_affected:
description: Whether the pull request can affect the Browser-Unit job, which is skipped when false
type: boolean
default: true
browser_affected:
description: Whether the pull request can affect the Browser job, which is skipped when false
type: boolean
default: true
remote_affected:
description: Whether the pull request can affect the Remote job, which is skipped when false
type: boolean
default: true
node_integration_tests:
description: Whether the Electron job runs the node.js integration tests
type: boolean
default: true
agent_host_e2e_tests:
description: Whether the Electron job also runs the Agent Host E2E tests
type: boolean
default: false
agent_host_test_profile:
description: Agent Host test profile, 'pr' or 'full' (see .github/actions/detect-agent-host-e2e-changes)
type: string
default: full
agent_host_test_profile_reason:
description: Reason for selecting the Agent Host test profile
type: string
default: Change detection unavailable
permissions:
contents: read
env:
NPM_ARCH: arm64
VSCODE_ARCH: arm64
VSCODE_SKIP_PRELAUNCH: '1'
# Each job reports as "macOS / <job name>", for example "macOS / Electron-Unit", whether it runs
# or not: the names are fixed, as GitHub does not evaluate the expressions in the name of a skipped
# job. The jobs run the steps of the first one (steps: &steps), and their env selects which of them
# run (a flag is on when it is 'true'):
# - ELECTRON_TESTS, BROWSER_TESTS or REMOTE_TESTS: the test runner
# - UNIT_TESTS, INTEGRATION_TESTS, SMOKE_TESTS and AGENT_HOST_E2E_TESTS: the kinds of tests
# - NODE_INTEGRATION_TESTS: whether INTEGRATION_TESTS includes the node.js integration tests
# - TEST_SELECTION: run only the test files listed in the test-plan artifact of the workflow run, when
# the Detect Changes job of pr.yml uploaded one, instead of every test of the kinds that it plans
# (unit.txt for the unit tests, integration.txt for the node.js integration tests and Agent Host E2E)
# - SMOKE_SHARD_INDEX and SMOKE_SHARD_TOTAL: the 1-based index of the Electron smoke test shard to run,
# and the number of shards
# - ARTIFACT_NAME: identifies the job in the names of the artifacts that it publishes
#
# The jobs run on three runner groups, vscode-large-runners-macos-5-core-<0|1|2>, so that the macOS
# checks are not limited by the size of one pool. Each group runs about a third of the runner
# minutes of a pull request, and the two Electron smoke test shards run in different groups:
# - 0: Remote, Electron-Unit, Browser-Unit, chat-lib - Test (macOS) of pr.yml, and the macOS cache
# warming job of pr-pnpm-store.yml
# - 1: Electron, Electron-Smoke (shard 1/2)
# - 2: Electron-Smoke (shard 2/2), Browser
jobs:
electron-unit:
name: Electron-Unit
if: ${{ inputs.electron_unit_affected }}
runs-on: vscode-large-runners-macos-5-core-0
env:
ARTIFACT_NAME: electron-unit
ELECTRON_TESTS: 'true'
UNIT_TESTS: 'true'
TEST_SELECTION: 'true'
steps: &steps
- name: Checkout microsoft/vscode
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
lfs: true
- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
- name: Setup pnpm
uses: ./.github/actions/setup-pnpm
- name: Restore pnpm store cache
uses: ./.github/actions/restore-pnpm-store
with:
key-prefix: pnpm-store-macos
- name: Install dependencies
run: |
set -e
c++ --version
xcode-select -print-path
python3 -m pip install --break-system-packages setuptools
for i in {1..5}; do # try 5 times
pnpm install --frozen-lockfile && break
if [ $i -eq 5 ]; then
echo "pnpm install failed too many times" >&2
exit 1
fi
echo "pnpm install failed $i, trying again..."
done
env:
npm_config_arch: ${{ env.NPM_ARCH }}
VSCODE_ARCH: ${{ env.VSCODE_ARCH }}
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Avoid using dlopen to load Kerberos on macOS which can cause missing libraries
# https://github.com/mongodb-js/kerberos/commit/04044d2814ad1d01e77f1ce87f26b03d86692cf2
# flipped the default to support legacy linux distros which shouldn't happen
# on macOS.
GYP_DEFINES: "kerberos_use_rtld=false"
- name: Create .build folder
run: mkdir -p .build
- name: Prepare built-in extensions cache key
run: node build/azure-pipelines/common/computeBuiltInDepsCacheKey.ts > .build/builtindepshash
- name: Restore built-in extensions cache
id: cache-builtin-extensions
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.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
run: pnpm run gulp transpile-client-esbuild transpile-extensions
- name: Setup Electron
if: ${{ env.ELECTRON_TESTS == 'true' || env.REMOTE_TESTS == 'true' }}
uses: ./.github/actions/setup-electron
with:
arch: ${{ env.VSCODE_ARCH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Compile browser integration test runner
if: ${{ env.BROWSER_TESTS == 'true' && env.INTEGRATION_TESTS == 'true' }}
working-directory: test/integration/browser
run: pnpm run compile
# pr-pnpm-store.yml fills this cache on main, so pull requests don't download the browsers.
- name: Restore Playwright browsers
if: ${{ env.BROWSER_TESTS == 'true' }}
uses: ./.github/actions/restore-playwright
with:
browsers: --only-shell chromium webkit
- name: Install Playwright Chromium and WebKit
if: ${{ env.BROWSER_TESTS == 'true' }}
run: |
set -e
for i in {1..3}; do
if pnpm exec playwright install --only-shell chromium webkit; then
echo "Install successful on attempt $i"
break
fi
if [ $i -eq 3 ]; then
echo "Install failed after 3 attempts" >&2
exit 1
fi
echo "Install failed on attempt $i, retrying..."
sleep 5
done
- name: Download test plan
id: download-plan
if: ${{ env.TEST_SELECTION == 'true' }}
# Without a plan (Detect Changes only uploads one when the selection applies), the test
# steps below run every test. A pattern, unlike a name, downloads nothing instead of
# failing when there is no plan.
continue-on-error: true
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: test-plan
path: .build/test-plan
# A failed download (such as a digest mismatch, reported after extracting) can leave a partial
# plan behind: without one, the test steps below run every test.
- name: Discard a failed test plan download
if: ${{ steps.download-plan.outcome == 'failure' }}
run: rm -rf .build/test-plan
- name: 🧪 Run unit tests (Electron)
if: ${{ env.ELECTRON_TESTS == 'true' && env.UNIT_TESTS == 'true' && (hashFiles('.build/test-plan/plan.json') == '' || hashFiles('.build/test-plan/unit.txt') != '') }}
timeout-minutes: 25
run: ./scripts/test.sh --tfs "Unit Tests" --workers 4 --rerun-failed-files 2 ${{ hashFiles('.build/test-plan/plan.json') != '' && '--runList .build/test-plan/unit.txt' || '' }}
env:
VSCODE_SKIP_PRELAUNCH: '1'
- name: 🧪 Run unit tests (node.js)
if: ${{ env.ELECTRON_TESTS == 'true' && env.UNIT_TESTS == 'true' && (hashFiles('.build/test-plan/plan.json') == '' || hashFiles('.build/test-plan/unit.txt') != '') }}
timeout-minutes: 25
run: pnpm run test-node --workers 4 --rerun-failed-files 2 ${{ hashFiles('.build/test-plan/plan.json') != '' && '--runList .build/test-plan/unit.txt' || '' }}
- name: 🧪 Run unit tests (Browser, Webkit)
if: ${{ env.BROWSER_TESTS == 'true' && env.UNIT_TESTS == 'true' && (hashFiles('.build/test-plan/plan.json') == '' || hashFiles('.build/test-plan/unit.txt') != '') }}
timeout-minutes: 30
run: pnpm run test-browser-no-install --browser webkit --tfs "Browser Unit Tests" --workers 4 --rerun-failed-files 2 ${{ hashFiles('.build/test-plan/plan.json') != '' && '--runList .build/test-plan/unit.txt' || '' }}
env:
DEBUG: "*browser*"
- name: Compile extensions for integration tests & smoke tests
if: ${{ env.INTEGRATION_TESTS == 'true' || env.SMOKE_TESTS == 'true' }}
run: |
set -e
pnpm run gulp \
compile-extension:configuration-editing \
compile-extension:css-language-features-server \
compile-extension:emmet \
compile-extension:git \
compile-extension:git-base \
compile-extension:github-authentication \
compile-extension:html-language-features-server \
compile-extension:ipynb \
compile-extension:notebook-renderers \
compile-extension:json-language-features-client \
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: 🧪 Run Agent Host E2E tests (Electron)
id: agent-host-e2e
if: ${{ env.ELECTRON_TESTS == 'true' && env.AGENT_HOST_E2E_TESTS == 'true' }}
timeout-minutes: 25
run: ./scripts/test-agent-host-e2e.sh --tfs "Integration Tests" --rerun-failed-files 2 ${{ hashFiles('.build/test-plan/integration.txt') != '' && '--runList .build/test-plan/integration.txt' || '' }}
env:
AGENT_HOST_TEST_PROFILE: ${{ inputs.agent_host_test_profile }}
AGENT_HOST_TEST_PROFILE_REASON: ${{ inputs.agent_host_test_profile_reason }}
VSCODE_SKIP_PRELAUNCH: '1'
# Runs even when Agent Host E2E failed in the same job, so that one does not hide the other.
# Reruns the failed tests in a fresh window.
- name: 🧪 Run integration tests (Electron)
id: node-integration-tests
if: ${{ env.ELECTRON_TESTS == 'true' && env.INTEGRATION_TESTS == 'true' && env.NODE_INTEGRATION_TESTS == 'true' && !cancelled() && (success() || steps.agent-host-e2e.outcome == 'failure') }}
timeout-minutes: 25
run: ./scripts/test-integration.sh --only-node-tests --tfs "Integration Tests" --rerun-failed-files 2 ${{ hashFiles('.build/test-plan/integration.txt') != '' && '--runList .build/test-plan/integration.txt' || '' }}
env:
AGENT_HOST_TEST_PROFILE: ${{ inputs.agent_host_test_profile }}
AGENT_HOST_TEST_PROFILE_REASON: ${{ inputs.agent_host_test_profile_reason }}
VSCODE_SKIP_PRELAUNCH: '1'
# Runs even when the node.js integration tests or Agent Host E2E failed in the same job.
# The extension host suites are not rerun.
- name: 🧪 Run extension host integration tests (Electron)
if: ${{ env.ELECTRON_TESTS == 'true' && env.INTEGRATION_TESTS == 'true' && !cancelled() && (success() || steps.agent-host-e2e.outcome == 'failure' || steps.node-integration-tests.outcome == 'failure') }}
timeout-minutes: 15
run: ./scripts/test-integration.sh --only-extension-host-tests
env:
VSCODE_SKIP_PRELAUNCH: '1'
# Runs the suites, which mostly start VS Code, in parallel (see scripts/integration-test-suites.sh).
INTEGRATION_TEST_PARALLEL: '2'
# The web and remote tests start the server out of sources, which downloads its Node.js from nodejs.org unless
# the runner already has that version.
- name: Use the runner's Node.js for the server
if: ${{ (env.BROWSER_TESTS == 'true' || env.REMOTE_TESTS == 'true') && (env.INTEGRATION_TESTS == 'true' || env.SMOKE_TESTS == 'true') }}
run: node build/azure-pipelines/common/useRunnerNodeForServer.ts
- name: 🧪 Run integration tests (Browser, Webkit)
if: ${{ env.BROWSER_TESTS == 'true' && env.INTEGRATION_TESTS == 'true' }}
timeout-minutes: 20
run: ./scripts/test-web-integration.sh --browser webkit
- name: 🧪 Run integration tests (Remote)
if: ${{ env.REMOTE_TESTS == 'true' && env.INTEGRATION_TESTS == 'true' }}
timeout-minutes: 20
run: ./scripts/test-remote-integration.sh
env:
VSCODE_SKIP_PRELAUNCH: '1'
# Runs the suites, which mostly start VS Code, in parallel (see scripts/integration-test-suites.sh).
INTEGRATION_TEST_PARALLEL: '2'
- name: Compile smoke tests
if: ${{ env.SMOKE_TESTS == 'true' }}
working-directory: test/smoke
run: pnpm run compile
- name: Compile Copilot Chat extension for smoke tests
if: ${{ env.SMOKE_TESTS == 'true' && env.BROWSER_TESTS != 'true' }}
working-directory: extensions/copilot
run: pnpm run compile
- name: Diagnostics before smoke test run
if: ${{ env.SMOKE_TESTS == 'true' && always() }}
run: ps -ef
continue-on-error: true
- name: 🧪 Run smoke tests (Electron)
if: ${{ env.ELECTRON_TESTS == 'true' && env.SMOKE_TESTS == 'true' }}
timeout-minutes: 20
run: pnpm run smoketest-no-compile --tracing --shard ${{ env.SMOKE_SHARD_INDEX }}/${{ env.SMOKE_SHARD_TOTAL }}
env:
VSCODE_SMOKE_TEST_POLICY: '1'
# The proxy runs are separate Agents Window invocations, so only the last shard runs them.
# test/smoke/src/shard.ts reserves time for them in the last shard when balancing.
- name: Install Squid for network-isolated smoke tests
if: ${{ env.ELECTRON_TESTS == 'true' && env.SMOKE_TESTS == 'true' && env.SMOKE_SHARD_INDEX == env.SMOKE_SHARD_TOTAL }}
run: brew list squid >/dev/null 2>&1 || brew install squid
- name: 🧪 Run Agents Window smoke tests through macOS PAC proxy
if: ${{ env.ELECTRON_TESTS == 'true' && env.SMOKE_TESTS == 'true' && env.SMOKE_SHARD_INDEX == env.SMOKE_SHARD_TOTAL }}
timeout-minutes: 40
run: bash test/smoke/scripts/run-agents-window-network-proxy.sh
- name: 🧪 Run Agents Window smoke tests through Kerberos-authenticated macOS PAC proxy
if: ${{ env.ELECTRON_TESTS == 'true' && env.SMOKE_TESTS == 'true' && env.SMOKE_SHARD_INDEX == env.SMOKE_SHARD_TOTAL }}
timeout-minutes: 40
run: bash test/smoke/scripts/run-agents-window-network-proxy.sh --kerberos
- name: 🧪 Run Agents Window smoke tests through Basic-authenticated proxy from the http.proxy setting
if: ${{ env.ELECTRON_TESTS == 'true' && env.SMOKE_TESTS == 'true' && env.SMOKE_SHARD_INDEX == env.SMOKE_SHARD_TOTAL }}
timeout-minutes: 40
run: bash test/smoke/scripts/run-agents-window-network-proxy.sh --basic
- name: 🧪 Run smoke tests (Browser, Chromium)
if: ${{ env.BROWSER_TESTS == 'true' && env.SMOKE_TESTS == 'true' }}
timeout-minutes: 20
run: pnpm run smoketest-no-compile --web --tracing --headless
- name: 🧪 Run smoke tests (Remote)
if: ${{ env.REMOTE_TESTS == 'true' && env.SMOKE_TESTS == 'true' }}
timeout-minutes: 20
run: pnpm run smoketest-no-compile --remote --tracing
- name: Diagnostics after smoke test run
if: ${{ env.SMOKE_TESTS == 'true' && always() }}
run: ps -ef
continue-on-error: true
- name: Publish Crash Reports
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: failure()
continue-on-error: true
with:
name: ${{ format('crash-dump-macos-{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@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: failure()
continue-on-error: true
with:
name: ${{ format('node-modules-macos-{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@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
continue-on-error: true
with:
name: ${{ format('logs-macos-{0}-{1}-{2}', env.VSCODE_ARCH, env.ARTIFACT_NAME, github.run_attempt) }}
path: .build/logs
if-no-files-found: ignore
electron:
name: Electron
if: ${{ inputs.electron_affected }}
runs-on: vscode-large-runners-macos-5-core-1
env:
ARTIFACT_NAME: electron
ELECTRON_TESTS: 'true'
INTEGRATION_TESTS: 'true'
NODE_INTEGRATION_TESTS: ${{ inputs.node_integration_tests }}
# On macOS the job is short enough to also run Agent Host E2E.
AGENT_HOST_E2E_TESTS: ${{ inputs.agent_host_e2e_tests }}
# Runs only the node.js integration tests and the Agent Host E2E suites that the plan selects.
TEST_SELECTION: 'true'
steps: *steps
# Running every Electron smoke test takes one machine up to about 20 minutes, the timeout of the
# step, so the shards split them over parallel machines (see .github/skills/smoke-tests/SKILL.md).
electron-smoke-1:
name: Electron-Smoke (shard 1/2)
if: ${{ inputs.electron_smoke_affected }}
runs-on: vscode-large-runners-macos-5-core-1
env:
ARTIFACT_NAME: electron-smoke-shard1
ELECTRON_TESTS: 'true'
SMOKE_TESTS: 'true'
SMOKE_SHARD_INDEX: '1'
SMOKE_SHARD_TOTAL: '2'
steps: *steps
electron-smoke-2:
name: Electron-Smoke (shard 2/2)
if: ${{ inputs.electron_smoke_affected }}
runs-on: vscode-large-runners-macos-5-core-2
env:
ARTIFACT_NAME: electron-smoke-shard2
ELECTRON_TESTS: 'true'
SMOKE_TESTS: 'true'
SMOKE_SHARD_INDEX: '2'
SMOKE_SHARD_TOTAL: '2'
steps: *steps
browser-unit:
name: Browser-Unit
if: ${{ inputs.browser_unit_affected }}
runs-on: vscode-large-runners-macos-5-core-0
env:
ARTIFACT_NAME: browser-unit
BROWSER_TESTS: 'true'
UNIT_TESTS: 'true'
TEST_SELECTION: 'true'
steps: *steps
browser:
name: Browser
if: ${{ inputs.browser_affected }}
runs-on: vscode-large-runners-macos-5-core-2
env:
ARTIFACT_NAME: browser
BROWSER_TESTS: 'true'
INTEGRATION_TESTS: 'true'
SMOKE_TESTS: 'true'
steps: *steps
remote:
name: Remote
if: ${{ inputs.remote_affected }}
runs-on: vscode-large-runners-macos-5-core-0
env:
ARTIFACT_NAME: remote
REMOTE_TESTS: 'true'
INTEGRATION_TESTS: 'true'
SMOKE_TESTS: 'true'
steps: *steps