11
2- # Based on https://github.com/actions-rs/meta/blob/master/recipes/msrv.md
3-
42on : [push, pull_request]
53
64name : Build
97 check :
108 name : Check
119 runs-on : ubuntu-latest
12- strategy :
13- matrix :
14- rust :
15- - stable
1610 steps :
1711 - name : Checkout sources
18- uses : actions/checkout@v2
12+ uses : actions/checkout@v4
1913
2014 - name : Install toolchain
21- uses : actions-rs/toolchain@v1
22- with :
23- toolchain : ${{ matrix.rust }}
24- override : true
15+ uses : dtolnay/rust-toolchain@stable
2516
2617 - name : Run cargo check
27- uses : actions-rs/cargo@v1
28- with :
29- command : check
18+ run : cargo check
3019
3120 test :
3221 name : Test Suite
3322 runs-on : ubuntu-latest
34- strategy :
35- matrix :
36- rust :
37- - stable
3823 steps :
3924 - name : Checkout sources
40- uses : actions/checkout@v2
25+ uses : actions/checkout@v4
4126
4227 - name : Install toolchain
43- uses : actions-rs/toolchain@v1
44- with :
45- toolchain : ${{ matrix.rust }}
46- override : true
28+ uses : dtolnay/rust-toolchain@stable
4729
4830 - name : Run cargo test
49- uses : actions-rs/cargo@v1
50- with :
51- command : test
31+ run : cargo test
5232
5333 fmt :
5434 name : Rustfmt
5535 runs-on : ubuntu-latest
56- strategy :
57- matrix :
58- rust :
59- - stable
6036 steps :
6137 - name : Checkout sources
62- uses : actions/checkout@v2
38+ uses : actions/checkout@v4
6339
6440 - name : Install toolchain
65- uses : actions-rs/ toolchain@v1
41+ uses : dtolnay/rust- toolchain@stable
6642 with :
67- toolchain : ${{ matrix.rust }}
68- override : true
69-
70- - name : Install rustfmt
71- run : rustup component add rustfmt
43+ components : rustfmt
7244
7345 - name : Run cargo fmt
74- uses : actions-rs/cargo@v1
75- with :
76- command : fmt
77- args : --all -- --check
46+ run : cargo fmt --all -- --check
7847
7948 clippy :
8049 name : Clippy
8150 runs-on : ubuntu-latest
82- strategy :
83- matrix :
84- rust :
85- - stable
8651 steps :
8752 - name : Checkout sources
88- uses : actions/checkout@v2
53+ uses : actions/checkout@v4
8954
9055 - name : Install toolchain
91- uses : actions-rs/ toolchain@v1
56+ uses : dtolnay/rust- toolchain@stable
9257 with :
93- toolchain : ${{ matrix.rust }}
94- override : true
95-
96- - name : Install clippy
97- run : rustup component add clippy
58+ components : clippy
9859
9960 - name : Run cargo clippy
100- uses : actions-rs/cargo@v1
61+ run : cargo clippy --workspace -- -D warnings
62+
63+ coverage :
64+ name : Code Coverage
65+ runs-on : ubuntu-latest
66+ permissions :
67+ contents : read
68+ pull-requests : write
69+ steps :
70+ - name : Checkout sources
71+ uses : actions/checkout@v4
72+
73+ - name : Install toolchain
74+ uses : dtolnay/rust-toolchain@stable
75+ with :
76+ components : llvm-tools-preview
77+
78+ - name : Install cargo-llvm-cov
79+ uses : taiki-e/install-action@cargo-llvm-cov
80+
81+ - name : Generate code coverage
82+ run : cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
83+
84+ - name : Generate HTML report
85+ run : cargo llvm-cov report --lcov --input-files lcov.info --html --output-dir coverage/
86+
87+ - name : Upload HTML coverage report
88+ uses : actions/upload-artifact@v4
89+ with :
90+ name : coverage-report
91+ path : coverage/
92+ retention-days : 14
93+
94+ - name : Report coverage on PR
95+ if : github.event_name == 'pull_request'
96+ uses : romeovs/lcov-reporter-action@v0.4.0
10197 with :
102- command : clippy
103- args : --workspace -- -D warnings
98+ lcov-file : lcov.info
99+ github-token : ${{ secrets.GITHUB_TOKEN }}
100+ filter-changed-files : true
0 commit comments