This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
ci(workflows): add CI workflow to run rustfmt
and clippy
#1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
- renovate/** | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
# Disable incremental compilation. | |
CARGO_INCREMENTAL: 0 | |
# Allow more retries for network requests in `cargo` and `rustup`. | |
CARGO_NET_RETRY: 10 | |
RUSTUP_MAX_RETRIES: 10 | |
# Don't emit giant backtraces in the CI logs. | |
RUST_BACKTRACE: short | |
# Use cargo's sparse index protocol | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
jobs: | |
check: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0 | |
- uses: rui314/setup-mold@b2554ccb6486461b7022f149ac59c96757fd8dee # v1 | |
if: runner.os == 'Linux' | |
with: | |
make-default: true | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@1ce4a7352a1efe5dede2e52c75512b34256e4f44 # tag=v1 | |
with: | |
toolchain: stable | |
- name: Deny warnings | |
shell: bash | |
run: sed -i 's/rustflags = \[/rustflags = \[\n "-Dwarnings",/' .cargo/config.toml | |
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0 | |
- name: Check formatting | |
shell: bash | |
run: cargo fmt -- --check | |
- name: Clippy | |
shell: bash | |
run: cargo clippy --all-targets |