Repository navigation
276 lines (241 loc) · 11.6 KB
/
Copy pathwindows-shell.yml
File metadata and controls
276 lines (241 loc) · 11.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
name: Windows shell validation
on:
workflow_dispatch:
pull_request:
permissions:
contents: read
# Superseded pull request pushes cancel their in-flight run. Every other event
# gets a unique group, so runs on main, dispatches, and merge queues are never
# cancelled or replaced while pending.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
# Zig's global package/compiler cache, kept beside the bootstrap tools so it
# can be restored with the pinned providers (it is content-addressed).
ZIG_GLOBAL_CACHE_DIR: ${{ github.workspace }}\.ci-tools\zig-global
# The required `windows-shell` check is the aggregate job at the end. It needs
# every part below and fails unless each one succeeded, except when the path
# classifier legitimately skipped the whole workflow for this pull request.
jobs:
changes:
name: Classify changed paths
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
windows: ${{ steps.classify.outputs.windows }}
macos: ${{ steps.classify.outputs.macos }}
linux: ${{ steps.classify.outputs.linux }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
fetch-depth: 0
- name: Classify changed paths
id: classify
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: bash Tools/ci/classify-changes.sh --event "$EVENT_NAME" --base "$BASE_SHA" --head "$HEAD_SHA"
# Shell contracts and the Zig executable sections of WindowsShell.Tests.ps1,
# split into a deterministic, complete partition (see Test-ShellSectionManifests.ps1).
shell-unit:
name: "windows-shell unit (shard ${{ matrix.shard }} of 3)"
needs: changes
if: ${{ !cancelled() && (github.event_name != 'pull_request' || needs.changes.result != 'success' || needs.changes.outputs.windows == 'true') }}
runs-on: windows-2022
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2]
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- name: Restore pinned Zig toolchains
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
.ci-tools/zig-0.15.2
.ci-tools/zig-0.16.0
key: windows-zig-v1-${{ hashFiles('Tools/windows/bootstrap.ps1') }}
- name: Restore pinned provider build caches
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
.ci-providers
.ci-tools/zig-global
key: windows-providers-v1-${{ hashFiles('graphcode-windows/provider-pins.json', 'Tools/windows/bootstrap.ps1') }}-emit-win32-host-x86_64-windows-gnu
- name: Bootstrap exact Windows dependencies
shell: pwsh
run: ./Tools/windows/bootstrap.ps1 -ToolRoot .ci-tools -ProviderRoot .ci-providers -SkipSwift
- name: Verify provider pins after cache restore
shell: pwsh
run: ./Tools/windows/Assert-ProviderCheckout.ps1 -ProviderRoot .ci-providers
- name: Run shell contracts and executable sections
shell: pwsh
run: ./Tools/windows/validate.ps1 -Task windows-shell -ShellPart unit -ShellTestShard ${{ matrix.shard }} -ShellTestShardCount 3 -ShellTestManifest .ci-sections/shard-${{ matrix.shard }}.json
- name: Upload section manifest
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: windows-shell-sections-${{ matrix.shard }}
path: .ci-sections/shard-${{ matrix.shard }}.json
if-no-files-found: error
retention-days: 7
# Release build, pinned-provider smoke/restart/handoff, tray, and the native
# UI Automation live gate. The UIA gate runs only here, serially.
shell-integration:
name: windows-shell integration
needs: changes
if: ${{ !cancelled() && (github.event_name != 'pull_request' || needs.changes.result != 'success' || needs.changes.outputs.windows == 'true') }}
runs-on: windows-2022
# A cold miss measured 40m08s end to end (setup/Swift 1m54s + bootstrap
# 26m34s + build-only 4m01s + save 10s + gate 7m17s + ~12s restores/checks/
# post; see ValidationRunner.Tests.ps1). 45 leaves 4m52s (~12%) headroom,
# and the provider cache is saved before the gate by about 32m42s regardless.
timeout-minutes: 45
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- uses: compnerd/gha-setup-swift@397094e75494a93fa8d81db0268dbc8f5d6cf7c6 # v0.4.1
with:
swift-version: swift-6.3.3-release
swift-build: 6.3.3-RELEASE
cache: true
- name: Restore pinned Zig toolchains
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
.ci-tools/zig-0.15.2
.ci-tools/zig-0.16.0
key: windows-zig-v1-${{ hashFiles('Tools/windows/bootstrap.ps1') }}
- name: Restore pinned provider build caches
id: provider-cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
.ci-providers
.ci-tools/zig-global
key: windows-providers-v1-${{ hashFiles('graphcode-windows/provider-pins.json', 'Tools/windows/bootstrap.ps1') }}-emit-win32-host-x86_64-windows-gnu
- name: Bootstrap exact Windows dependencies
id: bootstrap
shell: pwsh
run: ./Tools/windows/bootstrap.ps1 -ToolRoot .ci-tools -ProviderRoot .ci-providers
- name: Verify provider pins after cache restore
id: verify-pins
shell: pwsh
run: ./Tools/windows/Assert-ProviderCheckout.ps1 -ProviderRoot .ci-providers
# Build-only: compiles both pinned providers with the canonical flags the
# cache key names, and runs no terminal tests.
- name: Build pinned provider artifacts
id: provider-build
shell: pwsh
run: ./Tools/windows/validate.ps1 -Task provider-build
# Only this job builds both providers with the canonical flags, so it is
# the single writer of the provider cache. It saves before the gate so a
# cold miss still seeds its key when the gate later fails or is cancelled,
# and never after a failed or cancelled bootstrap, pin check, or build.
# `!cancelled()` replaces the implicit whole-job success() check.
- name: Save pinned provider build caches
if: ${{ !cancelled() && steps.bootstrap.conclusion == 'success' && steps.verify-pins.conclusion == 'success' && steps.provider-build.conclusion == 'success' && steps.provider-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
.ci-providers
.ci-tools/zig-global
key: ${{ steps.provider-cache.outputs.cache-primary-key }}
- name: Verify shell build, pinned-provider smoke, and live UI Automation
shell: pwsh
run: ./Tools/windows/validate.ps1 -Task windows-shell -SkipTrayLive -ShellPart integration
- name: Retain UIA failure diagnostics
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: uia-live-gate-diagnostics
path: ${{ runner.temp }}\gu-*\logs\*.json
if-no-files-found: warn
retention-days: 7
# Fixture-only release, signing, script-signing, scheduler, rollback, and
# standalone (PowerShell 5.1 and 7) contracts. They consume no build output.
packaging-contracts:
name: windows-shell packaging contracts
needs: changes
if: ${{ !cancelled() && (github.event_name != 'pull_request' || needs.changes.result != 'success' || needs.changes.outputs.windows == 'true') }}
runs-on: windows-2022
timeout-minutes: 20
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- name: Validate release packaging contracts
shell: pwsh
run: ./Tools/windows/validate.ps1 -Task packaging -PackagingPart contracts
# Real packaging rebuilds its own inputs (Swift release products and runtime,
# pinned Winghostty host library, pinned zmx dependencies) on this runner, so
# it runs in parallel with the shell integration instead of after it.
packaging-real:
name: windows-shell packaging (real products)
needs: changes
if: ${{ !cancelled() && (github.event_name != 'pull_request' || needs.changes.result != 'success' || needs.changes.outputs.windows == 'true') }}
runs-on: windows-2022
timeout-minutes: 50
steps:
- name: Check out repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
timeout-minutes: 5
- name: Install pinned Swift toolchain
uses: compnerd/gha-setup-swift@397094e75494a93fa8d81db0268dbc8f5d6cf7c6 # v0.4.1
timeout-minutes: 10
with:
swift-version: swift-6.3.3-release
swift-build: 6.3.3-RELEASE
cache: true
- name: Restore pinned Zig toolchains
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
timeout-minutes: 10
with:
path: |
.ci-tools/zig-0.15.2
.ci-tools/zig-0.16.0
key: windows-zig-v1-${{ hashFiles('Tools/windows/bootstrap.ps1') }}
- name: Restore pinned provider build caches
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
timeout-minutes: 10
with:
path: |
.ci-providers
.ci-tools/zig-global
key: windows-providers-v1-${{ hashFiles('graphcode-windows/provider-pins.json', 'Tools/windows/bootstrap.ps1') }}-emit-win32-host-x86_64-windows-gnu
- name: Bootstrap exact Windows dependencies
shell: pwsh
timeout-minutes: 30
run: ./Tools/windows/bootstrap.ps1 -ToolRoot .ci-tools -ProviderRoot .ci-providers
- name: Verify provider pins after cache restore
shell: pwsh
timeout-minutes: 5
run: ./Tools/windows/Assert-ProviderCheckout.ps1 -ProviderRoot .ci-providers
- name: Validate release packaging with real products
shell: pwsh
timeout-minutes: 40
run: ./Tools/windows/validate.ps1 -Task packaging -PackagingPart real
windows-shell:
needs: [changes, shell-unit, shell-integration, packaging-contracts, packaging-real]
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
timeout-minutes: 10
env:
WINDOWS_REQUIRED: ${{ github.event_name != 'pull_request' || needs.changes.result != 'success' || needs.changes.outputs.windows == 'true' }}
NEEDS_JSON: ${{ toJSON(needs) }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- name: Require every Windows shell part
shell: pwsh
run: ./Tools/windows/Assert-CiPartResults.ps1 -NeedsJson $env:NEEDS_JSON -Required $env:WINDOWS_REQUIRED
- name: Download section manifests
if: env.WINDOWS_REQUIRED == 'true'
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: windows-shell-sections-*
path: .ci-sections
merge-multiple: true
- name: Verify every executable section ran exactly once
if: env.WINDOWS_REQUIRED == 'true'
shell: pwsh
run: ./Tools/windows/Test-ShellSectionManifests.ps1 -Directory .ci-sections -ShardCount 3