-
-
Notifications
You must be signed in to change notification settings - Fork 99
286 lines (276 loc) · 12.5 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
# adapted from https://github.com/taiki-e/cargo-hack/blob/main/.github/workflows/release.yml
name: Publish releases to GitHub
on:
push:
tags:
- "*"
jobs:
nextest-filtering-release:
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'nextest-filtering-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo release
uses: taiki-e/install-action@03381f5ca4d069c7f756fec5d189e036987f842e # v2
with:
tool: [email protected]
- uses: taiki-e/create-gh-release-action@72d65cee1f8033ef0c8b5d79eaf0c45c7c578ce3 # 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
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo release
uses: taiki-e/install-action@03381f5ca4d069c7f756fec5d189e036987f842e # v2
with:
tool: [email protected]
- uses: taiki-e/create-gh-release-action@72d65cee1f8033ef0c8b5d79eaf0c45c7c578ce3 # 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
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo release
uses: taiki-e/install-action@03381f5ca4d069c7f756fec5d189e036987f842e # v2
with:
tool: [email protected]
- uses: taiki-e/create-gh-release-action@72d65cee1f8033ef0c8b5d79eaf0c45c7c578ce3 # 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
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@11bd71901bbe5b1630ceea73d27597364c9af683 # 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@72d65cee1f8033ef0c8b5d79eaf0c45c7c578ce3 # 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
# 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
- target: x86_64-pc-windows-msvc
os: windows-latest
build-target: x86_64-pc-windows-msvc
build-tool: cargo
- target: i686-pc-windows-msvc
os: windows-latest
build-target: i686-pc-windows-msvc
build-tool: cargo
- target: universal-apple-darwin
# macos-14 for M1 runners
os: macos-14
build-target: universal-apple-darwin
build-tool: cargo
# 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
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
build-target: aarch64-unknown-linux-gnu
build-tool: cross
- target: x86_64-unknown-freebsd
os: ubuntu-22.04
build-target: x86_64-unknown-freebsd
build-tool: cross
- target: x86_64-unknown-illumos
os: ubuntu-22.04
build-target: x86_64-unknown-illumos
build-tool: cross
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- 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@e7953b6078194a4ae5f5619632e3715db6275561 # v1.24.0
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
zip: windows
checksum: b2,sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_PROFILE_RELEASE_LTO: true
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
- 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:
- name: Clone nextest repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
path: nextest
- name: Clone release-meta repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
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@03381f5ca4d069c7f756fec5d189e036987f842e # v2
with:
tool: [email protected]
- 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
run: |
cd release-meta
~/bin/mukti-bin --json releases.json 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 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 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: Add extra redirects
run: |
cat nextest/site/release-meta-static/extra-redirects >> release-meta/_redirects
- name: Update release-meta repo
run: |
cd release-meta
git config user.email "[email protected]"
git config user.name "Nextest Bot"
git pull --autostash --rebase origin main
git add releases.json _redirects
git commit -m "Update release metadata for ${{ github.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 }}