Split formatting and clippy checks into separate pipelines

This commit is contained in:
Valentin Brandl 2020-11-23 14:11:01 +01:00
parent 7a2c6b6f06
commit 423a3aa0b0

View File

@ -1,50 +1,60 @@
name: Rust
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
lint:
name: Linting and Formatting Checks rustfmt:
name: Rustfmt
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v1 uses: actions/checkout@v2
- name: Install stable toolchain - name: Install stable toolchain
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
toolchain: stable toolchain: stable
profile: minimal
override: true override: true
components: rustfmt
- name: Install rustfmt - name: Cache cargo registry, index and build directory
run: rustup component add rustfmt uses: actions/cache@v2
- name: Cache cargo registry
uses: actions/cache@v1
with: with:
path: ~/.cargo/registry path: |
~/.cargo/registry
~/.cargo/git
./target
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} 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 - name: Check Formatting
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: fmt command: fmt
args: --all -- --check args: --all -- --check
- name: Install clippy clippy:
run: rustup component add 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 - name: Clippy Linting
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
@ -52,8 +62,9 @@ jobs:
command: clippy command: clippy
args: -- -D warnings args: -- -D warnings
test: test:
name: Run Tests name: Test Suite
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
@ -62,32 +73,24 @@ jobs:
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v1 uses: actions/checkout@v2
- name: Install stable toolchain - name: Install stable toolchain
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
toolchain: stable toolchain: stable
profile: minimal
override: true override: true
- name: Cache cargo registry - name: Cache cargo registry, index and build directory
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/.cargo/registry path: |
~/.cargo/registry
~/.cargo/git
./target
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} 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 - name: Run Tests
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with: