Modernise CI toolchain to avoid deprecation (#341)
* fix cache failing to find Cargo.toml
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
name: CI
|
||||
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, development]
|
||||
pull_request:
|
||||
branches: [development]
|
||||
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: "${{ matrix.platform.os }}-latest"
|
||||
@@ -32,34 +30,22 @@ jobs:
|
||||
path: |
|
||||
~/.cargo
|
||||
./target
|
||||
key: ${{ runner.os }}-cargo-${{ matrix.platform.target }}-${{ hashFiles('Cargo.toml') }}
|
||||
key: ${{ runner.os }}-cargo-${{ matrix.platform.target }}-${{ hashFiles('**/Cargo.toml') }}
|
||||
restore-keys: ${{ runner.os }}-cargo-${{ matrix.platform.target }}
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
target: ${{ matrix.platform.target }}
|
||||
profile: minimal
|
||||
default: true
|
||||
targets: ${{ matrix.platform.target }}
|
||||
- name: Install test runner for wasm
|
||||
if: matrix.platform.target == 'wasm32-unknown-unknown'
|
||||
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||
- name: Stable Build with all features
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
args: --all-features --target ${{ matrix.platform.target }}
|
||||
run: cargo build --all-features --target ${{ matrix.platform.target }}
|
||||
- name: Stable Build without features
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
args: --target ${{ matrix.platform.target }}
|
||||
run: cargo build --target ${{ matrix.platform.target }}
|
||||
- name: Tests
|
||||
if: matrix.platform.target == 'x86_64-unknown-linux-gnu' || matrix.platform.target == 'x86_64-pc-windows-msvc' || matrix.platform.target == 'aarch64-apple-darwin'
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --all-features
|
||||
run: cargo test --all-features
|
||||
- name: Tests in WASM
|
||||
if: matrix.platform.target == 'wasm32-unknown-unknown'
|
||||
run: wasm-pack test --node -- --all-features
|
||||
@@ -83,14 +69,6 @@ jobs:
|
||||
key: ${{ runner.os }}-cargo-features-${{ hashFiles('Cargo.toml') }}
|
||||
restore-keys: ${{ runner.os }}-cargo-features
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
target: ${{ matrix.platform.target }}
|
||||
profile: minimal
|
||||
default: true
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- name: Stable Build
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
args: --no-default-features ${{ matrix.features }}
|
||||
run: cargo build --no-default-features ${{ matrix.features }}
|
||||
|
||||
@@ -19,26 +19,15 @@ jobs:
|
||||
path: |
|
||||
~/.cargo
|
||||
./target
|
||||
key: ${{ runner.os }}-coverage-cargo-${{ hashFiles('**/Cargo.toml') }}
|
||||
restore-keys: ${{ runner.os }}-coverage-cargo-${{ hashFiles('**/Cargo.toml') }}
|
||||
key: ${{ runner.os }}-coverage-cargo-${{ hashFiles('Cargo.toml') }}
|
||||
restore-keys: ${{ runner.os }}-coverage-cargo
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
profile: minimal
|
||||
default: true
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
- name: Install cargo-tarpaulin
|
||||
uses: actions-rs/install@v0.1
|
||||
with:
|
||||
crate: cargo-tarpaulin
|
||||
version: latest
|
||||
use-tool-cache: true
|
||||
run: cargo install cargo-tarpaulin
|
||||
- name: Run cargo-tarpaulin
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: tarpaulin
|
||||
args: --out Lcov --all-features -- --test-threads 1
|
||||
run: cargo tarpaulin --out Lcov --all-features -- --test-threads 1
|
||||
- name: Upload to codecov.io
|
||||
uses: codecov/codecov-action@v2
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
fail_ci_if_error: false
|
||||
|
||||
@@ -6,36 +6,27 @@ on:
|
||||
pull_request:
|
||||
branches: [ development ]
|
||||
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
TZ: "/usr/share/zoneinfo/your/location"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Cache .cargo and target
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo
|
||||
./target
|
||||
key: ${{ runner.os }}-lint-cargo-${{ hashFiles('**/Cargo.toml') }}
|
||||
restore-keys: ${{ runner.os }}-lint-cargo-${{ hashFiles('**/Cargo.toml') }}
|
||||
key: ${{ runner.os }}-lint-cargo-${{ hashFiles('Cargo.toml') }}
|
||||
restore-keys: ${{ runner.os }}-lint-cargo
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
default: true
|
||||
- run: rustup component add rustfmt
|
||||
- name: Check formt
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: --all -- --check
|
||||
- run: rustup component add clippy
|
||||
components: rustfmt, clippy
|
||||
- name: Check format
|
||||
run: cargo fmt --all -- --check
|
||||
- name: Run clippy
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: clippy
|
||||
args: --all-features -- -Drust-2018-idioms -Dwarnings
|
||||
run: cargo clippy --all-features -- -Drust-2018-idioms -Dwarnings
|
||||
|
||||
Reference in New Issue
Block a user