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