Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(quality): add workflow #1

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
quality:
name: Quality
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
Loading