-
Notifications
You must be signed in to change notification settings - Fork 2
262 lines (247 loc) · 8.43 KB
/
rust.yml
File metadata and controls
262 lines (247 loc) · 8.43 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
name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
format:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Format
run: cargo fmt --check
check:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Check with `libm`
run: cargo check --no-default-features -F libm
- name: Check with `std`
run: cargo check --no-default-features -F std
- name: Check with both
run: cargo check --no-default-features -F libm,std
clippy:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Run clippy with `libm`
run: cargo clippy --no-default-features --features libm -- -D warnings
- name: Run clippy with `std`
run: cargo clippy --no-default-features --features std -- -D warnings
- name: Run clippy with both
run: cargo clippy --no-default-features --features libm,std -- -D warnings
test:
needs: format
strategy:
matrix:
toolchain: [stable, beta]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Test with `libm`
run: cargo test --no-default-features -F libm
- name: Test with `std`
run: cargo test --no-default-features -F std
- name: Test with both
run: cargo test --no-default-features -F libm,std
doc:
runs-on: ubuntu-latest
permissions:
contents: read
env:
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: --cfg docsrs
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Generate documentation
run: cargo +nightly doc --all-features
verify_rust_version:
needs: format
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Cache
uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: cargo-msrv
- name: Verify MSRV with `libm`
run: cargo msrv verify
- name: Verify MSRV with `std`
run: cargo msrv verify --no-default-features --features std
- name: Verify MSRV with both
run: cargo msrv verify --no-default-features --features libm,std
run_examples:
needs: format
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Run plot example with `libm`
run: cargo run --example plot
- name: Run plot example with `std`
run: cargo run --example plot --no-default-features --features std
- name: Run plot example with both
run: cargo run --example plot --no-default-features --features libm,std
coverage:
needs: format
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: Create coverage report
run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: true
semver-checks:
needs: format
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Cache
uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: cargo-semver-checks
- name: Verify semver compatibility with `libm`
run: cargo semver-checks
- name: Verify semver compatibility with `std`
run: cargo semver-checks --only-explicit-features --features std
- name: Verify semver compatibility with both
run: cargo semver-checks --only-explicit-features --features libm,std
compile_benchmarks:
needs: format
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Compile benchmarks with `libm`, but do not run them
run: cargo bench --no-run
- name: Compile benchmarks with `std`, but do not run them
run: cargo bench --no-default-features --features std --no-run
- name: Compile benchmarks with both features, but do not run them
run: cargo bench --no-default-features --features libm,std --no-run
no_std:
needs: format
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
target: [thumbv7m-none-eabi, aarch64-unknown-none]
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Check
run: cargo check --target ${{ matrix.target }}
- name: Build
run: cargo build --target ${{ matrix.target }}
minimal_dependencies:
needs: format
# This action chooses the oldest version of the dependencies permitted by Cargo.toml to ensure
# that this crate is compatible with the minimal version that this crate and its dependencies
# require. This will pick up issues where this create relies on functionality that was introduced
# later than the actual version specified (e.g., when we choose just a major version, but a
# method was added after this version).
#
# This particular check can be difficult to get to succeed as often transitive dependencies may
# be incorrectly specified (e.g., a dependency specifies 1.0 but really requires 1.1.5). There
# is an alternative flag available -Zdirect-minimal-versions that uses the minimal versions for
# direct dependencies of this crate, while selecting the maximal versions for the transitive
# dependencies. Alternatively, you can add a line in your Cargo.toml to artificially increase
# the minimal dependency, which you do with e.g.:
# ```toml
# # for minimal-versions
# [target.'cfg(any())'.dependencies]
# openssl = { version = "0.10.55", optional = true } # needed to allow foo to build with -Zminimal-versions
# ```
# The optional = true is necessary in case that dependency isn't otherwise transitively required
# by your library, and the target bit is so that this dependency edge never actually affects
# Cargo build order. See also
# https://github.com/jonhoo/fantoccini/blob/fde336472b712bc7ebf5b4e772023a7ba71b2262/Cargo.toml#L47-L49.
# This action is run on ubuntu with the stable toolchain, as it is not expected to fail
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
- name: Set stable Rust as the default
run: rustup default stable
- name: Cache
uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: cargo-all-features
- name: Use minimal versions of dependencies
run: cargo +nightly update -Zminimal-versions
- name: Check all feature combinations
run: cargo check-all-features -- --locked