-
-
Notifications
You must be signed in to change notification settings - Fork 99
299 lines (290 loc) · 13 KB
/
release.yml
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
# adapted from https://github.com/taiki-e/cargo-hack/blob/main/.github/workflows/release.yml
name: Publish releases to GitHub
on:
push:
tags:
- '*'
jobs:
quick-junit-release:
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'quick-junit-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo release
uses: baptiste0928/cargo-install@2cfb0024938d23011106cbf127b393bc83fddba1 # v1
with:
crate: cargo-release
# Version 0.21.4 has the idempotency behavior we want, until
# https://github.com/crate-ci/cargo-release/issues/594 is addressed.
version: =0.21.4
locked: true
- uses: taiki-e/create-gh-release-action@8df4de6534ceacdaed10a08f73418ca751f31793 # v1
with:
prefix: quick-junit
changelog: quick-junit/CHANGELOG.md
title: $prefix $version
branch: main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./scripts/cargo-release-publish.sh --exclude cargo-nextest
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
nextest-filtering-release:
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'nextest-filtering-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo release
uses: baptiste0928/cargo-install@2cfb0024938d23011106cbf127b393bc83fddba1 # v1
with:
crate: cargo-release
version: =0.21.4
locked: true
- uses: taiki-e/create-gh-release-action@8df4de6534ceacdaed10a08f73418ca751f31793 # v1
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 --exclude cargo-nextest
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
nextest-metadata-release:
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'nextest-metadata-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo release
uses: baptiste0928/cargo-install@2cfb0024938d23011106cbf127b393bc83fddba1 # v1
with:
crate: cargo-release
version: =0.21.4
locked: true
- uses: taiki-e/create-gh-release-action@8df4de6534ceacdaed10a08f73418ca751f31793 # v1
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 --exclude cargo-nextest
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
nextest-runner-release:
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'nextest-runner-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo release
uses: baptiste0928/cargo-install@2cfb0024938d23011106cbf127b393bc83fddba1 # v1
with:
crate: cargo-release
version: =0.21.4
locked: true
- uses: taiki-e/create-gh-release-action@8df4de6534ceacdaed10a08f73418ca751f31793 # v1
with:
prefix: nextest-runner
changelog: nextest-runner/CHANGELOG.md
title: $prefix $version
branch: main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./scripts/cargo-release-publish.sh --exclude cargo-nextest
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo-nextest-release:
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'cargo-nextest-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
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@8df4de6534ceacdaed10a08f73418ca751f31793 # v1
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
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 }}
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
container: ghcr.io/nextest-rs/ubuntu-18.04:1.0.0
- target: x86_64-pc-windows-msvc
os: windows-latest
container:
- target: i686-pc-windows-msvc
os: windows-latest
container:
- target: universal-apple-darwin
os: macos-latest
container:
# Builds using cross
- target: x86_64-unknown-linux-musl
os: ubuntu-22.04
# musl is statically linked and uses cross
container:
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
# uses cross
container:
- target: x86_64-unknown-freebsd
os: ubuntu-22.04
# uses cross
container:
- target: x86_64-unknown-illumos
os: ubuntu-22.04
# uses cross
container:
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- if: matrix.container == 'ghcr.io/nextest-rs/ubuntu-18.04:1.0.0'
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/upload-rust-binary-action@f6b013bbda0fb47fb0e7a25a1e437b51971fb241 # v1
with:
bin: cargo-nextest
# The tag name contains the binary name so just use that.
archive: $tag-$target
target: ${{ matrix.target }}
tar: all
zip: windows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_PROFILE_RELEASE_LTO: true
- name: Set archive output variable
id: archive-output
shell: bash
run: |
if [[ ${{ matrix.target }} == "x86_64-pc-windows-msvc" || ${{ matrix.target }} == "i686-pc-windows-msvc" ]]; then
echo "${{ matrix.target }}-tar=${{ github.ref_name }}-${{ matrix.target }}".tar.gz >> $GITHUB_OUTPUT
echo "${{ matrix.target }}-zip=${{ github.ref_name }}-${{ matrix.target }}".zip >> $GITHUB_OUTPUT
else
echo "${{ matrix.target }}-tar=${{ github.ref_name }}-${{ matrix.target }}".tar.gz >> $GITHUB_OUTPUT
fi
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 }}
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 }}
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
if: github.repository_owner == 'nextest-rs'
needs:
- cargo-nextest-release
- build-cargo-nextest-binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo release
uses: baptiste0928/cargo-install@2cfb0024938d23011106cbf127b393bc83fddba1 # v1
with:
crate: cargo-release
version: =0.21.4
locked: true
- name: Download mukti
run: |
mkdir -p ~/bin
curl -LsSf "https://github.com/nextest-rs/mukti/releases/download/mukti-bin-0.6.0/mukti-bin-0.6.0-x86_64-unknown-linux-gnu.tar.gz" \
| tar xzf - -C ~/bin
- name: Add release metadata
run: |
~/bin/mukti-bin add-release --version ${{ needs.cargo-nextest-release.outputs.version }} \
--release-url "https://github.com/nextest-rs/nextest/releases/${{ github.ref_name }}" \
--archive-prefix "https://github.com/nextest-rs/nextest/releases/download/${{ github.ref_name }}" \
--archive x86_64-unknown-linux-gnu:tar.gz=${{ needs.build-cargo-nextest-binaries.outputs.x86_64-linux-tar }} \
--archive x86_64-unknown-linux-musl:tar.gz=${{ needs.build-cargo-nextest-binaries.outputs.x86_64-linux-musl-tar }} \
--archive aarch64-unknown-linux-gnu:tar.gz=${{ needs.build-cargo-nextest-binaries.outputs.aarch64-linux-tar }} \
--archive x86_64-pc-windows-msvc:tar.gz=${{ needs.build-cargo-nextest-binaries.outputs.x86_64-windows-tar }} \
--archive x86_64-pc-windows-msvc:zip=${{ needs.build-cargo-nextest-binaries.outputs.x86_64-windows-zip }} \
--archive i686-pc-windows-msvc:tar.gz=${{ needs.build-cargo-nextest-binaries.outputs.i686-windows-tar }} \
--archive i686-pc-windows-msvc:zip=${{ needs.build-cargo-nextest-binaries.outputs.i686-windows-zip }} \
--archive universal-apple-darwin:tar.gz=${{ needs.build-cargo-nextest-binaries.outputs.mac-tar }} \
--archive x86_64-unknown-freebsd:tar.gz=${{ needs.build-cargo-nextest-binaries.outputs.x86_64-unknown-freebsd-tar }} \
--archive x86_64-unknown-illumos:tar.gz=${{ needs.build-cargo-nextest-binaries.outputs.x86_64-unknown-illumos-tar }} \
- name: Generate netlify redirects
run: |
mkdir out-dir
~/bin/mukti-bin generate-netlify out-dir \
--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 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 mac=universal-apple-darwin:tar.gz \
--alias freebsd=x86_64-unknown-freebsd:tar.gz \
--alias illumos=x86_64-unknown-illumos:tar.gz \
- name: Update releases.json on main branch
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions"
git pull --autostash --rebase origin main
git add .releases.json
git commit -m "Update release metadata for ${{ github.ref_name }}"
git push origin HEAD:main
- name: Copy releases.json to output dir
run: |
cp .releases.json out-dir/releases.json
- name: Copy static files to output dir
# Note trailing slash after release-meta-static is important
run: |
rsync -avH site/release-meta-static/ out-dir
- name: Deploy release metadata
uses: JamesIves/github-pages-deploy-action@a1ea191d508feb8485aceba848389d49f80ca2dc # v4
with:
branch: release-meta
folder: out-dir
# cargo release requires the working dir to not have any untracked files, hence the git clean.
- run: |
git clean -fdx
./scripts/cargo-release-publish.sh
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}