Repository navigation
364 lines (313 loc) · 12.3 KB
/
Copy pathbuild.yml
File metadata and controls
364 lines (313 loc) · 12.3 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
name: Build releases
on:
push:
tags:
- 'v*'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
BENCHUP_UPDATE_REPOSITORY: ${{ github.repository }}
CARGO_TERM_COLOR: always
VPK_VERSION: '1.2.161'
TRUNK_VERSION: '0.22.0'
TRUNK_SHA256: 'f78c1989240c56592d8cfc4df5cc27399a3ff66a3f9cc819e16f1e3d809ce7c2'
jobs:
validate:
name: Validate release version
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Validate tag and packaging helpers
env:
TAG_NAME: ${{ github.ref_name }}
run: |
python scripts/desktop_release.py version --tag "$TAG_NAME"
python -m unittest discover -s scripts -p 'test_install_linux_dependencies.py'
python -m unittest discover -s scripts -p 'test_install_linux_desktop.py'
python -m unittest discover -s scripts -p 'test_desktop_release.py'
python -m unittest discover -s scripts -p 'test_verify_update_transfer.py'
- name: Verify old updater URLs survived the repository transfer
env:
SOURCE_REPOSITORY: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
run: python scripts/verify_update_transfer.py --repository "$SOURCE_REPOSITORY"
build:
name: Build ${{ matrix.platform }}
needs: validate
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- platform: windows-x64
os: windows-2022
target: x86_64-pc-windows-msvc
executable: benchup-app.exe
- platform: macos-arm64
os: macos-15
target: aarch64-apple-darwin
executable: benchup-app
- platform: macos-x64
os: macos-15-intel
target: x86_64-apple-darwin
executable: benchup-app
- platform: linux-x64
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
executable: benchup-app
defaults:
run:
shell: bash
env:
TAG_NAME: ${{ github.ref_name }}
# Match packaging/macos/Info.plist for Rust and the native C/C++ reader.
MACOSX_DEPLOYMENT_TARGET: '11.0'
BENCHUP_REQUIRE_SIGNING: ${{ vars.BENCHUP_REQUIRE_SIGNING || vars.KETCHUP_REQUIRE_SIGNING }}
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
WINDOWS_AZURE_SIGNING: ${{ secrets.WINDOWS_AZURE_SIGNING }}
MACOS_SIGN_APP_IDENTITY: ${{ secrets.MACOS_SIGN_APP_IDENTITY }}
MACOS_SIGN_INSTALL_IDENTITY: ${{ secrets.MACOS_SIGN_INSTALL_IDENTITY }}
steps:
- name: Check out repository
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo python3 scripts/install_linux_dependencies.py \
build-essential pkg-config libx11-dev libxcb1-dev \
libxkbcommon-dev libwayland-dev libegl1-mesa-dev libudev-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@1.97.1
with:
targets: ${{ matrix.target }}
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install packaging SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: '8.0.x'
- name: Install pinned Velopack tool
run: dotnet tool install --global vpk --version "$VPK_VERSION"
- name: Authenticate Windows signing
if: runner.os == 'Windows' && env.AZURE_CREDENTIALS != ''
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Configure macOS signing
if: runner.os == 'macOS'
env:
MACOS_CERTIFICATES_P12: ${{ secrets.MACOS_CERTIFICATES_P12 }}
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }}
run: python scripts/configure_macos_signing.py
- name: Set up compiler cache
uses: ./.github/actions/setup-compiler-cache
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
# Restore dependencies warmed on main; tag-scoped caches cannot be
# reused by the next release tag.
shared-key: desktop-${{ matrix.target }}
save-if: 'false'
- name: Build release executable
run: bash scripts/ci_cargo.sh build -p benchup-app --bin benchup-app --release --locked --target "${{ matrix.target }}"
- name: Stage distribution
run: |
mkdir -p dist package/licenses/skp
cp "target/${{ matrix.target }}/release/${{ matrix.executable }}" package/
cp LICENSE README.md package/
cp crates/benchup-io/vendor/skp/LICENSE* package/licenses/skp/
cp crates/benchup-skp/vendor/openskp/miniz/LICENSE package/licenses/skp/LICENSE-miniz
- name: Create installer and update feed
run: python scripts/desktop_release.py package --tag "$TAG_NAME" --platform "${{ matrix.platform }}"
- name: Remove temporary macOS keychain
if: always() && runner.os == 'macOS'
run: |
if [ -f "$RUNNER_TEMP/benchup-signing.keychain-db" ]; then
security delete-keychain "$RUNNER_TEMP/benchup-signing.keychain-db"
fi
- name: Upload build artifact
uses: actions/upload-artifact@v7
with:
name: benchup-${{ matrix.platform }}
path: dist/*
if-no-files-found: error
retention-days: 14
compression-level: 0
test:
name: Test ${{ matrix.platform }} release compatibility
needs: validate
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- platform: windows-x64
os: windows-2022
target: x86_64-pc-windows-msvc
- platform: macos-arm64
os: macos-15
target: aarch64-apple-darwin
- platform: macos-x64
os: macos-15-intel
target: x86_64-apple-darwin
- platform: linux-x64
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
defaults:
run:
shell: bash
env:
MACOSX_DEPLOYMENT_TARGET: '11.0'
steps:
- name: Check out repository
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo python3 scripts/install_linux_dependencies.py \
build-essential pkg-config libx11-dev libxcb1-dev \
libxkbcommon-dev libwayland-dev libegl1-mesa-dev libudev-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@1.97.1
with:
targets: ${{ matrix.target }}
- name: Set up compiler cache
uses: ./.github/actions/setup-compiler-cache
- name: Cache Rust test dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: desktop-${{ matrix.target }}
save-if: 'false'
- name: Test updates, identity migration, and project compatibility
run: |
bash scripts/ci_cargo.sh test -p benchup-app --lib --profile ci-test --locked --target "${{ matrix.target }}" -- \
updates:: update_repository:: identity:: storage:: project_files:: server_config::
- name: Test native import and export fixtures
run: bash scripts/ci_cargo.sh test -p benchup-io -p benchup-skp --profile ci-test --locked --target "${{ matrix.target }}"
# Includes the replay of the agent evaluation's reference solutions
# (crates/benchup-cli/tests/evals.rs); the agent rounds themselves are run on demand.
- name: Test the agent tools and command line
run: bash scripts/ci_cargo.sh test -p benchup-tools -p benchup-cli --profile ci-test --locked --target "${{ matrix.target }}"
wasm:
name: Build WebAssembly
needs: validate
runs-on: ubuntu-24.04
timeout-minutes: 45
env:
TAG_NAME: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Install Rust and WebAssembly target
uses: dtolnay/rust-toolchain@1.97.1
with:
targets: wasm32-unknown-unknown
- name: Set up compiler cache
uses: ./.github/actions/setup-compiler-cache
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: release-wasm
save-if: 'false'
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install pinned prebuilt Trunk
run: |
archive="$RUNNER_TEMP/trunk.tar.gz"
curl --fail --location --retry 3 --output "$archive" \
"https://github.com/trunk-rs/trunk/releases/download/v${TRUNK_VERSION}/trunk-x86_64-unknown-linux-gnu.tar.gz"
printf '%s %s\n' "$TRUNK_SHA256" "$archive" | sha256sum --check --strict
mkdir -p "$RUNNER_TEMP/benchup-trunk"
tar -xzf "$archive" -C "$RUNNER_TEMP/benchup-trunk" trunk
echo "$RUNNER_TEMP/benchup-trunk" >> "$GITHUB_PATH"
"$RUNNER_TEMP/benchup-trunk/trunk" --version
- name: Build browser app
run: trunk build --release --locked --dist dist/wasm --public-url ./
- name: Package browser app and assets
run: |
test -s dist/wasm/index.html
test -n "$(find dist/wasm -name '*.wasm' -size +0c -print -quit)"
test -n "$(find dist/wasm -name '*.js' -size +0c -print -quit)"
cp LICENSE README.md dist/wasm/
mkdir -p dist/wasm/licenses/skp
cp crates/benchup-io/vendor/skp/LICENSE* dist/wasm/licenses/skp/
cp crates/benchup-skp/vendor/openskp/miniz/LICENSE dist/wasm/licenses/skp/LICENSE-miniz
python3 - <<'PY'
import os
import shutil
shutil.make_archive(f"dist/benchup-{os.environ['TAG_NAME']}-wasm", "zip", "dist/wasm")
PY
- name: Upload WebAssembly artifact
uses: actions/upload-artifact@v7
with:
name: benchup-wasm
path: dist/benchup-*-wasm.zip
if-no-files-found: error
retention-days: 14
compression-level: 0
release:
name: Publish GitHub Release
needs: [build, test, wasm]
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: write
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Download desktop and WebAssembly packages
uses: actions/download-artifact@v8
with:
pattern: benchup-*
path: dist
merge-multiple: true
- name: Validate all platforms, remove packaging metadata, and checksum release files
env:
TAG_NAME: ${{ github.ref_name }}
run: |
test -s "dist/benchup-${TAG_NAME}-wasm.zip"
python scripts/desktop_release.py validate --tag "$TAG_NAME"
- name: Publish release with desktop and WebAssembly packages
shell: bash
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
TAG_NAME: ${{ github.ref_name }}
run: |
python scripts/desktop_release.py notes --tag "$TAG_NAME" > "$RUNNER_TEMP/release-notes.md"
if gh release view "$TAG_NAME" > /dev/null 2>&1; then
is_draft=$(gh release view "$TAG_NAME" --json isDraft --jq '.isDraft')
if [ "$is_draft" != true ]; then
echo "This version is already published. Bump Cargo.toml and publish a new tag."
exit 1
fi
else
gh release create "$TAG_NAME" --verify-tag --draft \
--title "$TAG_NAME" --notes-file "$RUNNER_TEMP/release-notes.md"
fi
gh release upload "$TAG_NAME" dist/* --clobber
gh release edit "$TAG_NAME" --notes-file "$RUNNER_TEMP/release-notes.md" --draft=false --latest