Repository navigation
393 lines (381 loc) · 14.2 KB
/
Copy pathci.yml
File metadata and controls
393 lines (381 loc) · 14.2 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
name: CI
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
inputs:
update_e2e:
description: Run the packaged Windows update E2E
required: false
type: boolean
default: false
# Release calls this workflow so the tag's installers are built by exactly the
# same jobs and verification as a normal CI run.
workflow_call:
inputs:
ref:
description: Git ref to build; defaults to the caller's ref
required: false
type: string
concurrency:
group: ci-${{ inputs.ref || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CI: 'true'
# Hosted runners occasionally lose the Docker embedded resolver, so the
# pinned build container cannot reach archive.ubuntu.com. The build scripts
# translate this into `docker run --dns ...`; local builds leave it unset.
ICODE_DOCKER_DNS: '8.8.8.8,1.1.1.1'
jobs:
unit-linux:
name: Unit and build (Linux)
runs-on: ubuntu-22.04
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Native build prerequisites
run: sudo apt-get update && sudo apt-get install -y build-essential python3
- name: Configure Git for tests
run: |
git config --global user.name "iCode CI"
git config --global user.email "ci@icode.invalid"
git config --global init.defaultBranch main
git config --global core.autocrlf false
git config --global core.longpaths true
git config --global protocol.file.allow always
- run: pnpm install --frozen-lockfile
- run: pnpm typecheck
- run: pnpm check:brand
- run: pnpm test
- name: Update metadata selftest
run: |
# A backfill builds an older tag whose checkout predates this tooling.
if [ -f tests/release/selftest-update-metadata.cjs ]; then
pnpm selftest:update-metadata
else
echo "Legacy tag predates update metadata."
fi
- run: pnpm build
unit-windows:
name: Unit and build (Windows)
runs-on: windows-2022
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Configure Git for tests
run: |
git config --global user.name "iCode CI"
git config --global user.email "ci@icode.invalid"
git config --global init.defaultBranch main
git config --global core.autocrlf false
git config --global core.longpaths true
git config --global protocol.file.allow always
- run: pnpm install --frozen-lockfile
- run: pnpm typecheck
- run: pnpm check:brand
- run: pnpm test
- run: pnpm build
unit-macos:
name: Unit and build (macOS ${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
env:
VITEST_MAX_WORKERS: '2'
VITEST_TEST_TIMEOUT: '15000'
strategy:
fail-fast: false
matrix:
include:
- runner: macos-15-intel
arch: x64
- runner: macos-26
arch: arm64
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Configure Git for tests
run: |
git config --global user.name "iCode CI"
git config --global user.email "ci@icode.invalid"
git config --global init.defaultBranch main
git config --global core.autocrlf false
git config --global core.longpaths true
git config --global protocol.file.allow always
- run: pnpm install --frozen-lockfile
- run: pnpm typecheck
- run: pnpm check:brand
- run: pnpm test
- run: pnpm build
package-linux:
name: Package (Linux x64)
runs-on: ubuntu-22.04
timeout-minutes: 45
needs: unit-linux
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Packaging prerequisites
run: sudo apt-get update && sudo apt-get install -y build-essential python3 rpm
- run: pnpm install --frozen-lockfile
- name: Package AppImage, deb, and rpm
run: pnpm package:linux
- name: Verify packaged payload
run: node config/scripts/verify-package.cjs --platform linux --arch x64 --dir dist/linux-unpacked
- name: Verify update metadata
run: |
if [ -f config/scripts/verify-release-metadata.cjs ]; then
node config/scripts/verify-release-metadata.cjs --platform linux --arch x64
else
echo "Legacy tag predates in-app updates."
fi
- uses: actions/upload-artifact@v4
with:
name: linux-x64
path: |
dist/*.AppImage
dist/*.deb
dist/*.rpm
dist/latest-linux.yml
if-no-files-found: error
wsl-artifacts:
name: WSL Host artifacts
runs-on: ubuntu-22.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Build prerequisites
run: sudo apt-get update && sudo apt-get install -y build-essential python3
- run: pnpm install --frozen-lockfile
- run: pnpm build:host
- run: pnpm build:wsl-host
- run: pnpm verify:wsl-host
- run: pnpm selftest:wsl-host
- run: pnpm selftest:wsl-prepare
- uses: actions/upload-artifact@v4
with:
name: wsl-host-linux-x64
path: artifacts/wsl-host/linux-x64
if-no-files-found: error
package-windows:
name: Package (Windows x64)
runs-on: windows-2022
timeout-minutes: 45
needs: [unit-windows, wsl-artifacts]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- run: pnpm install --frozen-lockfile
- uses: actions/download-artifact@v4
with:
name: wsl-host-linux-x64
path: artifacts/wsl-host/linux-x64
- name: Package NSIS
# Signing is optional until the repository secrets exist. When they do,
# electron-builder signs both the app and the NSIS installer, and
# electron-updater verifies publisherName on future updates.
env:
CSC_LINK: ${{ secrets.WINDOWS_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.WINDOWS_CSC_KEY_PASSWORD }}
run: |
if ([string]::IsNullOrEmpty($env:CSC_LINK)) { Remove-Item Env:CSC_LINK -ErrorAction SilentlyContinue }
if ([string]::IsNullOrEmpty($env:CSC_KEY_PASSWORD)) { Remove-Item Env:CSC_KEY_PASSWORD -ErrorAction SilentlyContinue }
pnpm package:win
if ("$env:CSC_LINK" -ne "") {
$installers = Get-ChildItem dist/*.exe
if ($installers.Count -eq 0) { throw "no installer was produced" }
foreach ($installer in $installers) {
$status = (Get-AuthenticodeSignature $installer).Status
if ($status -ne "Valid") {
throw "$($installer.Name) is not validly signed: $status"
}
}
}
- name: Verify packaged payload
run: node config/scripts/verify-package.cjs --platform win --arch x64 --dir dist/win-unpacked
- name: Verify update metadata
shell: bash
run: |
if [ -f config/scripts/verify-release-metadata.cjs ]; then
node config/scripts/verify-release-metadata.cjs --platform win --arch x64
else
echo "Legacy tag predates in-app updates."
fi
- name: Packaged smoke
run: node tests/compat/packaged-smoke-win.cjs
- uses: actions/upload-artifact@v4
with:
name: windows-x64
path: |
dist/*.exe
dist/*.exe.blockmap
dist/latest.yml
if-no-files-found: error
update-e2e-windows:
name: Update E2E (Windows)
# A real NSIS install/update takes several minutes, so this is opt-in:
# set `update_e2e` when dispatching CI, or push to a PR carrying the
# `update-e2e` label. A release workflow dispatch does not set the input,
# so it never pays this cost.
if: (github.event_name == 'workflow_dispatch' && inputs.update_e2e) || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'update-e2e'))
runs-on: windows-2022
timeout-minutes: 60
needs: [package-windows]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- run: pnpm install --frozen-lockfile
- uses: actions/download-artifact@v4
with:
name: windows-x64
path: release-assets/windows
- uses: actions/download-artifact@v4
with:
name: wsl-host-linux-x64
path: artifacts/wsl-host/linux-x64
- name: Build the old installer
shell: pwsh
run: |
pnpm build:app
node -e "const fs=require('fs');const p=JSON.parse(fs.readFileSync('package.json','utf8'));p.version='0.0.1';fs.writeFileSync('package.json',JSON.stringify(p,null,2)+'\n')"
node config/scripts/package.cjs win
git checkout -- package.json
- name: Run packaged update E2E
shell: pwsh
run: |
$old = (Get-ChildItem dist/*.exe | Where-Object { $_.Name -like '*0.0.1*' } | Select-Object -First 1).FullName
$new = (Get-ChildItem release-assets/windows/*.exe | Select-Object -First 1).FullName
node tests/release/update-e2e-win.cjs --old-installer $old --new-installer $new
package-macos:
name: Package (macOS ${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
needs: unit-macos
strategy:
fail-fast: false
matrix:
include:
- runner: macos-15-intel
arch: x64
unpacked: dist/mac
- runner: macos-26
arch: arm64
unpacked: dist/mac-arm64
env:
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Build application
run: pnpm build
- name: Package dmg and zip
# Signing/notarization activate when these secrets are configured.
# Without them electron-builder produces an unsigned development build.
env:
CSC_LINK: ${{ secrets.MACOS_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.MACOS_CSC_KEY_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
# An unset secret is still an environment variable set to "". With an
# empty CSC_LINK electron-builder treats the project directory as a
# certificate path and fails with "not a file". Unset absent secrets
# so it takes its unsigned-development path instead.
[ -n "$CSC_LINK" ] || unset CSC_LINK
[ -n "$CSC_KEY_PASSWORD" ] || unset CSC_KEY_PASSWORD
[ -n "$APPLE_ID" ] || unset APPLE_ID
[ -n "$APPLE_APP_SPECIFIC_PASSWORD" ] || unset APPLE_APP_SPECIFIC_PASSWORD
[ -n "$APPLE_TEAM_ID" ] || unset APPLE_TEAM_ID
node config/scripts/package.cjs mac --${{ matrix.arch }}
- name: Verify packaged payload
run: node config/scripts/verify-package.cjs --platform mac --arch ${{ matrix.arch }} --dir ${{ matrix.unpacked }}
- name: Verify update metadata
run: |
if [ -f config/scripts/verify-release-metadata.cjs ]; then
node config/scripts/verify-release-metadata.cjs --platform mac --arch ${{ matrix.arch }}
else
echo "Legacy tag predates in-app updates."
fi
- name: Inspect packaged app
run: |
ls -leO@ "${{ matrix.unpacked }}/iCode.app/Contents/MacOS" || true
file "${{ matrix.unpacked }}/iCode.app/Contents/MacOS/iCode" || true
codesign -dv --verbose=4 "${{ matrix.unpacked }}/iCode.app" 2>&1 || true
codesign -dv --verbose=4 "${{ matrix.unpacked }}/iCode.app/Contents/Resources/app.asar.unpacked/node_modules/node-pty/prebuilds/darwin-${{ matrix.arch }}/spawn-helper" 2>&1 || true
spctl -a -vv "${{ matrix.unpacked }}/iCode.app" 2>&1 || true
- name: Verify signature when configured
env:
CSC_LINK: ${{ secrets.MACOS_CSC_LINK }}
run: |
if [ -n "$CSC_LINK" ]; then
codesign --verify --deep --strict --verbose=2 "${{ matrix.unpacked }}/iCode.app"
spctl -a -vv --type execute "${{ matrix.unpacked }}/iCode.app"
else
echo "No signing certificate configured; skipping signature verification."
fi
- name: Packaged smoke
run: node tests/compat/packaged-smoke-mac.cjs --app ${{ matrix.unpacked }}/iCode.app
- uses: actions/upload-artifact@v4
with:
name: macos-${{ matrix.arch }}
path: |
dist/*.dmg
dist/*.zip
dist/*.blockmap
dist/*.yml
if-no-files-found: error