From f228dfef6a5d280caf9e0422c34dfa8d842952ad Mon Sep 17 00:00:00 2001 From: KevFan Date: Thu, 12 Oct 2023 15:51:46 +0100 Subject: [PATCH] workflow: add cache --- .github/workflows/coverage.yml | 10 +---- .github/workflows/rust.yml | 68 +++++++--------------------------- 2 files changed, 16 insertions(+), 62 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index b432bf03..ee823a60 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -12,11 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + - uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: abelfodil/protoc-action@v1 with: protoc-version: '3.19.4' @@ -42,11 +38,9 @@ jobs: redis-version: 5 # Nightly is required for code coverage with doctests # https://github.com/taiki-e/cargo-llvm-cov/issues/2 - - uses: actions-rs/toolchain@v1 + - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - profile: minimal toolchain: nightly - override: true - uses: abelfodil/protoc-action@v1 with: protoc-version: '3.19.4' diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 92bda4b7..0e309b37 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -17,17 +17,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + - uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: abelfodil/protoc-action@v1 with: protoc-version: '3.19.4' - - uses: actions-rs/cargo@v1 - with: - command: check + - run: cargo check test: name: Test Suite @@ -45,55 +39,33 @@ jobs: - uses: supercharge/redis-github-action@1.1.0 with: redis-version: 5 - # Nightly is required for code coverage with doctests - # https://github.com/taiki-e/cargo-llvm-cov/issues/2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + - uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: abelfodil/protoc-action@v1 with: protoc-version: '3.19.4' - - uses: actions-rs/cargo@v1 - with: - command: test - args: --all-features -vv + - run: cargo test --all-features -vv fmt: name: Rustfmt runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + - uses: actions-rust-lang/setup-rust-toolchain@v1 - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + - run: cargo fmt --all -- --check clippy: + needs: check name: Clippy runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + - uses: actions-rust-lang/setup-rust-toolchain@v1 - run: rustup component add clippy - uses: abelfodil/protoc-action@v1 with: protoc-version: '3.19.4' - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --all-features --all-targets -- -D warnings + - run: cargo clippy --all-features --all-targets -- -D warnings bench: name: Bench @@ -103,32 +75,20 @@ jobs: - uses: supercharge/redis-github-action@1.1.0 with: redis-version: 5 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + - uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: abelfodil/protoc-action@v1 with: protoc-version: '3.19.4' - - uses: actions-rs/cargo@v1 - with: - command: bench + - run: cargo bench wasm-build: name: Build for WASM runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: wasm32-unknown-unknown - override: true - - uses: actions-rs/cargo@v1 - with: - command: build - args: --target=wasm32-unknown-unknown --no-default-features --lib --manifest-path ./limitador/Cargo.toml + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - run: rustup target add wasm32-unknown-unknown + - run: cargo build --target=wasm32-unknown-unknown --no-default-features --lib --manifest-path ./limitador/Cargo.toml kind: name: Try in kind (Kubernetes in Docker)