-
-
Notifications
You must be signed in to change notification settings - Fork 154
436 lines (422 loc) · 18.4 KB
/
release.yml
File metadata and controls
436 lines (422 loc) · 18.4 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
# adapted from https://github.com/taiki-e/cargo-hack/blob/main/.github/workflows/release.yml
name: Publish releases to GitHub
on:
push:
tags:
- "*"
permissions: {}
jobs:
nextest-filtering-release:
permissions:
contents: write
environment: release
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'nextest-filtering-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo release
uses: taiki-e/install-action@c12d62a803cbdfe2e7263af15f5a9548065cb4f2 # v2.69.3
with:
tool: cargo-release@0.25.0
- uses: taiki-e/create-gh-release-action@c5baa0b5dc700cf06439d87935e130220a6882d9 # v1.9.3
with:
prefix: nextest-filtering
changelog: nextest-filtering/CHANGELOG.md
title: $prefix $version
branch: main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./scripts/cargo-release-publish.sh
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
nextest-metadata-release:
permissions:
contents: write
environment: release
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'nextest-metadata-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo release
uses: taiki-e/install-action@c12d62a803cbdfe2e7263af15f5a9548065cb4f2 # v2.69.3
with:
tool: cargo-release@0.25.0
- uses: taiki-e/create-gh-release-action@c5baa0b5dc700cf06439d87935e130220a6882d9 # v1.9.3
with:
prefix: nextest-metadata
changelog: nextest-metadata/CHANGELOG.md
title: $prefix $version
branch: main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./scripts/cargo-release-publish.sh
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
nextest-runner-release:
permissions:
contents: write
environment: release
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'nextest-runner-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo release
uses: taiki-e/install-action@c12d62a803cbdfe2e7263af15f5a9548065cb4f2 # v2.69.3
with:
tool: cargo-release@0.25.0
- uses: taiki-e/create-gh-release-action@c5baa0b5dc700cf06439d87935e130220a6882d9 # v1.9.3
with:
prefix: nextest-runner
# No need for a changelog -- use the cargo-nextest changelog instead.
title: $prefix $version
branch: main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./scripts/cargo-release-publish.sh
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo-nextest-release:
permissions:
contents: write
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'cargo-nextest-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
# Note: do not publish this until binaries are built and uploaded below. This is so that
# `cargo binstall` keeps working.
- uses: taiki-e/create-gh-release-action@c5baa0b5dc700cf06439d87935e130220a6882d9 # v1.9.3
id: create-gh-release
with:
prefix: cargo-nextest
# The changelog for cargo-nextest is hosted on the website
changelog: site/src/changelog.md
title: $prefix $version
branch: main
# Uploads can't be made to immutable releases, so we set this to draft for now.
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
version: ${{ steps.create-gh-release.outputs.version }}
build-cargo-nextest-binaries:
name: Build cargo-nextest binaries for ${{ matrix.target }}
permissions:
contents: write
environment: release
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'cargo-nextest-')
needs:
- cargo-nextest-release
strategy:
matrix:
include:
# Native builds
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
# On Linux, we use glibc 2.27, as the minimum of
# - Ubuntu 18.04 (glibc 2.27)
# - CentOS 8 (glibc 2.28)
# - Debian 10 (glibc 2.28)
#
# See https://repology.org/project/glibc/versions.
#
# We used to use an Ubuntu 18.04 container, but that became untenable over time:
# https://github.com/nextest-rs/nextest/issues/1055
build-target: x86_64-unknown-linux-gnu.2.27
build-tool: cargo-zigbuild
dry-run: false
- target: x86_64-pc-windows-msvc
os: windows-latest
build-target: x86_64-pc-windows-msvc
build-tool: cargo
# The Windows builds go through a signing process, so we set dry-run
# in the upload-rust-binary-action to true
dry-run: true
- target: i686-pc-windows-msvc
os: windows-latest
build-target: i686-pc-windows-msvc
build-tool: cargo
dry-run: true
- target: aarch64-pc-windows-msvc
os: windows-latest
build-target: aarch64-pc-windows-msvc
build-tool: cargo
dry-run: true
- target: universal-apple-darwin
# macos-14 for M1 runners
os: macos-14
build-target: universal-apple-darwin
build-tool: cargo
dry-run: false
# Builds using cross
- target: x86_64-unknown-linux-musl
os: ubuntu-22.04
build-target: x86_64-unknown-linux-musl
# musl is statically linked and uses cross
build-tool: cross
dry-run: false
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
build-target: aarch64-unknown-linux-gnu
build-tool: cross
dry-run: false
- target: aarch64-unknown-linux-musl
os: ubuntu-22.04
build-target: aarch64-unknown-linux-musl
# musl is statically linked and uses cross
build-tool: cross
dry-run: false
- target: riscv64gc-unknown-linux-gnu
os: ubuntu-22.04
build-target: riscv64gc-unknown-linux-gnu
build-tool: cross
dry-run: false
- target: x86_64-unknown-freebsd
os: ubuntu-22.04
build-target: x86_64-unknown-freebsd
build-tool: cross
dry-run: false
- target: x86_64-unknown-illumos
os: ubuntu-22.04
build-target: x86_64-unknown-illumos
build-tool: cross
dry-run: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install b2sum on macOS
if: startsWith(matrix.os, 'macos')
run: |
brew install b2sum
- uses: taiki-e/upload-rust-binary-action@0e34102c043ded9f2ca39f7af5cd99a540c61aff # v1.29.1
with:
bin: cargo-nextest
# The tag name contains the binary name so just use that.
archive: $tag-$target
build-tool: ${{ matrix.build-tool }}
target: ${{ matrix.build-target }}
tar: all
checksum: b2,sha256
dry-run: ${{ matrix.dry-run }}
dry-run-intended: ${{ matrix.dry-run }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_PROFILE_RELEASE_LTO: true
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
- name: Install just on Windows
if: endsWith(matrix.target, '-pc-windows-msvc')
uses: taiki-e/install-action@c12d62a803cbdfe2e7263af15f5a9548065cb4f2 # v2.69.3
with:
tool: just
- name: Download verpatch on Windows
if: endsWith(matrix.target, '-pc-windows-msvc')
shell: bash
run: |
set -x
mkdir -p target/unsigned
cd target/unsigned
cp ../${{ matrix.build-target }}/release/cargo-nextest.exe .
curl -LsSfO "https://github.com/nextest-rs/mukti/releases/download/verpatch-1.0.10/verpatch-bin-1.0.10.zip"
unzip verpatch-bin-1.0.10.zip
- name: Add metadata to Windows binary
if: endsWith(matrix.target, '-pc-windows-msvc')
# Bash seems to screw up argument parsing for verpatch. We really should
# rewrite this tool in Rust at some point.
shell: powershell
env:
REF_NAME: ${{ github.ref_name }}
run: |
cd target/unsigned
# Extract version from ref_name, e.g. cargo-nextest-0.9.97 -> 0.9.97
$refName = $env:REF_NAME
if ($refName -match "^cargo-nextest-(.+)$") {
$version = $Matches[1]
} else {
Write-Error "Could not extract version from ref_name: $refName"
exit 1
}
.\verpatch.exe /va .\cargo-nextest.exe `
$version /high `
/pv $version `
/s product "cargo-nextest" `
/s "(c)" "(c) The nextest Contributors. License: MIT OR Apache-2.0"
- name: Get the Windows signing policy slug
if: endsWith(matrix.target, '-pc-windows-msvc')
id: get-signing-policy-slug
shell: bash
env:
REF_NAME: ${{ github.ref_name }}
run: |
just win-signing-policy-slug "${REF_NAME}" >> "${GITHUB_OUTPUT}"
- name: Upload unsigned Windows artifact
id: upload-unsigned-artifact
if: endsWith(matrix.target, '-pc-windows-msvc')
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: ${{ matrix.target }}-unsigned
path: target/unsigned/cargo-nextest.exe
- run: mkdir -p target/signed
if: endsWith(matrix.target, '-pc-windows-msvc')
- name: Submit Windows artifact signing request
id: submit-signing-request
if: endsWith(matrix.target, '-pc-windows-msvc')
uses: signpath/github-action-submit-signing-request@3f9250c56651ff692d6729a2fbb0603a42d7d322 # v2.0
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: '34634019-2ee0-4162-830a-72cd1a0cb73f'
project-slug: 'nextest'
signing-policy-slug: '${{ steps.get-signing-policy-slug.outputs.signing-policy-slug }}'
github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}'
wait-for-completion: true
output-artifact-directory: 'target/signed'
- name: Archive and upload Windows artifacts
id: archive-windows-artifact
if: endsWith(matrix.target, '-pc-windows-msvc')
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REF_NAME: ${{ github.ref_name }}
TARGET: ${{ matrix.target }}
run: ./scripts/archive-and-upload-windows.sh cargo-nextest.exe
- name: Set archive output variable
id: archive-output
shell: bash
env:
REF_NAME: ${{ github.ref_name }}
TARGET: ${{ matrix.target }}
run: ./scripts/set-archive-output.sh
outputs:
x86_64-linux-tar: ${{ steps.archive-output.outputs.x86_64-unknown-linux-gnu-tar }}
x86_64-linux-musl-tar: ${{ steps.archive-output.outputs.x86_64-unknown-linux-musl-tar }}
aarch64-linux-tar: ${{ steps.archive-output.outputs.aarch64-unknown-linux-gnu-tar }}
aarch64-linux-musl-tar: ${{ steps.archive-output.outputs.aarch64-unknown-linux-musl-tar }}
riscv64gc-linux-tar: ${{ steps.archive-output.outputs.riscv64gc-unknown-linux-gnu-tar }}
x86_64-windows-tar: ${{ steps.archive-output.outputs.x86_64-pc-windows-msvc-tar }}
x86_64-windows-zip: ${{ steps.archive-output.outputs.x86_64-pc-windows-msvc-zip }}
i686-windows-tar: ${{ steps.archive-output.outputs.i686-pc-windows-msvc-tar }}
i686-windows-zip: ${{ steps.archive-output.outputs.i686-pc-windows-msvc-zip }}
aarch64-windows-tar: ${{ steps.archive-output.outputs.aarch64-pc-windows-msvc-tar }}
aarch64-windows-zip: ${{ steps.archive-output.outputs.aarch64-pc-windows-msvc-zip }}
mac-tar: ${{ steps.archive-output.outputs.universal-apple-darwin-tar }}
x86_64-unknown-freebsd-tar: ${{ steps.archive-output.outputs.x86_64-unknown-freebsd-tar }}
x86_64-unknown-illumos-tar: ${{ steps.archive-output.outputs.x86_64-unknown-illumos-tar }}
update-release-meta:
name: Update release-meta branch and publish to crates.io
permissions:
contents: write
environment: release
if: github.repository_owner == 'nextest-rs'
needs:
- cargo-nextest-release
- build-cargo-nextest-binaries
runs-on: ubuntu-latest
steps:
- name: Clone nextest repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
path: nextest
- name: Clone release-meta repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# Credentials are needed for git push later in this job.
persist-credentials: true
repository: nextest-rs/release-meta
ref: main
token: ${{ secrets.RELEASE_META_DEPLOY_TOKEN }}
path: release-meta
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo release
uses: taiki-e/install-action@c12d62a803cbdfe2e7263af15f5a9548065cb4f2 # v2.69.3
with:
tool: cargo-release@0.25.0
# The GitHub release must be marked as published (immutable) before Mukti
# metadata is generated, since that fetches release artifacts based on the
# tag name (which isn't available until the release is created).
- name: Mark GitHub release published
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REF_NAME: ${{ github.ref_name }}
run: |
cd nextest
gh release edit "${REF_NAME}" --draft=false
- name: Download mukti
run: |
mkdir -p ~/bin
curl -LsSf "https://github.com/nextest-rs/mukti/releases/download/mukti-bin-0.7.8/mukti-bin-0.7.8-x86_64-unknown-linux-musl.tar.gz" \
| tar xzf - -C ~/bin
- name: Add release metadata
env:
REF_NAME: ${{ github.ref_name }}
VERSION: ${{ needs.cargo-nextest-release.outputs.version }}
ARCHIVE_X86_64_LINUX_TAR: ${{ needs.build-cargo-nextest-binaries.outputs.x86_64-linux-tar }}
ARCHIVE_X86_64_LINUX_MUSL_TAR: ${{ needs.build-cargo-nextest-binaries.outputs.x86_64-linux-musl-tar }}
ARCHIVE_AARCH64_LINUX_TAR: ${{ needs.build-cargo-nextest-binaries.outputs.aarch64-linux-tar }}
ARCHIVE_AARCH64_LINUX_MUSL_TAR: ${{ needs.build-cargo-nextest-binaries.outputs.aarch64-linux-musl-tar }}
ARCHIVE_RISCV64GC_LINUX_TAR: ${{ needs.build-cargo-nextest-binaries.outputs.riscv64gc-linux-tar }}
ARCHIVE_X86_64_WINDOWS_TAR: ${{ needs.build-cargo-nextest-binaries.outputs.x86_64-windows-tar }}
ARCHIVE_X86_64_WINDOWS_ZIP: ${{ needs.build-cargo-nextest-binaries.outputs.x86_64-windows-zip }}
ARCHIVE_I686_WINDOWS_TAR: ${{ needs.build-cargo-nextest-binaries.outputs.i686-windows-tar }}
ARCHIVE_I686_WINDOWS_ZIP: ${{ needs.build-cargo-nextest-binaries.outputs.i686-windows-zip }}
ARCHIVE_AARCH64_WINDOWS_TAR: ${{ needs.build-cargo-nextest-binaries.outputs.aarch64-windows-tar }}
ARCHIVE_AARCH64_WINDOWS_ZIP: ${{ needs.build-cargo-nextest-binaries.outputs.aarch64-windows-zip }}
ARCHIVE_MAC_TAR: ${{ needs.build-cargo-nextest-binaries.outputs.mac-tar }}
ARCHIVE_X86_64_FREEBSD_TAR: ${{ needs.build-cargo-nextest-binaries.outputs.x86_64-unknown-freebsd-tar }}
ARCHIVE_X86_64_ILLUMOS_TAR: ${{ needs.build-cargo-nextest-binaries.outputs.x86_64-unknown-illumos-tar }}
run: ./scripts/add-release-metadata.sh
- name: Generate redirects
run: |
cd release-meta
~/bin/mukti-bin --json releases.json generate-redirects --flavor cloudflare . \
--alias linux=x86_64-unknown-linux-gnu:tar.gz \
--alias linux-musl=x86_64-unknown-linux-musl:tar.gz \
--alias linux-arm=aarch64-unknown-linux-gnu:tar.gz \
--alias linux-arm-musl=aarch64-unknown-linux-musl:tar.gz \
--alias linux-riscv64=riscv64gc-unknown-linux-gnu:tar.gz \
--alias windows=x86_64-pc-windows-msvc:zip \
--alias windows-tar=x86_64-pc-windows-msvc:tar.gz \
--alias windows-x86=i686-pc-windows-msvc:zip \
--alias windows-x86-tar=i686-pc-windows-msvc:tar.gz \
--alias windows-arm=aarch64-pc-windows-msvc:zip \
--alias windows-arm-tar=aarch64-pc-windows-msvc:tar.gz \
--alias mac=universal-apple-darwin:tar.gz \
--alias freebsd=x86_64-unknown-freebsd:tar.gz \
--alias illumos=x86_64-unknown-illumos:tar.gz \
- name: Add extra redirects
run: |
cat nextest/site/release-meta-static/extra-redirects >> release-meta/_redirects
- name: Update release-meta repo
env:
REF_NAME: ${{ github.ref_name }}
run: |
cd release-meta
git config user.email "bot@nexte.st"
git config user.name "Nextest Bot"
git pull --autostash --rebase origin main
git add releases.json _redirects
git commit -m "Update release metadata for ${REF_NAME}"
git push origin HEAD:main
- name: Run cargo-release-publish.sh
run: |
cd nextest
PUBLISH_CARGO_NEXTEST=1 ./scripts/cargo-release-publish.sh
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}