Skip to content

chore(ci): Add check github action #9

chore(ci): Add check github action

chore(ci): Add check github action #9

Workflow file for this run

# This workflow runs whenever a PR is opened or updated, or a commit is pushed to main. It runs
# several checks:
# - fmt: checks that the code is formatted according to rustfmt
# - clippy: checks that the code does not contain any clippy warnings
# This configuration allows maintainers of this repo to create a branch and pull request based on
# the new branch. Restricting the push trigger to the main branch ensures that the PR only gets
# built once.
on:
push:
branches: [main]
pull_request:
# If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that
# we don't waste CI time, and returns results quicker https://github.com/jonhoo/rust-ci-conf/pull/5
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
name: check
jobs:
fmt:
runs-on: ubuntu-latest
name: format
steps:
- uses: actions/checkout@v4
- name: Install rustfmt
uses: dtolnay/[email protected]
with:
components: rustfmt
- name: Run rustfmt
run: cargo fmt --check
clippy:
runs-on: ubuntu-latest
name: clippy
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v4
- name: Install clippy
uses: dtolnay/[email protected]
with:
components: clippy
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -Dwarnings
- name: Run clippy
uses: giraffate/clippy-action@v1
with:
reporter: "github-pr-check"
github_token: ${{ secrets.GITHUB_TOKEN }}