15
15
default : ' false'
16
16
17
17
jobs :
18
+ tests :
19
+ name : Unit tests
20
+
21
+ if : |
22
+ github.event_name != 'pull_request' ||
23
+ github.event.pull_request.author_association == 'COLLABORATOR' ||
24
+ github.event.pull_request.author_association == 'MEMBER' ||
25
+ github.event.pull_request.user.login == 'dependabot[bot]' ||
26
+ contains(github.event.pull_request.labels.*.name, 'safe to test')
27
+
28
+ runs-on : ${{ matrix.os }}
29
+
30
+ strategy :
31
+ fail-fast : false
32
+ matrix :
33
+ os : [ windows-latest, macos-latest, ubuntu-latest ]
34
+ rust_version : [ stable, 1.76.0 ]
35
+
36
+ steps :
37
+ - name : Checkout repository
38
+ uses : actions/checkout@v4
39
+
40
+ - name : Install Rust toolchain
41
+ uses : dtolnay/rust-toolchain@master
42
+ with :
43
+ toolchain : ${{ matrix.rust_version }}
44
+ components : llvm-tools-preview
45
+
46
+ - name : Cache Rust dependencies
47
+ uses : Swatinem/rust-cache@v2
48
+
49
+ clippy_check :
50
+ name : Clippy
51
+
52
+ if : |
53
+ github.event_name != 'pull_request' ||
54
+ github.event.pull_request.author_association == 'COLLABORATOR' ||
55
+ github.event.pull_request.author_association == 'MEMBER' ||
56
+ github.event.pull_request.user.login == 'dependabot[bot]' ||
57
+ contains(github.event.pull_request.labels.*.name, 'safe to test')
58
+
59
+ runs-on : ubuntu-latest
60
+
61
+ steps :
62
+ - name : Checkout repository
63
+ uses : actions/checkout@v4
64
+
65
+ - name : Install Rust toolchain
66
+ uses : dtolnay/rust-toolchain@stable
67
+ with :
68
+ components : clippy
69
+
70
+ - name : Cache Rust dependencies
71
+ uses : Swatinem/rust-cache@v2
72
+
73
+ - name : Run Clippy
74
+ run : cargo clippy --all-features --all-targets -- -Dwarnings
75
+
76
+ cargo_fmt :
77
+ name : Enforce Rust code format
78
+
79
+ if : |
80
+ github.event_name != 'pull_request' ||
81
+ github.event.pull_request.author_association == 'COLLABORATOR' ||
82
+ github.event.pull_request.author_association == 'MEMBER' ||
83
+ github.event.pull_request.user.login == 'dependabot[bot]' ||
84
+ contains(github.event.pull_request.labels.*.name, 'safe to test')
85
+
86
+ runs-on : ubuntu-latest
87
+
88
+ steps :
89
+ - name : Checkout repository
90
+ uses : actions/checkout@v4
91
+
92
+ - name : Install nightly toolchain
93
+ uses : dtolnay/rust-toolchain@nightly
94
+ with :
95
+ components : rustfmt
96
+
97
+ - name : Check format
98
+ run : cargo +nightly fmt --all -- --check
99
+
100
+ docs_rs :
101
+ name : Preflight docs.rs build
102
+
103
+ if : |
104
+ github.event_name != 'pull_request' ||
105
+ github.event.pull_request.author_association == 'COLLABORATOR' ||
106
+ github.event.pull_request.author_association == 'MEMBER' ||
107
+ github.event.pull_request.user.login == 'dependabot[bot]' ||
108
+ contains(github.event.pull_request.labels.*.name, 'safe to test')
109
+
110
+ runs-on : ubuntu-latest
111
+
112
+ steps :
113
+ - name : Checkout repository
114
+ uses : actions/checkout@v4
115
+
116
+ - name : Install nightly Rust toolchain
117
+ # Nightly is used here because the docs.rs build
118
+ # uses nightly and we use doc_cfg features that are
119
+ # not in stable Rust as of this writing (Rust 1.76).
120
+ uses : dtolnay/rust-toolchain@nightly
121
+
122
+ - name : Run cargo docs
123
+ # This is intended to mimic the docs.rs build
124
+ # environment. The goal is to fail PR validation
125
+ # if the subsequent release would result in a failed
126
+ # documentation build on docs.rs.
127
+ run : cargo +nightly doc --workspace --all-features --no-deps
128
+ env :
129
+ RUSTDOCFLAGS : --cfg docsrs
130
+ DOCS_RS : 1
131
+ cargo-deny :
132
+ name : License / vulnerability audit
133
+
134
+ if : |
135
+ github.event_name != 'pull_request' ||
136
+ github.event.pull_request.author_association == 'COLLABORATOR' ||
137
+ github.event.pull_request.author_association == 'MEMBER' ||
138
+ github.event.pull_request.user.login == 'dependabot[bot]' ||
139
+ contains(github.event.pull_request.labels.*.name, 'safe to test')
140
+
141
+ runs-on : ubuntu-latest
142
+
143
+ strategy :
144
+ fail-fast : false
145
+ matrix :
146
+ checks :
147
+ - advisories
148
+ - bans licenses sources
149
+
150
+ # Prevent sudden announcement of a new advisory from failing CI:
151
+ continue-on-error : ${{ matrix.checks == 'advisories' }}
152
+
153
+ steps :
154
+ - name : Checkout repository
155
+ uses : actions/checkout@v4
156
+
157
+ - name : Audit crate dependencies
158
+ uses : EmbarkStudios/cargo-deny-action@v2
159
+ with :
160
+ command : check ${{ matrix.checks }}
161
+
162
+ unused_deps :
163
+ name : Check for unused dependencies
164
+
165
+ if : |
166
+ github.event_name != 'pull_request' ||
167
+ github.event.pull_request.author_association == 'COLLABORATOR' ||
168
+ github.event.pull_request.author_association == 'MEMBER' ||
169
+ github.event.pull_request.user.login == 'dependabot[bot]' ||
170
+ contains(github.event.pull_request.labels.*.name, 'safe to test')
171
+
172
+ runs-on : ubuntu-latest
173
+
174
+ steps :
175
+ - name : Checkout repository
176
+ uses : actions/checkout@v4
177
+
178
+ - name : Install nightly Rust toolchain
179
+ uses : dtolnay/rust-toolchain@nightly
180
+
181
+ - name : Run cargo-udeps
182
+ uses : aig787/cargo-udeps-action@v1
183
+ with :
184
+ version : latest
185
+ args : --all-targets --all-features
186
+
18
187
linux :
19
188
runs-on : ubuntu-latest
189
+
190
+ if : |
191
+ github.event_name != 'pull_request' ||
192
+ github.event.pull_request.author_association == 'COLLABORATOR' ||
193
+ github.event.pull_request.author_association == 'MEMBER' ||
194
+ github.event.pull_request.user.login == 'dependabot[bot]' ||
195
+ contains(github.event.pull_request.labels.*.name, 'safe to test')
196
+
20
197
strategy :
21
198
matrix :
22
199
target : [x86_64, aarch64]
@@ -63,6 +240,14 @@ jobs:
63
240
64
241
windows :
65
242
runs-on : windows-latest
243
+
244
+ if : |
245
+ github.event_name != 'pull_request' ||
246
+ github.event.pull_request.author_association == 'COLLABORATOR' ||
247
+ github.event.pull_request.author_association == 'MEMBER' ||
248
+ github.event.pull_request.user.login == 'dependabot[bot]' ||
249
+ contains(github.event.pull_request.labels.*.name, 'safe to test')
250
+
66
251
strategy :
67
252
matrix :
68
253
target : [x64, x86]
@@ -88,6 +273,14 @@ jobs:
88
273
89
274
macos_x86 :
90
275
runs-on : macos-latest
276
+
277
+ if : |
278
+ github.event_name != 'pull_request' ||
279
+ github.event.pull_request.author_association == 'COLLABORATOR' ||
280
+ github.event.pull_request.author_association == 'MEMBER' ||
281
+ github.event.pull_request.user.login == 'dependabot[bot]' ||
282
+ contains(github.event.pull_request.labels.*.name, 'safe to test')
283
+
91
284
steps :
92
285
- uses : actions/checkout@v4
93
286
- uses : actions/setup-python@v5
@@ -109,6 +302,14 @@ jobs:
109
302
110
303
macos_aarch64 :
111
304
runs-on : macos-latest-large
305
+
306
+ if : |
307
+ github.event_name != 'pull_request' ||
308
+ github.event.pull_request.author_association == 'COLLABORATOR' ||
309
+ github.event.pull_request.author_association == 'MEMBER' ||
310
+ github.event.pull_request.user.login == 'dependabot[bot]' ||
311
+ contains(github.event.pull_request.labels.*.name, 'safe to test')
312
+
112
313
steps :
113
314
- uses : actions/checkout@v4
114
315
- uses : actions/setup-python@v5
@@ -130,6 +331,14 @@ jobs:
130
331
131
332
sdist :
132
333
runs-on : ubuntu-latest
334
+
335
+ if : |
336
+ github.event_name != 'pull_request' ||
337
+ github.event.pull_request.author_association == 'COLLABORATOR' ||
338
+ github.event.pull_request.author_association == 'MEMBER' ||
339
+ github.event.pull_request.user.login == 'dependabot[bot]' ||
340
+ contains(github.event.pull_request.labels.*.name, 'safe to test')
341
+
133
342
steps :
134
343
- uses : actions/checkout@v4
135
344
- name : Build sdist
@@ -145,9 +354,11 @@ jobs:
145
354
146
355
release :
147
356
name : Release
357
+
358
+ if : startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true'
359
+
148
360
runs-on : ubuntu-latest
149
361
environment : Publish
150
- if : startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true'
151
362
needs : [linux, windows, macos_x86, macos_aarch64, sdist]
152
363
steps :
153
364
- uses : actions/download-artifact@v3
0 commit comments