-
Notifications
You must be signed in to change notification settings - Fork 2
342 lines (303 loc) · 9.87 KB
/
check.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
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
on:
push:
release:
types: [created]
name: Checks and Releases
jobs:
changes:
runs-on: ubuntu-latest
outputs:
rust: ${{ steps.filter.outputs.rust }}
cargo: ${{ steps.filter.outputs.cargo }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
cargo:
- 'Cargo.toml'
- 'Cargo.lock'
rust:
- '**/*.rs'
fossa:
name: Fossa License Check
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.cargo == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: fossa-contrib/fossa-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Push-only API key
fossa-api-key: 7b6d2d5fb78bb718019e16184020ef6d
msrv:
name: Cargo MSRV
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy, rustfmt
- name: Install cargo-msrv
uses: actions-rs/[email protected]
with:
crate: cargo-msrv
version: latest
use-tool-cache: true
- name: Install cargo-make
uses: actions-rs/[email protected]
with:
crate: cargo-make
version: latest
use-tool-cache: true
- name: Cargo msrv
uses: actions-rs/cargo@v1
with:
command: make
args: msrv-verify
deny:
name: Cargo deny
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy, rustfmt
- name: Install cargo-deny
uses: actions-rs/[email protected]
with:
crate: cargo-deny
version: latest
use-tool-cache: true
- name: Install cargo-make
uses: actions-rs/[email protected]
with:
crate: cargo-make
version: latest
use-tool-cache: true
- name: Cargo deny
uses: actions-rs/cargo@v1
with:
command: make
args: deny
fmt:
name: Cargo fmt
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.rust == 'true' || github.event_name == 'release'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy, rustfmt
- name: Cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
operation_upgrade:
name: Operation Version Upgrade
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Run test script
run: bash ./operation_upgrade_test.sh
check-stable:
name: Check Commit
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Linux is handled by the coverage check
os: ["windows-latest", "macos-latest", "ubuntu-latest"]
needs: changes
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
if: matrix.os == 'ubuntu-latest'
with:
toolchain: stable
override: true
components: llvm-tools-preview
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
if: matrix.os != 'ubuntu-latest'
with:
toolchain: stable
override: true
- name: Install Grcov
uses: actions-rs/[email protected]
if: matrix.os == 'ubuntu-latest'
with:
crate: grcov
version: latest
use-tool-cache: true
- name: Cargo Test
uses: actions-rs/cargo@v1
if: matrix.os != 'windows-latest'
with:
command: test
args: --all-features --no-fail-fast -- --test-threads=1
env:
RUST_BACKTRACE: '1'
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Cinstrument-coverage'
RUSTDOCFLAGS: '-Cinstrument-coverage'
LLVM_PROFILE_FILE: 'profraw/hoard-cargo-tests-%p-%m.profraw'
- name: Cargo Test
uses: actions-rs/cargo@v1
if: matrix.os == 'windows-latest'
with:
command: test
args: --all-features --no-fail-fast --release -- --test-threads=1
env:
RUST_BACKTRACE: '1'
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Cinstrument-coverage'
RUSTDOCFLAGS: '-Cinstrument-coverage'
LLVM_PROFILE_FILE: 'profraw/hoard-cargo-tests-%p-%m.profraw'
- name: Run grcov
if: matrix.os == 'ubuntu-latest'
run: |
grcov profraw/*.profraw --binary-path target/debug \
-s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov \
--excl-br-line "($EXCLUDE_DERIVE|$EXCLUDE_PANICS|$EXCLUDE_TRACING|$EXCLUDE_PROPAGATE_ERROR|$EXCLUDE_MANUAL|$EXCLUDE_LONE_CLOSING_BRACE)" \
--excl-line "($EXCLUDE_DERIVE|$EXCLUDE_PANICS|$EXCLUDE_TRACING|$EXCLUDE_PROPAGATE_ERROR|$EXCLUDE_MANUAL|$EXCLUDE_LONE_CLOSING_BRACE)" \
--excl-br-start "(grcov: ignore-start|mod tests)" --excl-start "(grcov: ignore-start|mod tests)" \
--excl-br-stop "grcov: ignore-end" --excl-stop "grcov: ignore-end"
env:
RUSTFLAGS: "-Cinstrument-coverage"
RUSTUP_TOOLCHAIN: "stable"
HOARD_LOG: "trace"
EXCLUDE_DERIVE: "#\\[derive\\("
EXCLUDE_PANICS: "panic!|todo!|unimplemented!|unreachable!"
EXCLUDE_TRACING: "tracing::(error|warn|info|debug|trace)(_span)?"
EXCLUDE_PROPAGATE_ERROR: "(return|(Err\\(err(or)?\\)|err(or)?) =>) (Some\\()?Err\\(err(or)?(\\.into\\(\\))?\\)"
EXCLUDE_MANUAL: "grcov: ignore"
EXCLUDE_LONE_CLOSING_BRACE: "^\\s*\\}\\s*$"
- name: Upload to codecov.io
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.lcov
release:
if: github.event_name == 'release'
runs-on: ${{ matrix.os }}
needs: [fmt, check-stable]
strategy:
matrix:
include:
## TIER ONE
- os: "ubuntu-latest"
target: aarch64-unknown-linux-gnu
deps: gcc-aarch64-linux-gnu
- os: "ubuntu-latest"
target: i686-unknown-linux-gnu
deps: gcc-i686-linux-gnu
- os: "ubuntu-latest"
target: x86_64-unknown-linux-gnu
deps: gcc
- os: "macos-11"
target: x86_64-apple-darwin
- os: "windows-latest"
target: i686-pc-windows-msvc
- os: "windows-latest"
target: x86_64-pc-windows-msvc
## TIER TWO WITH HOST TOOLS
- os: "ubuntu-latest"
target: aarch64-unknown-linux-musl
deps: gcc-aarch64-linux-gnu musl-tools
- os: "ubuntu-latest"
target: arm-unknown-linux-gnueabihf
deps: gcc-arm-linux-gnueabihf
- os: "ubuntu-latest"
target: x86_64-unknown-linux-musl
deps: gcc musl-tools
- os: "macos-11"
target: aarch64-apple-darwin
- os: "windows-latest"
target: aarch64-pc-windows-msvc
## TIER 2 NO HOST TOOLS
#- os: "ubuntu-latest"
# target: aarch64-linux-android
# deps: gcc-aarch64-linux-gnu
#- os: "ubuntu-latest"
# target: arm-linux-androideabi
# deps: gcc-arm-linux-gnueabi
- os: "ubuntu-latest"
target: arm-unknown-linux-musleabihf
deps: gcc-arm-linux-gnueabihf musl-tools
#- os: "ubuntu-latest"
# target: armv7-linux-androideabi
# deps: gcc-arm-linux-gnueabi
- os: "ubuntu-latest"
target: i686-unknown-linux-musl
deps: gcc-i686-linux-gnu musl-tools
#- os: "ubuntu-latest"
# tasrget: i686-linux-android
# desps: gcc-i686-linux-gnu
#- oss: "ubuntu-latest"
# tasrget: x86_64-linux-android
# desps: gcc
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install stable toolchain - ${{ matrix.target }}
uses: actions-rs/toolchain@v1
with:
target: ${{ matrix.target }}
toolchain: stable
override: true
default: true
profile: minimal
- name: Install deps (Linux)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install ${{ matrix.deps }}
- name: Update XCode tools
if: matrix.os == 'macos-11'
uses: devbotsxyz/xcode-select@v1
- name: Build and Upload Binary
uses: taiki-e/upload-rust-binary-action@v1
with:
bin: hoard
target: ${{ matrix.target }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_PROFILE_RELEASE_LTO: true
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_OPT_LEVEL: 3