Skip to content

Configure CI

Configure CI #1

Workflow file for this run

name: CI
on: [pull_request, merge_group]
env:
# From: https://github.com/rust-lang/rust-analyzer/blob/master/.github/workflows/ci.yaml
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10
# Cancel previous runs of the same workflow on the same branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
cargo-deny:
runs-on: ubuntu-22.04
timeout-minutes: 3
strategy:
matrix:
checks:
- advisories
- licenses sources
# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: ${{ matrix.checks == 'advisories' }}
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check ${{ matrix.checks }}
rustfmt:
name: Rust Formatting
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if files have changed
uses: dorny/paths-filter@v3
continue-on-error: true
id: filter
with:
filters: |
changes:
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.rustfmt.toml'
- '.github/workflows/ci.yml'
- name: Install Rust
id: toolchain
uses: IronCoreLabs/rust-toolchain@v1
with:
components: clippy, rustfmt
- name: Run rustfmt
if: steps.filter.outcome != 'success' || steps.filter.outputs.changes == 'true'
run: cargo fmt --all -- --check
- name: Run Clippy
if: steps.filter.outcome != 'success' || steps.filter.outputs.changes == 'true'
uses: giraffate/clippy-action@v1
with:
reporter: github-pr-review
filter_mode: diff_context
github_token: ${{ secrets.GITHUB_TOKEN }}
clippy_flags: --workspace --all-features --locked
fail_on_error: true