Repository navigation
404 lines (381 loc) · 16.1 KB
/
Copy pathdotnet-sdk-tests.yml
File metadata and controls
404 lines (381 loc) · 16.1 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
name: ".NET SDK Tests"
on:
workflow_dispatch:
workflow_call:
permissions:
contents: read
jobs:
validate:
name: ".NET SDK Build and Format"
if: github.event.repository.fork == false
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
shell: bash
working-directory: ./dotnet
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0
with:
dotnet-version: "10.0.x"
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: "22"
- name: Restore .NET dependencies
run: dotnet restore
- name: Run dotnet format check
run: |
if ! dotnet format --no-restore --verify-no-changes; then
echo "❌ dotnet format produced changes. Please run 'dotnet format' in dotnet"
exit 1
fi
echo "✅ dotnet format produced no changes"
# Build the whole solution once to validate every SDK target framework.
# Matrix cells below only need to build frameworks consumed by the tests.
- name: Build SDK
run: dotnet build --no-restore
test:
name: ".NET SDK Tests (${{ matrix.os }}, ${{ matrix.transport }}, ${{ matrix.backend }}, ${{ matrix.shard }})"
if: github.event.repository.fork == false
env:
POWERSHELL_UPDATECHECK: Off
COPILOT_SDK_E2E_BACKEND: ${{ matrix.backend }}
DOTNET_TEST_FILTER: ${{ matrix.test-filter }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
transport: ["default", "inprocess"]
backend: [capi]
shard: [full]
# TODO: Re-enable after fixing in-process sqlite file locking on shutdown on Windows.
exclude:
- os: windows-latest
transport: "inprocess"
- os: windows-latest
transport: default
shard: full
# TODO(cli-1.0.81-2): CLI 1.0.81-5 still stops completing in-process
# CAPI model turns, causing repeated per-test timeouts until the
# 30-minute job limit. Stdio CAPI and in-process BYOK remain enabled.
- os: ubuntu-latest
transport: inprocess
- os: macos-latest
transport: inprocess
# The macOS default/capi host runs the whole suite on the smallest
# runner in the matrix (3 vCPU / 7 GB vs ubuntu's 4 / 16). Since the
# 1.0.81-2 bump it stopped finishing: the job ran 50+ minutes until
# the runner lost communication with the server, and a runner that
# dies that way uploads no logs at all, so the failure could not be
# diagnosed from CI output. Split it across isolated hosts so one
# poisoned runtime cannot consume the entire job without diagnostics.
- os: macos-latest
transport: default
shard: full
include:
# Keep xUnit serial within each process, but split the slow Windows
# default-transport suite across two isolated test hosts. Keep both
# target frameworks in each shard: separate framework jobs did not
# shorten the critical path and doubled the Windows job count.
- os: windows-latest
transport: default
backend: capi
shard: "1"
- os: windows-latest
transport: default
backend: capi
shard: "2"
- os: macos-latest
transport: default
backend: capi
shard: "1"
- os: macos-latest
transport: default
backend: capi
shard: "2a"
- os: macos-latest
transport: default
backend: capi
shard: "2b-pending"
- os: macos-latest
transport: default
backend: capi
shard: "2b-permission"
- os: macos-latest
transport: default
backend: capi
shard: "2b-auth"
- os: macos-latest
transport: default
backend: capi
shard: "2b-hooks"
- os: macos-latest
transport: default
backend: capi
shard: "2b-unit-p"
- os: macos-latest
transport: default
backend: capi
shard: "2b-provider"
- os: macos-latest
transport: default
backend: capi
shard: "2b-rpc-additional"
- os: macos-latest
transport: default
backend: capi
shard: "2b-rpc-agent"
- os: macos-latest
transport: default
backend: capi
shard: "2b-rpc-event-log"
- os: macos-latest
transport: default
backend: capi
shard: "2b-rpc-event-effects"
- os: macos-latest
transport: default
backend: capi
shard: "2b-rpc-mcp-skills"
- os: macos-latest
transport: default
backend: capi
shard: "2b-rpc-mcp-config"
- os: macos-latest
transport: default
backend: capi
shard: "2b-rpc-mcp-lifecycle"
- os: macos-latest
transport: default
backend: capi
shard: "2b-rpc-q-z"
# Standalone extension tests require the legacy JavaScript entrypoint.
# Keep its subprocess tree isolated from the rest of the O/P/R shard.
- os: macos-latest
transport: default
backend: capi
shard: extensions
- os: macos-latest
transport: default
backend: capi
shard: "2c"
- os: ubuntu-latest
transport: inprocess
backend: anthropic-messages
shard: full
test-filter: "FullyQualifiedName~GitHub.Copilot.Test.E2E&E2EBackend!=SelfConfiguredBackend&E2EBackend!=CapiOnly"
- os: ubuntu-latest
transport: inprocess
backend: openai-responses
shard: full
test-filter: "FullyQualifiedName~GitHub.Copilot.Test.E2E&E2EBackend!=SelfConfiguredBackend&E2EBackend!=CapiOnly"
- os: ubuntu-latest
transport: inprocess
backend: openai-completions
shard: full
test-filter: "FullyQualifiedName~GitHub.Copilot.Test.E2E&E2EBackend!=SelfConfiguredBackend&E2EBackend!=CapiOnly"
runs-on: ${{ matrix.os }}
# A hung test used to run until the runner died (~50 min) and the dying
# runner never uploaded its logs, so the failures were undiagnosable.
# Every healthy cell finishes well under 15 min.
timeout-minutes: 20
defaults:
run:
shell: bash
working-directory: ./dotnet
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0
with:
dotnet-version: "10.0.x"
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: "22"
cache: "npm"
cache-dependency-path: |
./nodejs/package-lock.json
./test/harness/package-lock.json
- name: Install Node.js dependencies
working-directory: ./nodejs
run: npm ci --ignore-scripts
- name: Restore .NET dependencies
run: dotnet restore test/GitHub.Copilot.SDK.Test.csproj
- name: Install test harness dependencies
working-directory: ./test/harness
run: npm ci --ignore-scripts
- name: Warm up PowerShell
if: runner.os == 'Windows'
run: pwsh.exe -Command "Write-Host 'PowerShell ready'"
- name: Select inprocess transport
if: matrix.transport == 'inprocess'
run: echo "COPILOT_SDK_DEFAULT_CONNECTION=inprocess" >> "$GITHUB_ENV"
- name: Run .NET SDK tests
env:
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
DOTNET_TEST_SHARD: ${{ matrix.shard }}
run: |
# --blame-hang names the offending test instead of letting it wedge
# the runner. No single test legitimately runs for 10 minutes; the
# whole suite normally finishes in about five.
# The validation job performs the full analyzer-enabled SDK build.
# Build only test-consumed frameworks here and do not repeat analyzers.
args=(
--no-restore
-v n
--blame-hang
--blame-hang-timeout 10m
--blame-hang-dump-type none
--logger "trx;LogFilePrefix=test-results"
--results-directory "$GITHUB_WORKSPACE/dotnet/TestResults"
-p:RunAnalyzers=false
)
filter="$DOTNET_TEST_FILTER"
if [[ "$DOTNET_TEST_SHARD" != "full" ]]; then
case "$DOTNET_TEST_SHARD" in
1)
# M moved here after recent runs showed shard 2 was about two
# minutes slower; this keeps Windows and macOS balanced.
initials=(A C D H I J K L M N Q S U W Y)
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.ConnectionToken"
;;
2)
initials=(B E F G O P R T V X Z)
shard_filter=""
;;
2a)
initials=(B E F G)
shard_filter=""
;;
2b-pending)
initials=()
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.E2E.PendingWorkResumeE2ETests"
;;
2b-permission)
initials=()
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.E2E.PermissionE2ETests"
;;
2b-auth)
initials=()
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.E2E.PerSessionAuthE2ETests"
;;
2b-hooks)
initials=()
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.E2E.PreMcpToolCallHookE2ETests"
;;
2b-unit-p)
initials=()
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.Unit.P"
;;
2b-provider)
initials=(O)
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.E2E.ProviderEndpointE2ETests|FullyQualifiedName~GitHub.Copilot.Test.E2E.RewindE2ETests|FullyQualifiedName~GitHub.Copilot.Test.Unit.R"
;;
2b-rpc-additional)
initials=()
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcAdditionalEdgeCasesE2ETests"
;;
2b-rpc-agent)
initials=()
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcAgentE2ETests"
;;
2b-rpc-event-log)
initials=()
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcEventLogE2ETests"
;;
2b-rpc-event-effects)
initials=()
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcEventSideEffectsE2ETests"
;;
2b-rpc-mcp-skills)
initials=()
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcMcpAndSkillsE2ETests"
;;
2b-rpc-mcp-config)
initials=()
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcMcpConfigE2ETests"
;;
2b-rpc-mcp-lifecycle)
initials=()
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcMcpLifecycleE2ETests"
;;
2b-rpc-q-z)
initials=()
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcQueueE2ETests|FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcRemoteE2ETests|FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcScheduleE2ETests|FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcServerE2ETests|FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcServerMiscE2ETests|FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcServerPluginsE2ETests|FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcServerRemoteControlE2ETests|FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcSessionStateE2ETests|FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcSessionStateExtrasE2ETests|FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcShellAndFleetE2ETests|FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcShellEdgeCaseE2ETests|FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcShellUserRequestedE2ETests|FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcTasksAndHandlersE2ETests|FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcUiEphemeralQueryE2ETests|FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcWorkspaceCheckpointsE2ETests"
;;
extensions)
initials=()
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.E2E.RpcExtensionsLoadedE2ETests"
;;
2c)
initials=(T V X Z)
shard_filter=""
;;
esac
for namespace in E2E Unit; do
for initial in "${initials[@]}"; do
clause="FullyQualifiedName~GitHub.Copilot.Test.${namespace}.${initial}"
shard_filter="${shard_filter:+${shard_filter}|}${clause}"
done
done
filter="${filter:+(${filter})&}(${shard_filter})"
fi
if [[ -n "$filter" ]]; then
args+=(--filter "$filter")
fi
dotnet test test/GitHub.Copilot.SDK.Test.csproj "${args[@]}"
- name: Upload .NET test diagnostics
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: dotnet-test-diagnostics-${{ matrix.os }}-${{ matrix.transport }}-${{ matrix.backend }}-${{ matrix.shard }}-${{ github.run_attempt }}
path: dotnet/TestResults/
if-no-files-found: warn
retention-days: 7
# JavaScript actions use a glibc-linked Node runtime, so Alpine runs through Docker.
alpine-arm64:
name: ".NET SDK Tests (Alpine ARM64, ${{ matrix.transport }}, CAPI)"
if: github.event.repository.fork == false
runs-on: ubuntu-24.04-arm
timeout-minutes: 20
env:
COPILOT_SDK_E2E_BACKEND: capi
strategy:
fail-fast: false
matrix:
transport: ["default", "inprocess"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run ${{ matrix.transport }} tests on ARM64 Alpine
uses: ./.github/actions/run-alpine-tests
env:
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
with:
image: mcr.microsoft.com/dotnet/sdk:10.0-alpine
workdir: /workspace
transport: ${{ matrix.transport }}
command: |
dotnet --info | grep -Eq "RID:[[:space:]]+linux-musl-arm64"
apk add --no-cache nodejs npm
(cd nodejs && npm ci --ignore-scripts)
(cd test/harness && npm ci --ignore-scripts)
export DOTNET_ROLL_FORWARD=Major
dotnet restore dotnet/test/GitHub.Copilot.SDK.Test.csproj
dotnet test dotnet/test/GitHub.Copilot.SDK.Test.csproj \
--no-restore \
--framework net8.0 \
-v n \
--blame-hang \
--blame-hang-timeout 10m \
--blame-hang-dump-type none \
--logger "trx;LogFilePrefix=test-results" \
--results-directory /workspace/dotnet/TestResults \
-p:RunAnalyzers=false
- name: Upload .NET test diagnostics
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: dotnet-test-diagnostics-alpine-arm64-${{ matrix.transport }}-capi-${{ github.run_attempt }}
path: dotnet/TestResults/
if-no-files-found: warn
retention-days: 7