-
Notifications
You must be signed in to change notification settings - Fork 2
220 lines (176 loc) · 4.92 KB
/
rust.yaml
File metadata and controls
220 lines (176 loc) · 4.92 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
name: Rust
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
rust-fmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: rust/rustfmt
- name: Run Rust fmt
run: cargo fmt --all -- --check
toml-fmt:
name: taplo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install taplo
run: |
curl -L https://github.com/tamasfe/taplo/releases/latest/download/taplo-linux-x86_64.gz -o taplo.gz
gunzip taplo.gz
chmod +x taplo
sudo mv taplo /usr/local/bin/
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: rust/taplo
- name: Run TOML fmt
run: taplo fmt --check
check:
name: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: rust/check
- name: Run cargo check
run: cargo check --workspace
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: rust/clippy
- name: Build
run: cargo build --workspace
- name: Clippy
run: cargo clippy --all-targets --all-features -- --deny warnings
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: rust/test
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- name: Run tests (JUnit)
run: cargo nextest run --release --profile ci
- name: Run doctests
run: cargo test --release --doc
- name: Publish JUnit test report
if: always()
uses: mikepenz/action-junit-report@v4
with:
report_paths: "target/nextest/ci/junit.xml"
detailed_summary: true
include_passed: true
- name: Setup Node.js for HTML conversion
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Convert JUnit to HTML
run: npx --yes xunit-viewer -r target/nextest/ci -o target/nextest/ci/index.html
- name: Upload HTML and JUnit artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: rust-test-report
path: |
target/nextest/ci/junit.xml
target/nextest/ci/index.html
doc:
name: doc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: rust/doc
- name: Run cargo doc to check for warnings
run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
coverage:
name: coverage
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: llvm-tools-preview
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Run cargo-llvm-cov
run: cargo llvm-cov --workspace --html --output-dir target/coverage
- name: Upload coverage to Artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: target/coverage
udeps:
name: udeps
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: rust/udeps
- name: Install cargo-udeps
uses: taiki-e/install-action@v2
with:
tool: cargo-udeps
- name: Run cargo udeps
run: cargo +nightly udeps --all-targets --workspace