-
Notifications
You must be signed in to change notification settings - Fork 1.5k
288 lines (279 loc) · 13.1 KB
/
Copy pathsdk-dotnet.yml
File metadata and controls
288 lines (279 loc) · 13.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
# Invoked by sdk.yml to run the .NET SDK build/test matrix, documentation,
# full subprocess CAPI coverage, and focused in-process smoke
# coverage across standard platforms and x64 musl.
name: "SDK .NET"
env:
HUSKY: 0
POWERSHELL_UPDATECHECK: Off
SDK_HOME: ${{ inputs.sdk-home }}
SETUP_NODE_TIMEOUT_MINUTES: 10
on:
workflow_call:
inputs:
platform:
required: false
type: string
default: all
sdk-home:
required: true
type: string
permissions:
contents: read
jobs:
dotnet-linux-x64:
name: ".NET (ubuntu-latest, CAPI)"
if: inputs.platform == 'all' || inputs.platform == 'linux-x64'
timeout-minutes: 30
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ${{ inputs.sdk-home }}/dotnet
env:
COPILOT_SDK_E2E_BACKEND: capi
DOTNET_TEST_RESULTS_DIRECTORY: TestResults/subprocess
steps:
- uses: actions/checkout@v7
timeout-minutes: 4
with:
persist-credentials: false
- uses: ./.github/actions/download-sdk-runtime
with:
artifact-name: executable-sdk-Linux-X64-gnu
path: ${{ github.workspace }}
- run: node "$SDK_HOME/scripts/ci/runtime-artifact.mjs" restore && node "$SDK_HOME/scripts/ci/runtime-artifact.mjs" prepare
working-directory: .
- uses: actions/setup-dotnet@v6
with:
dotnet-version: "10.0.x"
- uses: actions/setup-node@v6
with:
node-version: 22
- run: dotnet restore -p:CopilotCliBinaryPath="$COPILOT_RUNTIME_BINARY_PATH" -p:CopilotSkipCliDownload=true
# TEMPORARY MERGE QUEUE REDUCTION: pull requests and main pushes retain
# static checks; merge groups rerun only SDK compatibility coverage.
- if: github.event_name != 'merge_group'
run: dotnet format --verify-no-changes --no-restore
- run: dotnet build --no-restore -p:CopilotCliBinaryPath="$COPILOT_RUNTIME_BINARY_PATH" -p:CopilotSkipCliDownload=true
- name: Test structured output with reflection enabled
env:
DOTNET_ROLL_FORWARD: Major
run: >-
dotnet test test/GitHub.Copilot.SDK.Test.csproj --no-restore --framework net8.0
-p:JsonSerializerIsReflectionEnabledByDefault=true
-p:CopilotCliBinaryPath="$COPILOT_RUNTIME_BINARY_PATH"
-p:CopilotSkipCliDownload=true
--filter "FullyQualifiedName~GitHub.Copilot.Test.Unit.ClientSessionLifetimeTests.StructuredOutput"
- run: npm ci --ignore-scripts
working-directory: ${{ inputs.sdk-home }}/test/harness
- name: Test out-of-process
id: subprocess
env:
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
run: ../scripts/ci/run-dotnet-tests.sh
- name: Test in-process smoke
if: ${{ !cancelled() && (steps.subprocess.outcome == 'success' || steps.subprocess.outcome == 'failure') }}
env:
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
COPILOT_SDK_DEFAULT_CONNECTION: inprocess
DOTNET_TEST_RESULTS_DIRECTORY: TestResults/inprocess
DOTNET_TEST_FILTER: "FullyQualifiedName~GitHub.Copilot.Test.E2E.ClientE2ETests.Should_Start_And_Connect_Over_InProcess_Ffi|FullyQualifiedName~GitHub.Copilot.Test.E2E.SessionE2ETests.Should_Receive_Session_Events|FullyQualifiedName~GitHub.Copilot.Test.E2E.ClientOptionsE2ETests.Should_Use_Configured_GitHub_Host_For_Authentication"
run: ../scripts/ci/run-dotnet-tests.sh
- name: Validate documentation examples
if: github.event_name != 'merge_group'
working-directory: ${{ inputs.sdk-home }}/scripts/docs-validation
run: |
npm ci
npm run extract
npm run validate:cs
- if: failure()
uses: actions/upload-artifact@v7
with:
name: dotnet-test-diagnostics-ubuntu-latest-capi-${{ github.run_attempt }}
path: ${{ inputs.sdk-home }}/dotnet/TestResults/
if-no-files-found: warn
retention-days: 7
dotnet-darwin-arm64:
name: ".NET (macos-latest, default, CAPI)"
if: inputs.platform == 'all' || inputs.platform == 'darwin-arm64'
runs-on: macos-latest
timeout-minutes: 30
defaults:
run:
shell: bash
working-directory: ${{ inputs.sdk-home }}/dotnet
env:
COPILOT_SDK_E2E_BACKEND: capi
DOTNET_TEST_RESULTS_DIRECTORY: TestResults/subprocess
steps:
- uses: actions/checkout@v7
timeout-minutes: 4
with:
persist-credentials: false
- uses: ./.github/actions/download-sdk-runtime
with:
artifact-name: executable-sdk-macOS-ARM64
path: ${{ github.workspace }}
- run: node "$SDK_HOME/scripts/ci/runtime-artifact.mjs" restore && node "$SDK_HOME/scripts/ci/runtime-artifact.mjs" prepare
working-directory: .
- uses: actions/setup-dotnet@v6
with:
dotnet-version: "10.0.x"
- uses: actions/setup-node@v6
with:
node-version: 22
- run: dotnet restore -p:CopilotCliBinaryPath="$COPILOT_RUNTIME_BINARY_PATH" -p:CopilotSkipCliDownload=true
- run: dotnet build --no-restore -p:CopilotCliBinaryPath="$COPILOT_RUNTIME_BINARY_PATH" -p:CopilotSkipCliDownload=true
- run: npm ci --ignore-scripts
working-directory: ${{ inputs.sdk-home }}/test/harness
- name: Test out-of-process
id: subprocess
env:
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
run: ../scripts/ci/run-dotnet-tests.sh
- name: Test in-process smoke
if: ${{ !cancelled() && (steps.subprocess.outcome == 'success' || steps.subprocess.outcome == 'failure') }}
env:
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
COPILOT_SDK_DEFAULT_CONNECTION: inprocess
DOTNET_TEST_RESULTS_DIRECTORY: TestResults/inprocess
DOTNET_TEST_FILTER: "FullyQualifiedName~GitHub.Copilot.Test.E2E.ClientE2ETests.Should_Start_And_Connect_Over_InProcess_Ffi|FullyQualifiedName~GitHub.Copilot.Test.E2E.SessionE2ETests.Should_Receive_Session_Events|FullyQualifiedName~GitHub.Copilot.Test.E2E.ClientOptionsE2ETests.Should_Use_Configured_GitHub_Host_For_Authentication"
run: ../scripts/ci/run-dotnet-tests.sh
- if: failure()
uses: actions/upload-artifact@v7
with:
name: dotnet-test-diagnostics-macos-latest-default-capi-${{ github.run_attempt }}
path: ${{ inputs.sdk-home }}/dotnet/TestResults/
if-no-files-found: warn
retention-days: 7
dotnet-win32-x64:
name: ".NET (windows-latest, default, CAPI)"
if: inputs.platform == 'all' || inputs.platform == 'win32-x64'
runs-on: windows-latest
timeout-minutes: 30
defaults:
run:
shell: bash
working-directory: ${{ inputs.sdk-home }}/dotnet
env:
COPILOT_SDK_E2E_BACKEND: capi
DOTNET_TEST_RUNTIME: win-x64
DOTNET_TEST_RESULTS_DIRECTORY: TestResults/subprocess
steps:
- uses: actions/checkout@v7
timeout-minutes: 4
with:
persist-credentials: false
- uses: ./.github/actions/download-sdk-runtime
with:
artifact-name: executable-sdk-Windows-X64
path: ${{ github.workspace }}
- run: node "$SDK_HOME/scripts/ci/runtime-artifact.mjs" restore && node "$SDK_HOME/scripts/ci/runtime-artifact.mjs" prepare
working-directory: .
- uses: actions/setup-dotnet@v6
with:
dotnet-version: "10.0.x"
- uses: actions/setup-node@v6
with:
node-version: 22
- run: dotnet restore test/GitHub.Copilot.SDK.Test.csproj --runtime "$DOTNET_TEST_RUNTIME" -p:CopilotCliBinaryPath="$COPILOT_RUNTIME_BINARY_PATH" -p:CopilotSkipCliDownload=true
- run: dotnet build test/GitHub.Copilot.SDK.Test.csproj --no-restore --runtime "$DOTNET_TEST_RUNTIME" -p:CopilotCliBinaryPath="$COPILOT_RUNTIME_BINARY_PATH" -p:CopilotSkipCliDownload=true
- run: npm ci --ignore-scripts
working-directory: ${{ inputs.sdk-home }}/test/harness
- run: pwsh.exe -Command "Write-Host 'PowerShell ready'"
- name: Test out-of-process
id: subprocess
env:
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
run: ../scripts/ci/run-dotnet-tests.sh
- name: Test in-process smoke
if: ${{ !cancelled() && (steps.subprocess.outcome == 'success' || steps.subprocess.outcome == 'failure') }}
env:
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
COPILOT_SDK_DEFAULT_CONNECTION: inprocess
DOTNET_TEST_RESULTS_DIRECTORY: TestResults/inprocess
DOTNET_TEST_FILTER: "FullyQualifiedName~GitHub.Copilot.Test.E2E.ClientE2ETests.Should_Start_And_Connect_Over_InProcess_Ffi|FullyQualifiedName~GitHub.Copilot.Test.E2E.SessionE2ETests.Should_Receive_Session_Events|FullyQualifiedName~GitHub.Copilot.Test.E2E.ClientOptionsE2ETests.Should_Use_Configured_GitHub_Host_For_Authentication"
run: ../scripts/ci/run-dotnet-tests.sh
- if: failure()
uses: actions/upload-artifact@v7
with:
name: dotnet-test-diagnostics-windows-latest-default-capi-${{ github.run_attempt }}
path: ${{ inputs.sdk-home }}/dotnet/TestResults/
if-no-files-found: warn
retention-days: 7
dotnet-musl-x64:
name: ".NET (Alpine x64, CAPI)"
if: inputs.platform == 'all' || inputs.platform == 'linuxmusl-x64'
runs-on: ubuntu-latest
timeout-minutes: 20
env:
COPILOT_SDK_E2E_BACKEND: capi
steps:
- uses: actions/checkout@v7
timeout-minutes: 4
with:
persist-credentials: false
- uses: ./.github/actions/download-sdk-runtime
with:
artifact-name: executable-sdk-Linux-X64-musl
path: ${{ github.workspace }}
- run: node "$SDK_HOME/scripts/ci/runtime-artifact.mjs" restore
working-directory: .
- uses: ./.github/actions/run-alpine-tests
env:
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
COPILOT_SDK_E2E_BACKEND: capi
with:
image: mcr.microsoft.com/dotnet/sdk:10.0-alpine
sdk-root: /workspace/${{ inputs.sdk-home }}
workdir: /workspace/${{ inputs.sdk-home }}
command: |
dotnet --info | grep -Eq "RID:[[:space:]]+linux-musl-x64"
apk add --no-cache nodejs npm
npm --prefix "$COPILOT_SDK_ROOT/nodejs" ci --ignore-scripts
npm --prefix "$COPILOT_SDK_ROOT/test/harness" ci --ignore-scripts
export GITHUB_ENV=/tmp/copilot-sdk-runtime.env
export COPILOT_RUNTIME_TARGET=linuxmusl-x64
export COPILOT_RUNTIME_OUTPUT_DIRECTORY=/workspace/.sdk-runtime/linuxmusl-x64
node "$COPILOT_SDK_ROOT/scripts/ci/runtime-artifact.mjs" prepare
set -a
. "$GITHUB_ENV"
set +a
case "$COPILOT_CLI_PATH" in
*/prebuilds/linuxmusl-x64/copilot-runtime) ;;
*) echo "Expected the linuxmusl-x64 runtime, got: $COPILOT_CLI_PATH" >&2; exit 1 ;;
esac
export DOTNET_ROLL_FORWARD=Major
dotnet restore "$COPILOT_SDK_ROOT/dotnet/test/GitHub.Copilot.SDK.Test.csproj" \
-p:CopilotCliBinaryPath="$COPILOT_RUNTIME_BINARY_PATH" \
-p:CopilotSkipCliDownload=true
dotnet build "$COPILOT_SDK_ROOT/dotnet/test/GitHub.Copilot.SDK.Test.csproj" \
--no-restore --framework net8.0 \
-p:CopilotCliBinaryPath="$COPILOT_RUNTIME_BINARY_PATH" \
-p:CopilotSkipCliDownload=true \
-p:RunAnalyzers=false
set -- "$COPILOT_SDK_ROOT/dotnet/test/GitHub.Copilot.SDK.Test.csproj" \
--no-build \
--framework net8.0 \
-v n \
--blame-hang \
--blame-hang-timeout 10m \
--blame-hang-dump-type none \
--logger "trx;LogFilePrefix=test-results" \
-p:CopilotCliBinaryPath="$COPILOT_RUNTIME_BINARY_PATH" \
-p:CopilotSkipCliDownload=true \
-p:RunAnalyzers=false
status=0
dotnet test "$@" --results-directory "$COPILOT_SDK_ROOT/dotnet/TestResults/subprocess" || status=$?
COPILOT_SDK_DEFAULT_CONNECTION=inprocess dotnet test "$@" \
--results-directory "$COPILOT_SDK_ROOT/dotnet/TestResults/inprocess" \
--filter 'FullyQualifiedName~GitHub.Copilot.Test.E2E.ClientE2ETests.Should_Start_And_Connect_Over_InProcess_Ffi|FullyQualifiedName~GitHub.Copilot.Test.E2E.SessionE2ETests.Should_Receive_Session_Events|FullyQualifiedName~GitHub.Copilot.Test.E2E.ClientOptionsE2ETests.Should_Use_Configured_GitHub_Host_For_Authentication' || status=$?
exit "$status"
- name: Upload .NET test diagnostics
if: failure()
uses: actions/upload-artifact@v7
with:
name: dotnet-test-diagnostics-alpine-x64-capi-${{ github.run_attempt }}
path: ${{ inputs.sdk-home }}/dotnet/TestResults/
if-no-files-found: warn
retention-days: 7