-
Notifications
You must be signed in to change notification settings - Fork 0
265 lines (228 loc) · 9.23 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
name: CI
on:
# TODO re-enable once project is set up properly
#push:
workflow_dispatch:
env:
CI: 1
jobs:
clippy:
name: Clippy validation${{ matrix.all-features && ' with all features' || '' }}
strategy:
fail-fast: false
matrix:
all-features: [ false ] # TODO if your crate has optional features, add 'true' to this list
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust with clippy
uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1
with:
toolchain: stable
components: clippy
cache: false
- name: Rust Cache
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
with:
prefix-key: v1-rust
key: all-features-${{ matrix.all-features }}
cache-on-failure: true
- name: Run clippy
uses: clechasseur/rs-clippy-check@c6fff255f0b3d3cbae04efd0d164b1ed3a773c1d # v4.0.0
with:
args: --workspace --all-targets ${{ matrix.all-features && '--all-features' || '' }} -- -D warnings
fmt:
name: Rustfmt check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust nightly with rustfmt
uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1
with:
toolchain: nightly
components: rustfmt
cache: false
- name: Run Rustfmt
uses: clechasseur/rs-fmt-check@62d371a9fa3c950fbb4a54cfdc587d96b4e0293a # v2.0.6
with:
args: --all
msrv-check:
name: MSRV check for Rust ${{ matrix.toolchain }} on ${{ matrix.os }}${{ matrix.all-features && ' with all features' || '' }}
strategy:
fail-fast: false
matrix:
toolchain: [ 1.60.0 ] # TODO: change for your minimum supported Rust version
os: [ ubuntu, macos, windows ]
all-features: [ false ] # TODO if your crate has optional features, add 'true' to this list
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust nightly and ${{ matrix.toolchain }}
uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1
with:
toolchain: nightly,${{ matrix.toolchain }}
cache: false
- name: Rust Cache
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
with:
prefix-key: v7-rust
key: all-features-${{ matrix.all-features }}-msrv-pins-files-${{ hashFiles('**/msrv-pins.toml') }}
cache-on-failure: true
- name: Install required tools
uses: taiki-e/install-action@24758ef6e77fc43f81a25d59a614a409e8fa7cd9 # v2.47.19
with:
tool: just,cargo-hack,cargo-minimal-versions,cargo-msrv,cargo-msrv-prep
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run checks using cargo-minimal-versions
run: just all_features=${{ matrix.all-features }} check-minimal
build:
name: Build for Rust ${{ matrix.toolchain }}${{ matrix.experimental && ' (experimental)' || '' }} on ${{ matrix.os }}${{ matrix.ignore-lock && ' without Cargo.lock' || '' }}${{ matrix.all-features && ' with all features' || '' }}
strategy:
fail-fast: false
matrix:
toolchain: [ 1.68.2, stable, beta, nightly ] # TODO: change 1.68.2 for your minimum supported Rust version
os: [ ubuntu, macos, windows ]
ignore-lock: [ false, true ]
all-features: [ false ] # TODO if your crate has optional features, add 'true' to this list
include:
- experimental: false
- toolchain: beta
experimental: true
- toolchain: nightly
experimental: true
exclude:
- toolchain: 1.68.2 # TODO: change this version to match the minimum supported Rust version specified above
ignore-lock: true
runs-on: ${{ matrix.os }}-latest
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Remove Cargo.lock
if: ${{ matrix.ignore-lock }}
run: rm Cargo.lock
- name: Install Rust ${{ matrix.toolchain }}
uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1
with:
toolchain: ${{ matrix.toolchain }}
cache: false
- name: Rust Cache
if: ${{ !matrix.experimental }}
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
with:
prefix-key: v2-rust
key: ignore-lock-${{ matrix.ignore-lock }}-all-features-${{ matrix.all-features }}
cache-on-failure: true
- name: Install just
uses: taiki-e/install-action@24758ef6e77fc43f81a25d59a614a409e8fa7cd9 # v2.47.19
with:
tool: just
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run checks
run: just all_features=${{ matrix.all-features }} check
- name: Run tests
run: just all_features=${{ matrix.all-features }} test
tarpaulin:
# Note: there seems to be an issue in `cargo-tarpaulin` when using Rust 1.75.0 or later - it reports some missing line coverage.
# I've entered an issue: /~https://github.com/xd009642/tarpaulin/issues/1438
# In the meantime, let's pin the Rust version used for code coverage to 1.74.1 until we know what's happening.
name: Code coverage
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1
with:
toolchain: 1.74.1
cache: false
- name: Rust Cache
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
with:
prefix-key: v2-rust
cache-targets: false
cache-on-failure: true
- name: Install cargo-tarpaulin
uses: taiki-e/install-action@24758ef6e77fc43f81a25d59a614a409e8fa7cd9 # v2.47.19
with:
tool: cargo-tarpaulin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run cargo-tarpaulin
uses: clechasseur/rs-cargo@ba1183726db57e8b66e56422873fa24244772da3 # v3.0.1
with:
command: tarpaulin
- name: Upload code coverage results to codecov.io
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
- name: Archive code coverage results
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: code-coverage-report
path: |
cobertura.xml
tarpaulin-report.html
doc:
name: Rustdoc check for Rust ${{ matrix.toolchain }}${{ matrix.experimental && ' (experimental)' || '' }}
strategy:
fail-fast: false
matrix:
toolchain: [ stable, nightly ]
include:
- experimental: false
- toolchain: nightly
experimental: true
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust ${{ matrix.toolchain }}
uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1
with:
toolchain: ${{ matrix.toolchain }}
cache: false
- name: Rust Cache
if: ${{ !matrix.experimental }}
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
with:
prefix-key: v2-rust
cache-targets: false
cache-on-failure: true
- name: Install just
uses: taiki-e/install-action@24758ef6e77fc43f81a25d59a614a409e8fa7cd9 # v2.47.19
with:
tool: just
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate doc using rustdoc
run: just doc
publish-dry-run:
name: Publish dry-run
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1
with:
toolchain: stable
cache: false
- name: Rust Cache
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
with:
prefix-key: v2-rust
cache-targets: false
cache-on-failure: true
- name: Perform publish dry-run
uses: clechasseur/rs-cargo@ba1183726db57e8b66e56422873fa24244772da3 # v3.0.1
with:
command: publish
args: --dry-run