-
Notifications
You must be signed in to change notification settings - Fork 18
298 lines (275 loc) · 9.37 KB
/
main.yml
File metadata and controls
298 lines (275 loc) · 9.37 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
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
name: main
permissions:
contents: read
pull-requests: read
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
jobs:
testing:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
# prep
- name: Checkout
uses: actions/checkout@v6.0.1
- name: Setup
uses: ./.github/actions/setup
with:
enable-sccache: true
rust-toolchain: RUST_MSRV, RUST_NIGHTLY
cargo-tools: CARGO_NEXTEST_VERSION, CARGO_HACK_VERSION, JUST_VERSION
# execute
- name: Build
run: cargo hack build --each-feature --workspace --verbose --locked --color always
- name: Tests
if: success() || failure()
run: cargo nextest run --verbose --workspace --all-features
- name: Docs
if: success() || failure()
env:
RUSTDOCFLAGS: "--cfg docsrs -D warnings"
run: cargo +${{ env.RUST_NIGHTLY }} doc --no-deps --verbose --workspace --all-features
- name: Doc Tests
if: success() || failure()
run: cargo test --doc --verbose --workspace --all-features
- name: Examples
run: just examples
static-analysis:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
# prep
- name: Checkout
uses: actions/checkout@v6.0.1
- name: Setup
uses: ./.github/actions/setup
with:
enable-sccache: true
rust-toolchain: RUST_LATEST
rust-components: clippy, rustfmt
cargo-tools: CARGO_DOC2README_VERSION, CARGO_WORKSPACES_VERSION, CARGO_ENSURE_NO_DEFAULT_FEATURES_VERSION, CARGO_ENSURE_NO_CYCLIC_DEPS_VERSION, CARGO_DENY_VERSION, CARGO_SORT_VERSION
# execute
- name: Clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Source Format
if: success() || failure()
run: cargo fmt -- --check
- name: Cargo.toml Format
if: success() || failure()
run: cargo sort --check --grouped --workspace
- name: Readmes
if: success() || failure()
run: cargo workspaces exec --ignore-private cargo doc2readme --check --lib --template ../README.j2
- name: Default Features
if: success() || failure()
run: cargo ensure-no-default-features
- name: Cyclic Dependencies
if: success() || failure()
run: cargo ensure-no-cyclic-deps
- name: Dependency Validation
if: success() || failure()
run: cargo deny --all-features --workspace --color always check all
spell-check:
runs-on: ubuntu-latest
steps:
# prep
- name: Checkout
uses: actions/checkout@v6.0.1
with:
fetch-depth: 1
- name: Setup
uses: ./.github/actions/setup
with:
rust-toolchain: RUST_LATEST
cargo-tools: CARGO_SPELLCHECK_VERSION, JUST_VERSION
- name: Check Spelling
run: just spellcheck
semver:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
# prep
- name: Checkout
uses: actions/checkout@v6.0.1
with:
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
with:
enable-sccache: true
rust-toolchain: RUST_LATEST
cargo-tools: CARGO_SEMVER_CHECKS_VERSION
# execute
- name: Semver Compatibility
id: semver
continue-on-error: true
run: |
set -o pipefail
cargo semver-checks --all-features --workspace --color never --baseline-rev origin/${{ github.base_ref }} 2>&1 | tee semver-output.txt
# report
- name: Prepare Semver Comment
if: steps.semver.outcome == 'failure'
run: |
echo "## ⚠️ Breaking Changes Detected" > semver-comment.txt
echo "" >> semver-comment.txt
echo '```' >> semver-comment.txt
grep -v "^ *Cloning " semver-output.txt | grep -v "^ *Building " | grep -v "^ *Built \[" | grep -v "^ *Parsing " | grep -v "^ *Parsed \[" | grep -v "^ *Checking" | grep -v "^ *Checked \[" | grep -v "^ *Finished \[" | grep -v "^ *Summary " >> semver-comment.txt
echo '```' >> semver-comment.txt
echo "" >> semver-comment.txt
echo "If the breaking changes are intentional then everything is fine - this message is merely informative." >> semver-comment.txt
echo "" >> semver-comment.txt
echo "Remember to apply a version number bump with the correct severity when publishing a version with breaking changes (\`1.x.x -> 2.x.x\` or \`0.1.x -> 0.2.x\`)." >> semver-comment.txt
- name: Post Semver Failure Comment
if: steps.semver.outcome == 'failure'
uses: marocchino/sticky-pull-request-comment@v2.9.4
with:
header: semver-check
path: semver-comment.txt
- name: Remove Semver Comment on Success
if: steps.semver.outcome == 'success'
uses: marocchino/sticky-pull-request-comment@v2.9.4
with:
header: semver-check
delete: true
extended-analysis:
if: github.event_name == 'pull_request'
needs: [testing, static-analysis]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
# prep
- name: Checkout
uses: actions/checkout@v6.0.1
- name: Setup
uses: ./.github/actions/setup
with:
enable-sccache: true
rust-toolchain: RUST_NIGHTLY
rust-components: miri
cargo-tools: CARGO_UDEPS_VERSION, CARGO_CAREFUL_VERSION, CARGO_NEXTEST_VERSION
# execute
- name: Udeps
run: cargo +${{ env.RUST_NIGHTLY }} udeps --all-features --workspace --color always
- name: Careful
if: success() || failure()
run: cargo +${{ env.RUST_NIGHTLY }} careful nextest run --all-features --workspace --color always --target ${{ runner.os == 'Linux' && 'x86_64-unknown-linux-gnu' || 'x86_64-pc-windows-msvc' }}
- name: Miri
if: success() || failure()
run: cargo +${{ env.RUST_NIGHTLY }} miri test --all-features --workspace
mutation-testing:
if: github.event_name == 'pull_request'
needs: [testing]
runs-on: ubuntu-latest
steps:
# prep
- name: Checkout
uses: actions/checkout@v6.0.1
with:
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
with:
enable-sccache: true
enable-wild-linker: true
rust-toolchain: RUST_NIGHTLY
cargo-tools: CARGO_MUTANTS_VERSION
# execute
- name: Generate PR Diff
run: git diff origin/main...HEAD >diff.txt
- name: Mutate Diff
timeout-minutes: 45
run: cargo +${{ env.RUST_NIGHTLY }} -Zscript scripts/mutants.rs --in-place --in-diff diff.txt
coverage:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
# prep
- name: Checkout
uses: actions/checkout@v6.0.1
- name: Setup
uses: ./.github/actions/setup
with:
enable-sccache: true
rust-toolchain: RUST_NIGHTLY
rust-components: llvm-tools-preview
cargo-tools: CARGO_LLVM_COV_VERSION
# execute
- name: Generate Coverage (all-features)
run: cargo +${{ env.RUST_NIGHTLY }} llvm-cov --all-features --workspace --lcov --output-path lcov-all.info
- name: Generate Coverage (no-default-features)
run: cargo +${{ env.RUST_NIGHTLY }} llvm-cov --no-default-features --workspace --lcov --output-path lcov-no-def.info
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5.5.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov-all.info,lcov-no-def.info
fail_ci_if_error: true
pr-title:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Check PR Title
uses: amannn/action-semantic-pull-request@v6.1.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
build
chore
ci
doc
docs
feat
fix
misc
miscellaneous
perf
refactor
style
task
test
license-headers:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6.0.1
with:
fetch-depth: 1
- name: Check License Headers
uses: viperproject/check-license-header@v2.0.3
with:
path: .
config: .github/license-check/config.json
strict: true
external-type-exposure:
runs-on: ubuntu-latest
steps:
# prep
- name: Checkout
uses: actions/checkout@v6.0.1
- name: Setup
uses: ./.github/actions/setup
with:
enable-sccache: true
rust-toolchain: RUST_NIGHTLY_EXTERNAL_TYPES
cargo-tools: CARGO_CHECK_EXTERNAL_TYPES_VERSION
# execute
- name: Check External Type Exposure
run: cargo +${{ env.RUST_NIGHTLY_EXTERNAL_TYPES }} -Zscript scripts/check-external-types.rs ${{ env.RUST_NIGHTLY_EXTERNAL_TYPES }}