11name : CI
22on :
33 push :
4- branches :
5- - main
64 pull_request :
75 workflow_dispatch :
86
@@ -15,20 +13,23 @@ concurrency:
1513
1614jobs :
1715 build :
18- name : cargo build
19- runs-on : ubuntu-latest
16+ name : cargo build & test
17+ strategy :
18+ matrix :
19+ os : [ubuntu-latest]
20+ rust : [stable, "1.70"]
21+ runs-on : ${{ matrix.os }}
2022 steps :
2123 - uses : actions/checkout@v4
2224 - uses : rui314/setup-mold@v1
2325 - uses : dtolnay/rust-toolchain@stable
24- - uses : actions/cache@v3
2526 with :
26- path : |
27- ./.cargo/.build
28- ./target
29- ~/.cargo
30- key : ${{ runner.os }}-cargo-dev-${{ hashFiles('**/Cargo.lock') }}
27+ toolchain : ${{ matrix.rust }}
28+ - uses : Swatinem/rust-cache@v2
29+ with :
30+ shared-key : " build"
3131 - run : cargo build --all-targets
32+ - run : cargo test
3233
3334 clippy :
3435 name : cargo clippy
@@ -38,14 +39,11 @@ jobs:
3839 - uses : actions/checkout@v4
3940 - uses : rui314/setup-mold@v1
4041 - uses : dtolnay/rust-toolchain@stable
41- - run : rustup component add clippy
42- - uses : actions/cache@v3
4342 with :
44- path : |
45- ./.cargo/.build
46- ./target
47- ~/.cargo
48- key : ${{ runner.os }}-cargo-dev-${{ hashFiles('**/Cargo.lock') }}
43+ components : clippy
44+ - uses : Swatinem/rust-cache@v2
45+ with :
46+ shared-key : " build"
4947 - run : cargo clippy --all
5048
5149 test-script :
@@ -56,33 +54,12 @@ jobs:
5654 - uses : actions/checkout@v4
5755 - uses : rui314/setup-mold@v1
5856 - uses : dtolnay/rust-toolchain@stable
59- - uses : actions/ cache@v3
57+ - uses : Swatinem/rust- cache@v2
6058 with :
61- path : |
62- ./.cargo/.build
63- ./target
64- ~/.cargo
65- key : ${{ runner.os }}-cargo-dev-${{ hashFiles('**/Cargo.lock') }}
59+ shared-key : " build"
6660 - run : bash test/test_all.sh
6761 - run : git diff --exit-code --stat || exit 1
6862
69- # things that use the cargo-test cache
70- test :
71- name : cargo test
72- runs-on : ubuntu-latest
73- steps :
74- - uses : actions/checkout@v4
75- - uses : rui314/setup-mold@v1
76- - uses : dtolnay/rust-toolchain@stable
77- - uses : actions/cache@v3
78- with :
79- path : |
80- ./.cargo/.build
81- ./target
82- ~/.cargo
83- key : ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
84- - run : cargo test
85-
8663 # Things that don't need a cache
8764 fmt :
8865 name : cargo fmt
@@ -92,13 +69,13 @@ jobs:
9269 - uses : dtolnay/rust-toolchain@stable
9370 with :
9471 toolchain : nightly
95- - run : rustup component add rustfmt
72+ components : rustfmt
9673 - run : cargo fmt --all -- --check
9774
9875 release :
9976 runs-on : ubuntu-latest
10077 name : release
101- needs : [build, clippy, test, test -script, fmt]
78+ needs : [build, clippy, test-script, fmt]
10279 if : github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
10380 permissions :
10481 contents : write # for actions/checkout to fetch code and for semantic-release to push commits, release releases and tags
0 commit comments