Skip to content

Commit 0caa830

Browse files
authored
Modernise CI toolchain to avoid deprecation (#341)
* fix cache failing to find Cargo.toml
1 parent 2f63148 commit 0caa830

File tree

3 files changed

+23
-65
lines changed

3 files changed

+23
-65
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
name: CI
22

3-
43
on:
54
push:
65
branches: [main, development]
76
pull_request:
87
branches: [development]
98

10-
119
jobs:
1210
tests:
1311
runs-on: "${{ matrix.platform.os }}-latest"
@@ -32,34 +30,22 @@ jobs:
3230
path: |
3331
~/.cargo
3432
./target
35-
key: ${{ runner.os }}-cargo-${{ matrix.platform.target }}-${{ hashFiles('Cargo.toml') }}
33+
key: ${{ runner.os }}-cargo-${{ matrix.platform.target }}-${{ hashFiles('**/Cargo.toml') }}
3634
restore-keys: ${{ runner.os }}-cargo-${{ matrix.platform.target }}
3735
- name: Install Rust toolchain
38-
uses: actions-rs/toolchain@v1
36+
uses: dtolnay/rust-toolchain@stable
3937
with:
40-
toolchain: stable
41-
target: ${{ matrix.platform.target }}
42-
profile: minimal
43-
default: true
38+
targets: ${{ matrix.platform.target }}
4439
- name: Install test runner for wasm
4540
if: matrix.platform.target == 'wasm32-unknown-unknown'
4641
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
4742
- name: Stable Build with all features
48-
uses: actions-rs/cargo@v1
49-
with:
50-
command: build
51-
args: --all-features --target ${{ matrix.platform.target }}
43+
run: cargo build --all-features --target ${{ matrix.platform.target }}
5244
- name: Stable Build without features
53-
uses: actions-rs/cargo@v1
54-
with:
55-
command: build
56-
args: --target ${{ matrix.platform.target }}
45+
run: cargo build --target ${{ matrix.platform.target }}
5746
- name: Tests
5847
if: matrix.platform.target == 'x86_64-unknown-linux-gnu' || matrix.platform.target == 'x86_64-pc-windows-msvc' || matrix.platform.target == 'aarch64-apple-darwin'
59-
uses: actions-rs/cargo@v1
60-
with:
61-
command: test
62-
args: --all-features
48+
run: cargo test --all-features
6349
- name: Tests in WASM
6450
if: matrix.platform.target == 'wasm32-unknown-unknown'
6551
run: wasm-pack test --node -- --all-features
@@ -83,14 +69,6 @@ jobs:
8369
key: ${{ runner.os }}-cargo-features-${{ hashFiles('Cargo.toml') }}
8470
restore-keys: ${{ runner.os }}-cargo-features
8571
- name: Install Rust toolchain
86-
uses: actions-rs/toolchain@v1
87-
with:
88-
toolchain: stable
89-
target: ${{ matrix.platform.target }}
90-
profile: minimal
91-
default: true
72+
uses: dtolnay/rust-toolchain@stable
9273
- name: Stable Build
93-
uses: actions-rs/cargo@v1
94-
with:
95-
command: build
96-
args: --no-default-features ${{ matrix.features }}
74+
run: cargo build --no-default-features ${{ matrix.features }}

.github/workflows/coverage.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,15 @@ jobs:
1919
path: |
2020
~/.cargo
2121
./target
22-
key: ${{ runner.os }}-coverage-cargo-${{ hashFiles('**/Cargo.toml') }}
23-
restore-keys: ${{ runner.os }}-coverage-cargo-${{ hashFiles('**/Cargo.toml') }}
22+
key: ${{ runner.os }}-coverage-cargo-${{ hashFiles('Cargo.toml') }}
23+
restore-keys: ${{ runner.os }}-coverage-cargo
2424
- name: Install Rust toolchain
25-
uses: actions-rs/toolchain@v1
26-
with:
27-
toolchain: nightly
28-
profile: minimal
29-
default: true
25+
uses: dtolnay/rust-toolchain@nightly
3026
- name: Install cargo-tarpaulin
31-
uses: actions-rs/[email protected]
32-
with:
33-
crate: cargo-tarpaulin
34-
version: latest
35-
use-tool-cache: true
27+
run: cargo install cargo-tarpaulin
3628
- name: Run cargo-tarpaulin
37-
uses: actions-rs/cargo@v1
38-
with:
39-
command: tarpaulin
40-
args: --out Lcov --all-features -- --test-threads 1
29+
run: cargo tarpaulin --out Lcov --all-features -- --test-threads 1
4130
- name: Upload to codecov.io
42-
uses: codecov/codecov-action@v2
31+
uses: codecov/codecov-action@v4
4332
with:
4433
fail_ci_if_error: false

.github/workflows/lint.yml

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,27 @@ on:
66
pull_request:
77
branches: [ development ]
88

9+
910
jobs:
1011
lint:
1112
runs-on: ubuntu-latest
1213
env:
1314
TZ: "/usr/share/zoneinfo/your/location"
1415
steps:
15-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1617
- name: Cache .cargo and target
1718
uses: actions/cache@v4
1819
with:
1920
path: |
2021
~/.cargo
2122
./target
22-
key: ${{ runner.os }}-lint-cargo-${{ hashFiles('**/Cargo.toml') }}
23-
restore-keys: ${{ runner.os }}-lint-cargo-${{ hashFiles('**/Cargo.toml') }}
23+
key: ${{ runner.os }}-lint-cargo-${{ hashFiles('Cargo.toml') }}
24+
restore-keys: ${{ runner.os }}-lint-cargo
2425
- name: Install Rust toolchain
25-
uses: actions-rs/toolchain@v1
26-
with:
27-
toolchain: stable
28-
profile: minimal
29-
default: true
30-
- run: rustup component add rustfmt
31-
- name: Check formt
32-
uses: actions-rs/cargo@v1
26+
uses: dtolnay/rust-toolchain@stable
3327
with:
34-
command: fmt
35-
args: --all -- --check
36-
- run: rustup component add clippy
28+
components: rustfmt, clippy
29+
- name: Check format
30+
run: cargo fmt --all -- --check
3731
- name: Run clippy
38-
uses: actions-rs/cargo@v1
39-
with:
40-
command: clippy
41-
args: --all-features -- -Drust-2018-idioms -Dwarnings
32+
run: cargo clippy --all-features -- -Drust-2018-idioms -Dwarnings

0 commit comments

Comments
 (0)