Skip to content

Commit 0905e98

Browse files
authored
Update and Modernize CI (#110)
* Update CI to be more modern and use a cache * Fix cache and clippy command * Fix cache for audit
1 parent fbbcbcd commit 0905e98

File tree

2 files changed

+63
-25
lines changed

2 files changed

+63
-25
lines changed

.github/workflows/audit.yml

+15-1
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,26 @@ jobs:
1414
steps:
1515
- name: Checkout sources
1616
uses: actions/checkout@v4
17+
1718
- name: Install toolchain
1819
uses: dtolnay/rust-toolchain@master
1920
with:
2021
toolchain: stable
22+
23+
- name: Setup Cache
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
~/.cargo/bin/
28+
~/.cargo/registry/index/
29+
~/.cargo/registry/cache/
30+
~/.cargo/git/db/
31+
target/
32+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
33+
2134
- name: Install Cargo Audit
2235
run: cargo install cargo-audit --locked
2336
shell: bash
37+
2438
- name: Run Audit
25-
run: cargo audit
39+
run: cargo audit

.github/workflows/ci.yml

+48-24
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,27 @@ jobs:
1818
- windows-latest
1919
steps:
2020
- name: Checkout sources
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v4
2222

23-
- name: Install toolchain
24-
uses: actions-rs/toolchain@v1
23+
- name: Install Rust
24+
uses: dtolnay/rust-toolchain@master
2525
with:
2626
toolchain: ${{ matrix.rust }}
27-
override: true
2827

29-
- name: Run cargo check
30-
uses: actions-rs/cargo@v1
28+
- name: Setup Cache
29+
uses: actions/cache@v4
3130
with:
32-
command: check
31+
path: |
32+
~/.cargo/bin/
33+
~/.cargo/registry/index/
34+
~/.cargo/registry/cache/
35+
~/.cargo/git/db/
36+
target/
37+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust }}
38+
39+
- name: Run cargo check
40+
run: cargo check
41+
shell: bash
3342

3443
test:
3544
needs: [check]
@@ -47,18 +56,27 @@ jobs:
4756
- windows-latest
4857
steps:
4958
- name: Checkout sources
50-
uses: actions/checkout@v2
59+
uses: actions/checkout@v4
5160

52-
- name: Install toolchain
53-
uses: actions-rs/toolchain@v1
61+
- name: Install Rust
62+
uses: dtolnay/rust-toolchain@master
5463
with:
5564
toolchain: ${{ matrix.rust }}
56-
override: true
5765

58-
- name: Run cargo test
59-
uses: actions-rs/cargo@v1
66+
- name: Setup Cache
67+
uses: actions/cache@v4
6068
with:
61-
command: test
69+
path: |
70+
~/.cargo/bin/
71+
~/.cargo/registry/index/
72+
~/.cargo/registry/cache/
73+
~/.cargo/git/db/
74+
target/
75+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust }}
76+
77+
- name: Run cargo test
78+
run: cargo test
79+
shell: bash
6280

6381
clippy:
6482
needs: [check]
@@ -72,19 +90,25 @@ jobs:
7290
- nightly
7391
steps:
7492
- name: Checkout sources
75-
uses: actions/checkout@v2
93+
uses: actions/checkout@v4
7694

77-
- name: Install toolchain
78-
uses: actions-rs/toolchain@v1
95+
- name: Install Rust
96+
uses: dtolnay/rust-toolchain@master
7997
with:
8098
toolchain: ${{ matrix.rust }}
81-
override: true
99+
components: clippy
82100

83-
- name: Install clippy
84-
run: rustup component add clippy
101+
- name: Setup Cache
102+
uses: actions/cache@v4
103+
with:
104+
path: |
105+
~/.cargo/bin/
106+
~/.cargo/registry/index/
107+
~/.cargo/registry/cache/
108+
~/.cargo/git/db/
109+
target/
110+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust }}
85111

86112
- name: Run cargo clippy
87-
uses: actions-rs/cargo@v1
88-
with:
89-
command: clippy
90-
args: -- -D warnings
113+
run: cargo clippy -- -D warnings
114+
shell: bash

0 commit comments

Comments
 (0)