Skip to content

Commit

Permalink
ci(quality): add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
leroyguillaume committed Sep 19, 2023
1 parent 2a45b47 commit f5f552b
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Quality

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref_name }}

on:
pull_request:
branches: [main]
paths:
- .github/workflows/quality.yml
- "**.rs"
- Cargo.toml
push:
branches: [main]
paths:
- "**.rs"
- Cargo.toml

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- id: rust
name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy,rustfmt

- name: Restore cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ steps.rust.outputs.rustc_hash }}-${{ hashFiles('Cargo.toml') }}

- name: Build (debug)
uses: actions-rs/cargo@v1
with:
command: build
args: --all-features

- if: ${{ github.ref_name == 'main' }}
name: Build (release)
uses: actions-rs/cargo@v1
with:
command: build
args: --all-features --release

- if: ${{ github.event_name == 'pull_request' }}
name: Run fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --check

- if: ${{ github.event_name == 'pull_request' }}
name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --tests -- -D warnings

- if: ${{ github.event_name == 'pull_request' }}
name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features

0 comments on commit f5f552b

Please sign in to comment.