Skip to content

format

format #259

Workflow file for this run

name: check
# 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.
# - doc: checks that the code can be documented without errors.
# - typos: checks for typos across the repo.
permissions:
contents: read
# 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, v*]
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
env:
CARGO_TERM_COLOR: always
jobs:
cargo-build:
name: Cargo Build
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- name: Fetch Repository
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@02be93da58aa71fb456aa9c43b301149248829d8 # v1.15.1
- name: cargo build
run: cargo b --locked --all-targets --all-features
cargo-fmt:
name: Cargo fmt
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- name: Fetch Repository
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@02be93da58aa71fb456aa9c43b301149248829d8 # v1.15.1
with:
components: rustfmt
toolchain: nightly
- name: Rustfmt Check
run: cargo fmt --all --check
cargo-clippy:
name: Cargo clippy
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- name: Fetch Repository
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@02be93da58aa71fb456aa9c43b301149248829d8 # v1.15.1
with:
components: clippy
- name: Clippy Check
run: cargo clippy --all-targets --all-features -- -D warnings -D clippy::pedantic
typos-cli:
name: typos
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- name: Fetch Repository
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
- name: Check spelling of files in the workspace
uses: crate-ci/typos@0c17dabcee8b8f1957fa917d17393a23e02e1583 # v1.36.3