Repository navigation
389 lines (363 loc) · 13.6 KB
/
Copy pathsdk.yml
File metadata and controls
389 lines (363 loc) · 13.6 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
# Acquires target-specific runtime artifacts, then fans build, test, codegen,
# and documentation checks out to the SDK language workflows.
name: "SDK build and test"
env:
COPILOT_BAZEL_ANG_ENABLED: ${{ vars.COPILOT_BAZEL_ANG_ENABLED }}
HUSKY: 0
POWERSHELL_UPDATECHECK: Off
SETUP_NODE_TIMEOUT_MINUTES: 10
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ (github.event_name == 'push' || github.event_name == 'pull_request') && github.ref != 'refs/heads/main' && github.run_attempt == 1 && github.ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
detect-layout:
name: "Detect SDK layout"
runs-on: ubuntu-latest
outputs:
runtime-source: ${{ steps.detect.outputs.runtime-source }}
sdk-home: ${{ steps.detect.outputs.sdk-home }}
steps:
- uses: actions/checkout@v7
timeout-minutes: 4
with:
persist-credentials: false
- id: detect
run: |
if [[ -f src/sdk/package.json && -f script/sea-build.ts ]]; then
echo "runtime-source=checkout" >> "$GITHUB_OUTPUT"
echo "sdk-home=src/sdk" >> "$GITHUB_OUTPUT"
elif [[ -f package.json && -f nodejs/package.json ]]; then
echo "runtime-source=published" >> "$GITHUB_OUTPUT"
echo "sdk-home=." >> "$GITHUB_OUTPUT"
else
echo "::error::Unable to identify the SDK repository layout."
exit 1
fi
build-runtime-windows-x64-addons:
name: "Build runtime addons (win32-x64)"
needs: detect-layout
if: needs.detect-layout.outputs.runtime-source == 'checkout'
runs-on: ubuntu-latest-xl
timeout-minutes: 60
concurrency:
group: windows-x64-addons-release-windows-e2e-no-icf-${{ github.sha }}
queue: max
permissions:
contents: read
id-token: write
packages: read
steps:
- uses: actions/checkout@v7
timeout-minutes: 4
with:
persist-credentials: false
- name: Restore completed Windows x64 addons
id: cache
uses: actions/cache/restore@v6
with:
path: |
windows-x64-addons-receipt.txt
src/native/runtime/runtime.win32-x64-msvc.node
src/native/runtime/copilot-runtime.win32-x64-msvc.exe
src/native/runtime/index.d.ts
src/native/cli/cli-native.win32-x64-msvc.node
src/native/cli/index.d.ts
key: windows-x64-addons-v1-release-windows-e2e-no-icf-${{ github.sha }}
- uses: ./.github/actions/setup-node
if: steps.cache.outputs.cache-hit != 'true'
timeout-minutes: ${{ fromJSON(env.SETUP_NODE_TIMEOUT_MINUTES) }}
- uses: ./.github/actions/setup-bazel
if: steps.cache.outputs.cache-hit != 'true'
with:
datadog-api-key: ${{ secrets.DATADOG_API_KEY }}
datadog-site: ${{ vars.DATADOG_SITE || vars.DD_SITE }}
- name: Cache xwin downloads
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache@v6
continue-on-error: true
with:
path: ${{ runner.temp }}/bazel-xwin-cache/dl
key: bazel-xwin-v2-vs17.14.37628.2-sdk10.0.26100-crt14.44.17.14-x86_64
- name: Point the Bazel repository rule at the xwin cache
if: steps.cache.outputs.cache-hit != 'true'
env:
XWIN_CACHE_DIR: ${{ runner.temp }}/bazel-xwin-cache
run: echo "common --repo_env=COPILOT_BAZEL_XWIN_CACHE_DIR=${XWIN_CACHE_DIR}" >> local.bazelrc
- name: Cross-build Windows x64 addons
if: steps.cache.outputs.cache-hit != 'true'
env:
CLI_GIT_COMMIT: ${{ github.sha }}
CLI_PACKAGE_NAME: "@github/copilot"
CLI_TARGET: win32-x64
COPILOT_RUNTIME_E2E_TEST_HOOKS: "1"
run: |
export CLI_VERSION="0.0.1-${GITHUB_SHA::7}"
node --experimental-strip-types script/build-addons-bazel.ts \
--profile release \
--platform win32 \
--arch x64 \
--bazel-config=windows-e2e-no-icf
- name: Verify Windows x64 addons
if: steps.cache.outputs.cache-hit != 'true'
run: |
for artifact in \
src/native/runtime/runtime.win32-x64-msvc.node \
src/native/runtime/copilot-runtime.win32-x64-msvc.exe \
src/native/cli/cli-native.win32-x64-msvc.node; do
test -s "$artifact"
file "$artifact" | grep -q "PE32+"
done
- name: Record completed Windows x64 addons
if: steps.cache.outputs.cache-hit != 'true'
run: printf 'profile=release\nbazel-config=windows-e2e-no-icf\nsha=%s\n' "$GITHUB_SHA" > windows-x64-addons-receipt.txt
- name: Save completed Windows x64 addons
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v6
with:
path: |
windows-x64-addons-receipt.txt
src/native/runtime/runtime.win32-x64-msvc.node
src/native/runtime/copilot-runtime.win32-x64-msvc.exe
src/native/runtime/index.d.ts
src/native/cli/cli-native.win32-x64-msvc.node
src/native/cli/index.d.ts
key: ${{ steps.cache.outputs.cache-primary-key }}
- uses: actions/upload-artifact@v7
with:
name: sdk-bazel-cross-addons-win32-x64-release
path: |
src/native/runtime/runtime.win32-x64-msvc.node
src/native/runtime/copilot-runtime.win32-x64-msvc.exe
src/native/runtime/index.d.ts
src/native/cli/cli-native.win32-x64-msvc.node
src/native/cli/index.d.ts
if-no-files-found: error
retention-days: 1
build-runtime-linux-x64:
name: "Build runtime (linux-x64)"
needs: detect-layout
permissions:
actions: read
contents: read
id-token: write
packages: read
uses: ./.github/workflows/sdk-runtime-artifact.yml
with:
runtime-source: ${{ needs.detect-layout.outputs.runtime-source }}
sdk-home: ${{ needs.detect-layout.outputs.sdk-home }}
os: ubuntu-latest-xl
target: linux-x64
artifact: Linux-X64-gnu
bazel-config: e2e-no-lto
shared-cli-build-compatible: true
timeout-minutes: 60
secrets: inherit
build-runtime-linuxmusl-x64:
name: "Build runtime (linuxmusl-x64)"
needs: detect-layout
permissions:
actions: read
contents: read
id-token: write
packages: read
uses: ./.github/workflows/sdk-runtime-artifact.yml
with:
runtime-source: ${{ needs.detect-layout.outputs.runtime-source }}
sdk-home: ${{ needs.detect-layout.outputs.sdk-home }}
os: ubuntu-latest-xl
target: linuxmusl-x64
artifact: Linux-X64-musl
bazel-config: e2e-no-lto
timeout-minutes: 60
secrets: inherit
build-runtime-darwin-arm64:
name: "Build runtime (darwin-arm64)"
needs: detect-layout
permissions:
actions: read
contents: read
id-token: write
packages: read
uses: ./.github/workflows/sdk-runtime-artifact.yml
with:
runtime-source: ${{ needs.detect-layout.outputs.runtime-source }}
sdk-home: ${{ needs.detect-layout.outputs.sdk-home }}
os: macos-latest-xlarge
target: darwin-arm64
artifact: macOS-ARM64
bazel-config: e2e-no-lto
use-bazel-addons-on-darwin: true
shared-cli-build-compatible: true
timeout-minutes: 60
secrets: inherit
build-runtime-win32-x64:
name: "Build runtime (win32-x64)"
needs: [detect-layout, build-runtime-windows-x64-addons]
if: always() && needs.detect-layout.result == 'success' && (needs.detect-layout.outputs.runtime-source == 'published' || needs.build-runtime-windows-x64-addons.result == 'success')
permissions:
actions: read
contents: read
id-token: write
packages: read
uses: ./.github/workflows/sdk-runtime-artifact.yml
with:
runtime-source: ${{ needs.detect-layout.outputs.runtime-source }}
sdk-home: ${{ needs.detect-layout.outputs.sdk-home }}
os: windows-2025-16core
target: win32-x64
artifact: Windows-X64
bazel-config: windows-e2e-no-icf
shared-cli-build-compatible: true
prebuilt-addons-artifact: ${{ needs.detect-layout.outputs.runtime-source == 'checkout' && 'sdk-bazel-cross-addons-win32-x64-release' || '' }}
timeout-minutes: 60
secrets: inherit
sdk-linux-x64:
name: "Linux x64"
needs: [detect-layout, build-runtime-linux-x64]
uses: ./.github/workflows/sdk-platform.yml
with:
platform: linux-x64
runtime-source: ${{ needs.detect-layout.outputs.runtime-source }}
sdk-home: ${{ needs.detect-layout.outputs.sdk-home }}
secrets: inherit
sdk-linuxmusl-x64:
name: "Linux musl x64"
needs: [detect-layout, build-runtime-linuxmusl-x64]
uses: ./.github/workflows/sdk-platform.yml
with:
platform: linuxmusl-x64
runtime-source: ${{ needs.detect-layout.outputs.runtime-source }}
sdk-home: ${{ needs.detect-layout.outputs.sdk-home }}
secrets: inherit
sdk-darwin-arm64:
name: "macOS ARM64"
needs: [detect-layout, build-runtime-darwin-arm64]
uses: ./.github/workflows/sdk-platform.yml
with:
platform: darwin-arm64
runtime-source: ${{ needs.detect-layout.outputs.runtime-source }}
sdk-home: ${{ needs.detect-layout.outputs.sdk-home }}
secrets: inherit
sdk-win32-x64:
name: "Windows x64"
needs: [detect-layout, build-runtime-win32-x64]
uses: ./.github/workflows/sdk-platform.yml
with:
platform: win32-x64
runtime-source: ${{ needs.detect-layout.outputs.runtime-source }}
sdk-home: ${{ needs.detect-layout.outputs.sdk-home }}
secrets: inherit
sdk-docs:
name: "Documentation"
needs: detect-layout
uses: ./.github/workflows/sdk-platform.yml
with:
platform: docs
runtime-source: ${{ needs.detect-layout.outputs.runtime-source }}
sdk-home: ${{ needs.detect-layout.outputs.sdk-home }}
secrets: inherit
codegen:
name: "Generated SDK clients"
needs: detect-layout
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
timeout-minutes: 4
with:
persist-credentials: false
- if: needs.detect-layout.outputs.runtime-source == 'checkout'
uses: ./.github/actions/setup-node
timeout-minutes: ${{ fromJSON(env.SETUP_NODE_TIMEOUT_MINUTES) }}
with:
install-deps: "false"
- if: needs.detect-layout.outputs.runtime-source == 'checkout'
uses: ./.github/actions/setup-rust-cache
timeout-minutes: 8
continue-on-error: true
with:
cache-key: sdk-codegen
- uses: actions/setup-go@v6
with:
go-version: "1.24"
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.94.0"
components: rustfmt
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2026-04-14
components: rustfmt
- if: needs.detect-layout.outputs.runtime-source == 'published'
uses: actions/setup-node@v6
with:
node-version: 22
- run: npm ci
working-directory: ${{ needs.detect-layout.outputs.sdk-home }}/nodejs
- run: npm ci
working-directory: ${{ needs.detect-layout.outputs.sdk-home }}/scripts/codegen
- env:
SDK_HOME: ${{ needs.detect-layout.outputs.sdk-home }}
run: node --test "$SDK_HOME"/scripts/ci/*.test.mjs
- env:
SDK_HOME: ${{ needs.detect-layout.outputs.sdk-home }}
run: npm --prefix "$SDK_HOME/nodejs" exec -- tsx --test "$SDK_HOME/scripts/ci/prepare-published-runtime.test.ts"
- if: needs.detect-layout.outputs.runtime-source == 'checkout'
env:
SDK_HOME: ${{ needs.detect-layout.outputs.sdk-home }}
run: npm --prefix "$SDK_HOME" run generate
- if: needs.detect-layout.outputs.runtime-source == 'published'
run: npm run generate
working-directory: ${{ needs.detect-layout.outputs.sdk-home }}/scripts/codegen
- run: cargo +nightly-2026-04-14 fmt --all -- --config-path .rustfmt.nightly.toml
working-directory: ${{ needs.detect-layout.outputs.sdk-home }}/rust
- env:
RUNTIME_SOURCE: ${{ needs.detect-layout.outputs.runtime-source }}
SDK_HOME: ${{ needs.detect-layout.outputs.sdk-home }}
run: |
paths=("$SDK_HOME/nodejs/src/generated" "$SDK_HOME/dotnet/src/Generated" "$SDK_HOME/python/copilot/generated" "$SDK_HOME/go" "$SDK_HOME/java/sdk/src/generated" "$SDK_HOME/rust/src/generated")
if [[ "$RUNTIME_SOURCE" == "checkout" ]]; then
paths+=(generated)
fi
changes=$(git status --porcelain -- "${paths[@]}")
if [[ -n "$changes" ]]; then
echo "::error::Generated SDK clients are out of date."
echo "$changes"
git diff --stat -- "${paths[@]}"
git diff -- "${paths[@]}"
exit 1
fi
sdk:
name: "SDK"
if: always()
needs:
- build-runtime-linux-x64
- build-runtime-linuxmusl-x64
- build-runtime-darwin-arm64
- build-runtime-win32-x64
- detect-layout
- sdk-linux-x64
- sdk-linuxmusl-x64
- sdk-darwin-arm64
- sdk-win32-x64
- sdk-docs
- codegen
runs-on: ubuntu-latest
steps:
- env:
RESULTS: ${{ toJSON(needs) }}
run: |
failures=$(jq -r 'to_entries[] | select(.value.result != "success") | "\(.key): \(.value.result)"' <<< "$RESULTS")
if [[ -n "$failures" ]]; then
echo "::error::SDK jobs did not all succeed:"
echo "$failures"
exit 1
fi