1- name : Rust
1+ name : CI
22
3- on : [push]
3+ on :
4+ push :
5+ branches : [ master, main ]
6+ pull_request :
7+ branches : [ master, main ]
8+
9+ env :
10+ CARGO_TERM_COLOR : always
411
512jobs :
6- check :
7- name : Check
13+ # Run the complete CI pipeline using the Makefile as source of truth
14+ ci :
15+ name : CI Pipeline
816 runs-on : ubuntu-latest
9- strategy :
10- matrix :
11- rust :
12- - stable
13- - beta
14- - nightly
1517 steps :
16- - uses : actions/checkout@v1
17- - uses : actions-rs/toolchain@v1
18- with :
19- toolchain : ${{ matrix.rust }}
20- override : true
21- - uses : actions-rs/cargo@v1
22- with :
23- command : check
18+ - uses : actions/checkout@v4
19+
20+ - name : Install Rust stable
21+ uses : dtolnay/rust-toolchain@stable
22+ with :
23+ components : rustfmt, clippy
2424
25- test :
26- name : Test Suite
27- runs-on : ubuntu-latest
28- strategy :
29- matrix :
30- rust :
31- - stable
32- - beta
33- - nightly
34- steps :
35- - uses : actions/checkout@v1
36- - uses : actions-rs/toolchain@v1
37- with :
38- toolchain : ${{ matrix.rust }}
39- override : true
40- - uses : actions-rs/cargo@v1
41- with :
42- command : test
25+ - name : Cache dependencies
26+ uses : actions/cache@v3
27+ with :
28+ path : |
29+ ~/.cargo/registry
30+ ~/.cargo/git
31+ target/
32+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
4333
44- fmt :
45- name : Rustfmt
46- runs-on : ubuntu-latest
47- strategy :
48- matrix :
49- rust :
50- - stable
51- - beta
52- - nightly
53- steps :
54- - uses : actions/checkout@v1
55- - uses : actions-rs/toolchain@v1
56- with :
57- toolchain : ${{ matrix.rust }}
58- override : true
59- - run : rustup component add rustfmt
60- - uses : actions-rs/cargo@v1
61- with :
62- command : fmt
63- args : --all -- --check
34+ - name : Run complete CI pipeline via Makefile
35+ run : make ci-local
6436
65- clippy :
66- name : Clippy
37+ # Optional: Run on multiple Rust versions
38+ test-matrix :
39+ name : Test on ${{ matrix.rust }}
6740 runs-on : ubuntu-latest
6841 strategy :
6942 matrix :
@@ -72,12 +45,23 @@ jobs:
7245 - beta
7346 - nightly
7447 steps :
75- - uses : actions/checkout@v1
76- - uses : actions-rs/toolchain@v1
77- with :
78- toolchain : ${{ matrix.rust }}
79- override : true
80- - run : rustup component add clippy
81- - uses : actions-rs/cargo@v1
82- with :
83- command : clippy
48+ - uses : actions/checkout@v4
49+
50+ - name : Install Rust ${{ matrix.rust }}
51+ uses : dtolnay/rust-toolchain@master
52+ with :
53+ toolchain : ${{ matrix.rust }}
54+ components : rustfmt, clippy
55+
56+ - name : Cache dependencies
57+ uses : actions/cache@v3
58+ with :
59+ path : |
60+ ~/.cargo/registry
61+ ~/.cargo/git
62+ target/
63+ key : ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
64+
65+ - name : Run tests
66+ run : cargo test
67+ continue-on-error : ${{ matrix.rust == 'nightly' }}
0 commit comments