-
Notifications
You must be signed in to change notification settings - Fork 666
376 lines (308 loc) · 9.48 KB
/
ci.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
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
name: CI
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
merge_group:
types: [checks_requested]
permissions:
contents: read
env:
MSRV: 1.69.0
jobs:
check_new_changelog:
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/checkout@v4
- name: check new CHANGELOG
uses: ./.github/actions/check_new_changelog
macos:
runs-on: macos-13
env:
TARGET: x86_64-apple-darwin
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: '${{ env.MSRV }}'
components: clippy
- name: build
uses: ./.github/actions/build
with:
TARGET: '${{ env.TARGET }}'
- name: test
uses: ./.github/actions/test
with:
TARGET: '${{ env.TARGET }}'
- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index
macos-aarch64:
runs-on: macos-14
env:
TARGET: aarch64-apple-darwin
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: '${{ env.MSRV }}'
components: clippy
- name: build
uses: ./.github/actions/build
with:
TARGET: "${{ env.TARGET }}"
- name: test
uses: ./.github/actions/test
with:
TARGET: "${{ env.TARGET }}"
- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index
# Use cross for QEMU-based testing
# cross needs to execute Docker, GitHub Action already has it installed
cross:
runs-on: ubuntu-20.04
needs: [rustfmt, minver, macos, linux_native_builds, rust_stable]
strategy:
fail-fast: false
matrix:
target: [
arm-unknown-linux-gnueabi,
armv7-unknown-linux-gnueabihf,
i686-unknown-linux-gnu,
i686-unknown-linux-musl,
mips-unknown-linux-gnu,
mips64-unknown-linux-gnuabi64,
mips64el-unknown-linux-gnuabi64,
mipsel-unknown-linux-gnu,
powerpc64le-unknown-linux-gnu,
]
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: '${{ env.MSRV }}'
components: clippy
# cross relies on docker or podman, GitHub Acton already has it installed.
- name: Set up cross
uses: taiki-e/install-action@v2
with:
tool: cross@0.2.5
- name: build
uses: ./.github/actions/build
with:
TARGET: '${{ matrix.target }}'
TOOL: cross
RUSTFLAGS: --cfg qemu -D warnings
- name: test
uses: ./.github/actions/test
with:
TARGET: '${{ matrix.target }}'
SUDO: ""
TOOL: cross
RUSTFLAGS: --cfg qemu -D warnings
- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index
# Tasks for Linux native builds
# Only test x86_64 targets on GitHub Action, leave aarch64 one in Cirrus CI.
linux_native_builds:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
target: [
x86_64-unknown-linux-gnu,
x86_64-unknown-linux-musl,
]
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: '${{ env.MSRV }}'
components: clippy
- name: install targets
run: rustup target add ${{ matrix.target }}
- name: build
uses: ./.github/actions/build
with:
TARGET: '${{ matrix.TARGET }}'
- name: test
uses: ./.github/actions/test
with:
TARGET: '${{ matrix.TARGET }}'
- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index
rust_stable:
runs-on: ubuntu-20.04
env:
TARGET: x86_64-unknown-linux-gnu
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: build
uses: ./.github/actions/build
with:
TARGET: '${{ env.TARGET }}'
- name: test
uses: ./.github/actions/test
with:
TARGET: '${{ env.TARGET }}'
- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index
# Tasks for cross-compiling, but no testing
cross_compiling:
runs-on: ubuntu-20.04
needs: [rustfmt, minver, macos, linux_native_builds, rust_stable]
env:
BUILD: check
strategy:
fail-fast: false
matrix:
include:
# Cross claims to support Android, but when it tries to run Nix's tests it
# reports undefined symbol references.
- target: aarch64-linux-android
- target: arm-linux-androideabi
- target: armv7-linux-androideabi
- target: i686-linux-android
- target: x86_64-linux-android
- target: arm-unknown-linux-musleabi
- target: x86_64-unknown-fuchsia
- target: x86_64-unknown-illumos
# Cross claims to support running tests on iOS, but it actually doesn't.
# https://github.com/rust-embedded/cross/issues/535
- target: aarch64-apple-ios
# cargo hack tries to invoke the iphonesimulator SDK for iOS
NOHACK: true
# Cross claims to support Linux powerpc64, but it really doesn't.
# https://github.com/rust-embedded/cross/issues/441
- target: powerpc64-unknown-linux-gnu
- target: s390x-unknown-linux-gnu
- target: x86_64-unknown-linux-gnux32
- target: x86_64-unknown-netbsd
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: '${{ env.MSRV }}'
components: clippy
- name: install targets
run: rustup target add ${{ matrix.target }}
- name: build
uses: ./.github/actions/build
with:
TARGET: '${{ matrix.target }}'
BUILD: '${{ env.BUILD }}'
NOHACK: '${{ matrix.NOHACK }}'
- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index
redox:
runs-on: ubuntu-20.04
needs: [rustfmt, minver, macos, linux_native_builds, rust_stable]
env:
TARGET: x86_64-unknown-redox
CLIPPYFLAGS: -D warnings
BUILD: check
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup Rust
# Redox's MSRV policy is unclear. Until they define it, use nightly.
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: install targets
run: rustup target add ${{ env.TARGET }}
- name: build
uses: ./.github/actions/build
with:
TARGET: '${{ env.TARGET }}'
BUILD: '${{ env.BUILD }}'
CLIPPYFLAGS: '${{ env.CLIPPYFLAGS }}'
- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index
# Rust Tier 3 targets can't use Rustup
tier3:
runs-on: ubuntu-20.04
env:
BUILD: check
ZFLAGS: -Zbuild-std
CLIPPYFLAGS: -D warnings
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-dragonfly
- target: x86_64-unknown-openbsd
# Temporarily disable armv7-unknown-linux-uclibceabihf
# https://github.com/nix-rust/nix/issues/2200
#- target: armv7-unknown-linux-uclibceabihf
- target: x86_64-unknown-haiku
# Disable hurd due to
# https://github.com/nix-rust/nix/issues/2306
# - target: i686-unknown-hurd-gnu
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup Rust
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: install src
run: rustup component add rust-src
- name: build
uses: ./.github/actions/build
with:
TARGET: '${{ matrix.target }}'
BUILD: '${{ env.BUILD }}'
ZFLAGS: '${{ env.ZFLAGS }}'
CLIPPYFLAGS: '${{ env.CLIPPYFLAGS }}'
- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index
# Test that we can build with the lowest version of all dependencies.
# "cargo test" doesn't work because some of our dev-dependencies, like
# rand, can't build with their own minimal dependencies.
minver:
runs-on: ubuntu-20.04
env:
TARGET: x86_64-unknown-linux-gnu
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup Rust
uses: dtolnay/rust-toolchain@nightly
- name: setup
run: cargo update -Zminimal-versions
- name: check
run: cargo check
- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index
# Tasks that checks if the code is formatted right using `cargo fmt` tool
rustfmt:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check format
run: cargo fmt --all -- --check **/*.rs
- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index