From 423a3aa0b0a515db599b5f2076edb927ce664cee Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Mon, 23 Nov 2020 14:11:01 +0100 Subject: [PATCH] Split formatting and clippy checks into separate pipelines --- .github/workflows/rust.yml | 87 ++++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 42 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 866c41c..d672392 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,50 +1,60 @@ -name: Rust - on: [push, pull_request] jobs: - lint: - name: Linting and Formatting Checks + + rustfmt: + name: Rustfmt runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Install stable toolchain uses: actions-rs/toolchain@v1 with: toolchain: stable + profile: minimal override: true + components: rustfmt - - name: Install rustfmt - run: rustup component add rustfmt - - - name: Cache cargo registry - uses: actions/cache@v1 + - name: Cache cargo registry, index and build directory + uses: actions/cache@v2 with: - path: ~/.cargo/registry + path: | + ~/.cargo/registry + ~/.cargo/git + ./target key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - - name: Cache cargo index - uses: actions/cache@v1 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - - - name: Cache cargo build - uses: actions/cache@v1 - with: - path: target - key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - - name: Check Formatting uses: actions-rs/cargo@v1 with: command: fmt args: --all -- --check - - name: Install clippy - run: rustup component add clippy + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + components: rustfmt + + - name: Cache cargo registry, index and build directory + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + ./target + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - name: Clippy Linting uses: actions-rs/cargo@v1 @@ -52,8 +62,9 @@ jobs: command: clippy args: -- -D warnings + test: - name: Run Tests + name: Test Suite runs-on: ${{ matrix.os }} strategy: matrix: @@ -62,32 +73,24 @@ jobs: steps: - name: Checkout sources - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Install stable toolchain uses: actions-rs/toolchain@v1 with: toolchain: stable + profile: minimal override: true - - name: Cache cargo registry - uses: actions/cache@v1 + - name: Cache cargo registry, index and build directory + uses: actions/cache@v2 with: - path: ~/.cargo/registry + path: | + ~/.cargo/registry + ~/.cargo/git + ./target key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - - name: Cache cargo index - uses: actions/cache@v1 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - - - name: Cache cargo build - uses: actions/cache@v1 - with: - path: target - key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - - name: Run Tests uses: actions-rs/cargo@v1 with: