-
Notifications
You must be signed in to change notification settings - Fork 2
133 lines (94 loc) · 3.17 KB
/
testing.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
name: Test and verify Rust contributions
on:
# Run if contributions to dev or main are proposed.
pull_request:
branches:
- main
- dev
types:
- opened
- edited
- synchronize
paths:
- '**.rs'
# Run if Rust code has been changed. Readme and other changes are not relevant.
push:
paths:
- '**.rs'
# Run upon manual request.
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Report rustfmt version
run: cargo fmt -- --version
- name: Check style
run: cargo fmt -- --check
- name: Lint with Rust Marker
uses: rust-marker/[email protected]
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust toolchain
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2
- name: Build
run: cargo build --verbose
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Test nextest all
run: cargo nextest run --verbose
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Install sarif-rs
run: cargo install sarif-fmt clippy-sarif
- name: Cache Rust toolchain
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2
- name: Test Libraries and pretty-print output
run: cargo clippy --all-targets --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
continue-on-error: true
- name: Create an artifact from clippy results
uses: actions/upload-artifact@v4
with:
name: ClippyResults
path: rust-clippy-results.sarif
- name: Upload clippy analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: rust-clippy-results.sarif
wait-for-processing: true
tarpaulin:
name: Determine test coverage with Tarpaulin
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Install tarpaulin
run: cargo install cargo-tarpaulin
- name: Cache Rust toolchain
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2
- name: Generate code coverage
run: |
cargo-tarpaulin --tests --bins --follow-exec --timeout 120 --out Xml
- uses: actions/upload-artifact@v4
with:
name: TarpaulinCodeCoverage.xml
path: cobertura.xml
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}