Repository navigation
454 lines (412 loc) · 17.7 KB
/
Copy pathrelease-dry-run.yml
File metadata and controls
454 lines (412 loc) · 17.7 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
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# Rehearsal of the release build. It is its own workflow, not a mode of release.yml,
# because a workflow that checks out a ref chosen at dispatch time while running on the
# default branch, and shares caches with other runs, can have those caches poisoned
# (CodeQL actions/cache-poisoning/poisonable-step). No runtime condition removes that.
# So this one holds read-only contents permission, uses no caches, and reaches no
# publishing job.
name: Release Dry Run
on:
workflow_dispatch:
inputs:
version:
description: Semver version to name the archives with, for example 0.9.0
required: true
type: string
pull_request:
paths:
- '.github/workflows/release.yml'
- '.github/workflows/release-dry-run.yml'
- 'npm/**'
- 'crates/ffi/Cargo.toml'
- 'crates/ffi/src/**'
- 'crates/ffi/include/**'
- 'crates/linux/src/input/clipboard/**'
- 'crates/linux/src/bin/**'
- 'scripts/check-elf-glibc-floor.sh'
- 'scripts/check-elf-glibc-floor-selftest.sh'
- 'scripts/check-linux-archive-contents.sh'
- 'scripts/ffi-archive-readme-linux.md'
- 'scripts/private-session.sh'
- 'tests/linux-dist/**'
- 'tests/ffi-python/**'
- 'scripts/ci-ffi-helper-discovery-smoke.sh'
permissions: {}
concurrency:
group: release-dry-run-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
cli:
name: Dry-run CLI (${{ matrix.target }})
runs-on: ${{ matrix.runner }}
container: ${{ matrix.container }}
timeout-minutes: 30
permissions:
contents: read
env:
GLIBC_FLOOR: '2.35'
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
runner: macos-latest
- target: x86_64-apple-darwin
runner: macos-latest
- target: x86_64-unknown-linux-gnu
runner: ubuntu-24.04
container: ubuntu:22.04@sha256:0a9887931b0e38af2e3487ed39e29436b0535c4f3f52e57745baaf79d1898956
- target: aarch64-unknown-linux-gnu
runner: ubuntu-24.04-arm
container: ubuntu:22.04@sha256:0a9887931b0e38af2e3487ed39e29436b0535c4f3f52e57745baaf79d1898956
- target: x86_64-pc-windows-msvc
runner: windows-latest
- target: aarch64-pc-windows-msvc
runner: windows-11-arm
steps:
- name: Install container build tools
if: runner.os == 'Linux'
shell: bash
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt-get update
apt-get install -y --no-install-recommends ca-certificates curl build-essential git xz-utils
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install rustup (container)
if: runner.os == 'Linux'
shell: bash
run: |
set -euo pipefail
case "$(uname -m)" in
x86_64) TRIPLE=x86_64-unknown-linux-gnu ;;
aarch64) TRIPLE=aarch64-unknown-linux-gnu ;;
esac
BASE="https://static.rust-lang.org/rustup/dist/${TRIPLE}"
curl --proto '=https' --tlsv1.2 -fsSLO "${BASE}/rustup-init"
echo "$(curl --proto '=https' --tlsv1.2 -fsSL "${BASE}/rustup-init.sha256" | cut -d' ' -f1) rustup-init" | sha256sum -c -
chmod +x rustup-init
./rustup-init -y --default-toolchain none --profile minimal
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
"$HOME/.cargo/bin/rustup" toolchain install
- name: Install Rust toolchain
run: |
rustup show
rustup target add ${{ matrix.target }}
- name: Build release binary (macOS)
if: runner.os == 'macOS'
run: |
cargo build --locked --release -p agent-desktop --target ${{ matrix.target }}
cargo build --locked --release -p agent-desktop-macos --bin agent-desktop-macos-helper --target ${{ matrix.target }}
- name: Build release binary (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
cargo build --locked --release -p agent-desktop --target ${{ matrix.target }}
cargo build --locked --release -p agent-desktop-linux --bins --target ${{ matrix.target }}
- name: Build release binary (Windows)
if: runner.os == 'Windows'
run: cargo build --locked --release -p agent-desktop --target ${{ matrix.target }}
- name: Check glibc floor and size (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
LIMIT=$((15 * 1024 * 1024))
for FILE in agent-desktop agent-desktop-linux-clipboard-owner; do
PATH_TO="target/${{ matrix.target }}/release/${FILE}"
scripts/check-elf-glibc-floor.sh "${PATH_TO}" "${GLIBC_FLOOR}"
SIZE=$(stat -c%s "${PATH_TO}")
echo "${FILE} size: ${SIZE} bytes"
if [ "$SIZE" -gt "$LIMIT" ]; then
echo "FAIL: shipped executable ${FILE} exceeds 15MB limit (${SIZE} bytes)"
exit 1
fi
done
- name: Smoke-run the built binary (macOS)
if: runner.os == 'macOS'
run: target/${{ matrix.target }}/release/agent-desktop version
- name: Smoke-run the built binary (Linux)
if: runner.os == 'Linux'
shell: bash
run: target/${{ matrix.target }}/release/agent-desktop version
- name: Smoke-run the built binary (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: '& "target/${{ matrix.target }}/release/agent-desktop.exe" version'
- name: Create tarball (macOS)
if: runner.os == 'macOS'
env:
VERSION: ${{ inputs.version || format('0.0.0-pr{0}', github.event.pull_request.number) }}
run: |
TARBALL="agent-desktop-v${VERSION}-${{ matrix.target }}.tar.gz"
tar -czf "${TARBALL}" -C "target/${{ matrix.target }}/release" \
agent-desktop agent-desktop-macos-helper
tar -tzf "${TARBALL}" | sort > listing.txt
printf 'agent-desktop\nagent-desktop-macos-helper\n' | sort > expected.txt
diff -u expected.txt listing.txt
shasum -a 256 "${TARBALL}" > "${TARBALL}.sha256"
- name: Create tarball (Linux)
if: runner.os == 'Linux'
shell: bash
env:
VERSION: ${{ inputs.version || format('0.0.0-pr{0}', github.event.pull_request.number) }}
run: |
TARBALL="agent-desktop-v${VERSION}-${{ matrix.target }}.tar.gz"
tar -czf "${TARBALL}" -C "target/${{ matrix.target }}/release" \
agent-desktop agent-desktop-linux-clipboard-owner
scripts/check-linux-archive-contents.sh cli "${TARBALL}"
sha256sum "${TARBALL}" > "${TARBALL}.sha256"
- name: Create tarball (Windows)
if: runner.os == 'Windows'
shell: pwsh
env:
VERSION: ${{ inputs.version || format('0.0.0-pr{0}', github.event.pull_request.number) }}
run: |
$tarball = "agent-desktop-v${env:VERSION}-${{ matrix.target }}.tar.gz"
& tar -czf $tarball -C "target/${{ matrix.target }}/release" agent-desktop.exe
$listing = @(@(& tar -tzf $tarball) | Where-Object { $_ -ne '' })
if (@($listing).Count -ne 1 -or $listing[0] -ne 'agent-desktop.exe') {
Write-Host "FAIL: archive entries are '$($listing -join ", ")', expected exactly agent-desktop.exe"
exit 1
}
$hash = (Get-FileHash $tarball -Algorithm SHA256).Hash.ToLower()
"$hash $tarball" | Out-File -Encoding ascii "${tarball}.sha256"
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: dry-run-binary-${{ matrix.target }}
path: |
agent-desktop-v*.tar.gz
agent-desktop-v*.tar.gz.sha256
retention-days: 1
ffi:
name: Dry-run FFI (${{ matrix.target }})
runs-on: ${{ matrix.runner }}
container: ${{ matrix.container }}
timeout-minutes: 30
permissions:
contents: read
env:
GLIBC_FLOOR: '2.35'
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-24.04
container: ubuntu:22.04@sha256:0a9887931b0e38af2e3487ed39e29436b0535c4f3f52e57745baaf79d1898956
- target: aarch64-unknown-linux-gnu
runner: ubuntu-24.04-arm
container: ubuntu:22.04@sha256:0a9887931b0e38af2e3487ed39e29436b0535c4f3f52e57745baaf79d1898956
- target: x86_64-pc-windows-msvc
runner: windows-latest
- target: aarch64-pc-windows-msvc
runner: windows-11-arm
steps:
- name: Install container build tools
if: runner.os == 'Linux'
shell: bash
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt-get update
apt-get install -y --no-install-recommends ca-certificates curl build-essential git xz-utils
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install rustup (container)
if: runner.os == 'Linux'
shell: bash
run: |
set -euo pipefail
case "$(uname -m)" in
x86_64) TRIPLE=x86_64-unknown-linux-gnu ;;
aarch64) TRIPLE=aarch64-unknown-linux-gnu ;;
esac
BASE="https://static.rust-lang.org/rustup/dist/${TRIPLE}"
curl --proto '=https' --tlsv1.2 -fsSLO "${BASE}/rustup-init"
echo "$(curl --proto '=https' --tlsv1.2 -fsSL "${BASE}/rustup-init.sha256" | cut -d' ' -f1) rustup-init" | sha256sum -c -
chmod +x rustup-init
./rustup-init -y --default-toolchain none --profile minimal
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
"$HOME/.cargo/bin/rustup" toolchain install
- name: Install Rust toolchain
run: |
rustup show
rustup target add ${{ matrix.target }}
- name: Build FFI cdylib
run: >
cargo build --locked --profile release-ffi
-p agent-desktop-ffi --target ${{ matrix.target }}
- name: Build Linux clipboard owner for FFI consumers
if: runner.os == 'Linux'
shell: bash
run: cargo build --locked --release -p agent-desktop-linux --bins --target ${{ matrix.target }}
- name: Check glibc floor (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
scripts/check-elf-glibc-floor.sh "target/${{ matrix.target }}/release-ffi/libagent_desktop_ffi.so" "${GLIBC_FLOOR}"
scripts/check-elf-glibc-floor.sh "target/${{ matrix.target }}/release/agent-desktop-linux-clipboard-owner" "${GLIBC_FLOOR}"
- name: Stage and verify archive contents (Linux)
if: runner.os == 'Linux'
shell: bash
env:
VERSION: ${{ inputs.version || format('0.0.0-pr{0}', github.event.pull_request.number) }}
run: |
STAGE="agent-desktop-ffi-v${VERSION}-${{ matrix.target }}"
mkdir -p "$STAGE/lib" "$STAGE/include"
cp "target/${{ matrix.target }}/release-ffi/libagent_desktop_ffi.so" "$STAGE/lib/"
cp "target/${{ matrix.target }}/release/agent-desktop-linux-clipboard-owner" "$STAGE/lib/"
chmod +x "$STAGE/lib/agent-desktop-linux-clipboard-owner"
cp crates/ffi/include/agent_desktop.h "$STAGE/include/"
cp LICENSE "$STAGE/"
cat > "$STAGE/README.md" <<EOF
# agent-desktop FFI cdylib — v${VERSION} (${{ matrix.target }})
- \`lib/libagent_desktop_ffi.so\` — shared library
- \`include/agent_desktop.h\` — committed C ABI header
- \`LICENSE\` — Apache-2.0
Docs: https://github.com/vercel-labs/agent-desktop/tree/main/skills/agent-desktop-ffi
EOF
cat scripts/ffi-archive-readme-linux.md >> "$STAGE/README.md"
# shellcheck disable=SC2016
echo '- `lib/agent-desktop-linux-clipboard-owner` — clipboard owner helper, colocated for library-image discovery' >> "$STAGE/README.md"
(cd "$STAGE" && sha256sum lib/* include/* LICENSE > SHA256SUMS)
tar -czf "${STAGE}.tar.gz" "${STAGE}"
(cd "$STAGE" && sha256sum -c SHA256SUMS)
scripts/check-linux-archive-contents.sh ffi "${STAGE}.tar.gz"
sha256sum "${STAGE}.tar.gz" > "${STAGE}.tar.gz.sha256"
- name: Stage and verify archive contents (Windows)
if: runner.os == 'Windows'
shell: pwsh
env:
VERSION: ${{ inputs.version || format('0.0.0-pr{0}', github.event.pull_request.number) }}
run: |
$stage = "agent-desktop-ffi-v${env:VERSION}-${{ matrix.target }}"
New-Item -ItemType Directory -Path "$stage/lib", "$stage/include" | Out-Null
$out = "target/${{ matrix.target }}/release-ffi"
Copy-Item "$out/agent_desktop_ffi.dll" "$stage/lib/"
Copy-Item "$out/agent_desktop_ffi.dll.lib" "$stage/lib/"
Copy-Item "crates/ffi/include/agent_desktop.h" "$stage/include/"
foreach ($required in @('agent_desktop_ffi.dll', 'agent_desktop_ffi.dll.lib')) {
if (-not (Test-Path "$stage/lib/$required")) {
Write-Host "FAIL: $required was not staged into $stage/lib"
exit 1
}
}
Compress-Archive -Path $stage -DestinationPath "$stage.zip"
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: dry-run-ffi-${{ matrix.target }}
path: |
agent-desktop-ffi-v*.zip
agent-desktop-ffi-v*.tar.gz
agent-desktop-ffi-v*.tar.gz.sha256
retention-days: 1
linux-archives:
name: Linux archive contents (${{ matrix.target }})
needs: [cli, ffi]
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
npm_key: linux-x64
- target: aarch64-unknown-linux-gnu
npm_key: linux-arm64
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Download this target's CLI and FFI archives
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: "dry-run-{binary,ffi}-${{ matrix.target }}"
merge-multiple: true
path: archives
- name: Check the helper is in all three channels
run: |
scripts/check-linux-archive-contents.sh all \
archives/agent-desktop-v*-${{ matrix.target }}.tar.gz \
archives/agent-desktop-ffi-v*-${{ matrix.target }}.tar.gz \
${{ matrix.npm_key }}
linux-consumer:
defaults:
run:
shell: bash
name: Linux consumer (${{ matrix.target }})
needs: [cli, ffi]
if: ${{ !cancelled() }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-24.04
- target: aarch64-unknown-linux-gnu
runner: ubuntu-24.04-arm
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '24'
- name: Download this architecture's CLI and FFI archives
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: "dry-run-{binary,ffi}-${{ matrix.target }}"
merge-multiple: true
path: archives
- name: Extract both archives into clean directories
run: |
set -euo pipefail
for KIND in agent-desktop-v agent-desktop-ffi-v; do
ARCHIVE=$(ls archives/${KIND}*-${{ matrix.target }}.tar.gz)
DIR="extracted/${KIND}"
mkdir -p "$DIR"
tar -xzf "$ARCHIVE" -C "$DIR"
done
find extracted -maxdepth 3 | sort
- name: Install the session and observer packages
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
at-spi2-core dbus-x11 xvfb x11-utils openbox gnome-calculator \
python3-gi gir1.2-atspi-2.0 gir1.2-gtk-3.0 gcc
- name: Deterministic packaged owner contracts
run: |
python3 -I -m unittest discover -s tests/ffi-python -p 'test_linux_helper.py'
python3 -I -m unittest discover -s tests/linux-dist -p 'test_*.py'
- name: FFI library-adjacent helper discovery from this archive
run: |
set -euo pipefail
FFI_DIR=$(ls -d extracted/agent-desktop-ffi-v/agent-desktop-ffi-v*)
mkdir -p target/release-ffi target/release
cp "$FFI_DIR/lib/libagent_desktop_ffi.so" target/release-ffi/
cp "$FFI_DIR/lib/agent-desktop-linux-clipboard-owner" target/release/
AGENT_DESKTOP_WM_ROOT=/ scripts/private-session.sh --wm -- \
scripts/ci-ffi-helper-discovery-smoke.sh
- name: Real C consumer against the extracted FFI archive
run: |
AGENT_DESKTOP_WM_ROOT=/ scripts/private-session.sh --wm -- \
tests/linux-dist/run-consumer.sh "$(ls -d extracted/agent-desktop-ffi-v/agent-desktop-ffi-v*)"
- name: Packed npm install from the extracted CLI archive
run: |
AGENT_DESKTOP_WM_ROOT=/ scripts/private-session.sh --wm -- \
tests/linux-dist/run-npm-install.sh "archives"