-
-
Notifications
You must be signed in to change notification settings - Fork 313
302 lines (275 loc) · 11.1 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
on:
pull_request:
name: CI
# If a new push on the PR is done, cancel the build
concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true
jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
- run: cargo fmt -- --check
clippy:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: clippy
- run: cargo clippy --all-targets --features serde -- -D warnings
check:
name: Check ${{ matrix.toolchain }} / ${{ matrix.triple.target }}
runs-on: ${{ matrix.triple.os }}
strategy:
fail-fast: false
matrix:
triple:
- { os: 'ubuntu-latest', target: 'x86_64-unknown-linux-gnu', cross: false }
- { os: 'ubuntu-latest', target: 'i686-unknown-linux-gnu', cross: true }
- { os: 'macos-latest', target: 'x86_64-apple-darwin', cross: false }
- { os: 'windows-latest', target: 'x86_64-pc-windows-msvc', cross: false }
## iOS
- { os: 'macos-latest', target: 'aarch64-apple-ios', cross: true }
- { os: 'macos-latest', target: 'x86_64-apple-ios', cross: true }
## ARM64
- { os: 'ubuntu-latest', target: 'aarch64-unknown-linux-gnu', cross: true }
- { os: 'ubuntu-latest', target: 'aarch64-unknown-linux-musl', cross: true }
## ARMv7
- { os: 'ubuntu-latest', target: 'armv7-unknown-linux-gnueabihf', cross: true }
- { os: 'ubuntu-latest', target: 'armv7-unknown-linux-musleabihf', cross: true }
## ARMv6
- { os: 'ubuntu-latest', target: 'arm-unknown-linux-gnueabihf', cross: true }
- { os: 'ubuntu-latest', target: 'arm-unknown-linux-musleabihf', cross: true }
# Android
- { os: 'ubuntu-latest', target: 'aarch64-linux-android', cross: true }
- { os: 'ubuntu-latest', target: 'armv7-linux-androideabi', cross: true }
- { os: 'ubuntu-latest', target: 'x86_64-linux-android', cross: true }
- { os: 'ubuntu-latest', target: 'i686-linux-android', cross: true }
toolchain:
- "1.74.0" # minimum supported rust version
- stable
- nightly
steps:
- uses: actions/checkout@v4
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
- name: Install cross-target
run: rustup target add ${{ matrix.triple.target }}
- name: Check
uses: ClementTsang/cargo-action@v0.0.6
with:
command: rustc
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml
use-cross: ${{ matrix.triple.cross }}
- name: Check debug feature
uses: ClementTsang/cargo-action@v0.0.6
with:
command: rustc
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --features=debug
use-cross: ${{ matrix.triple.cross }}
- name: Check debug feature
uses: ClementTsang/cargo-action@v0.0.6
with:
command: rustc
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --no-default-features --features=debug
use-cross: ${{ matrix.triple.cross }}
- name: Check serde feature
uses: ClementTsang/cargo-action@v0.0.6
with:
command: rustc
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --features=serde
use-cross: ${{ matrix.triple.cross }}
- name: Check serde feature
uses: ClementTsang/cargo-action@v0.0.6
with:
command: rustc
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --no-default-features --features=serde
use-cross: ${{ matrix.triple.cross }}
- name: Check debug/serde feature (system)
uses: ClementTsang/cargo-action@v0.0.6
with:
command: rustc
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --no-default-features --features=debug,serde,system
use-cross: ${{ matrix.triple.cross }}
- name: Check debug/serde feature (disk)
uses: ClementTsang/cargo-action@v0.0.6
with:
command: rustc
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --no-default-features --features=debug,serde,disk
use-cross: ${{ matrix.triple.cross }}
- name: Check debug/serde feature (component)
uses: ClementTsang/cargo-action@v0.0.6
with:
command: rustc
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --no-default-features --features=debug,serde,component
use-cross: ${{ matrix.triple.cross }}
- name: Check debug/serde feature (network)
uses: ClementTsang/cargo-action@v0.0.6
with:
command: rustc
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --no-default-features --features=debug,serde,network
use-cross: ${{ matrix.triple.cross }}
- name: Check debug/serde feature (user)
uses: ClementTsang/cargo-action@v0.0.6
with:
command: rustc
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --no-default-features --features=debug,serde,user
use-cross: ${{ matrix.triple.cross }}
- name: Check without multithreading
uses: ClementTsang/cargo-action@v0.0.6
with:
command: check
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --no-default-features
use-cross: ${{ matrix.triple.cross }}
- name: Check features (system)
uses: ClementTsang/cargo-action@v0.0.6
with:
command: check
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --no-default-features --features system
use-cross: ${{ matrix.triple.cross }}
- name: Check features (disk)
uses: ClementTsang/cargo-action@v0.0.6
with:
command: check
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --no-default-features --features disk
use-cross: ${{ matrix.triple.cross }}
- name: Check features (component)
uses: ClementTsang/cargo-action@v0.0.6
with:
command: check
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --no-default-features --features component
use-cross: ${{ matrix.triple.cross }}
- name: Check features (network)
uses: ClementTsang/cargo-action@v0.0.6
with:
command: check
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --no-default-features --features network
use-cross: ${{ matrix.triple.cross }}
- name: Check features (user)
uses: ClementTsang/cargo-action@v0.0.6
with:
command: check
args: --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --no-default-features --features user
use-cross: ${{ matrix.triple.cross }}
- name: Check example
uses: ClementTsang/cargo-action@v0.0.6
with:
command: check
args: --target=${{ matrix.triple.target }} --example simple
use-cross: ${{ matrix.triple.cross }}
- name: Check (Apple app store restrictions)
if: matrix.triple.os == 'macos-latest'
uses: ClementTsang/cargo-action@v0.0.6
with:
command: check
args: --features apple-sandbox --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml
use-cross: ${{ matrix.triple.cross }}
- name: Check without multithreading (Apple app store restrictions)
if: matrix.triple.os == 'macos-latest'
uses: ClementTsang/cargo-action@v0.0.6
with:
command: check
args: --features apple-sandbox --target=${{ matrix.triple.target }} --manifest-path=Cargo.toml --no-default-features
use-cross: ${{ matrix.triple.cross }}
tests:
needs: [check]
name: Test ${{ matrix.os }} (rust ${{matrix.toolchain}})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
toolchain:
- "1.74.0" # minimum supported rust version
- stable
- nightly
steps:
- uses: actions/checkout@v4
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
- name: Check docs
run: cargo rustdoc -- -Z unstable-options --generate-link-to-definition
if: matrix.toolchain == 'nightly'
- name: Check docs with serde
run: cargo rustdoc --features serde -- -Z unstable-options --generate-link-to-definition
if: matrix.toolchain == 'nightly'
- name: Execute tests (not mac)
run: cargo test
if: matrix.os != 'macos-latest'
env:
RUST_BACKTRACE: full
- name: Execute tests (mac)
run: cargo test -- --test-threads 1
if: matrix.os == 'macos-latest'
env:
RUST_BACKTRACE: full
APPLE_CI: 1 # FIXME: remove this once CI mac tests are fixed
- name: Execute tests (not mac, no features)
run: cargo test --no-default-features
if: matrix.os != 'macos-latest'
env:
RUST_BACKTRACE: full
- name: Execute tests (mac, no features)
run: cargo test --no-default-features -- --test-threads 1
if: matrix.os == 'macos-latest'
env:
RUST_BACKTRACE: full
APPLE_CI: 1 # FIXME: remove this once CI mac tests are fixed
- name: Run CPU test
run: cargo test --lib -- --ignored --test-threads 1
env:
RUST_BACKTRACE: full
- name: Check serde feature
run: |
cargo check --features serde
cargo test --features serde --doc
env:
RUST_BACKTRACE: full
c_interface:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- run: make
unknown-targets:
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- "1.74.0" # minimum supported rust version
- stable
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- run: cargo clippy --features unknown-ci -- -D warnings
- run: cargo check --features unknown-ci
- run: cargo test --features unknown-ci
- run: cargo install wasm-pack
if: matrix.toolchain == 'stable'
- run: cd test-unknown && wasm-pack build --target web
if: matrix.toolchain == 'stable'