Merge pull request #165 from Concordium/lma/single_matrix #534
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: Fmt and Clippy | |
# This job runs rustfmt and clippy linting, | |
on: | |
push: | |
branches: main | |
pull_request: | |
branches: main | |
workflow_dispatch: # allows manual trigger | |
env: | |
RUST_FMT_VERSION: nightly-2023-04-01-x86_64-unknown-linux-gnu | |
RUST_VERSION: "1.74" | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read | |
name: 'Detect changes' | |
outputs: | |
crates: ${{ steps.filter.outputs.changes }} | |
steps: | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
wallet-proxy-load-simulator/Cargo.toml: | |
- 'wallet-proxy-load-simulator/**' | |
- '.github/**' | |
state-compare/Cargo.toml: | |
- 'state-compare/**' | |
- '.github/**' | |
genesis-creator/Cargo.toml: | |
- 'genesis-creator/**' | |
- '.github/**' | |
id-verifier/Cargo.toml: | |
- 'id-verifier/**' | |
- '.github/**' | |
kpi-tracker/Cargo.toml: | |
- 'kpi-tracker/**' | |
- '.github/**' | |
chain-prometheus-exporter/Cargo.toml: | |
- 'chain-prometheus-exporter/**' | |
- '.github/**' | |
recover-id-object/Cargo.toml: | |
- 'recover-id-object/**' | |
- '.github/**' | |
generator/Cargo.toml: | |
- 'generator/**' | |
- '.github/**' | |
wallet-connect-test-bench/smart-contract/Cargo.toml: | |
- 'wallet-connect-test-bench/**' | |
- '.github/**' | |
notification-server/Cargo.toml: | |
- 'notification-server/**' | |
- '.github/**' | |
"lint_fmt": | |
name: lint:fmt | |
runs-on: ubuntu-latest | |
if: needs.changes.outputs.crates != '[]' && !github.event.pull_request.draft | |
needs: [changes] | |
strategy: | |
fail-fast: false | |
matrix: | |
crates: ${{ fromJSON(needs.changes.outputs.crates) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
run: | | |
rustup default ${{ env.RUST_FMT_VERSION }} | |
rustup component add rustfmt | |
- name: Format | |
run: | | |
cargo fmt --manifest-path=${{ matrix.crates }} -- --check | |
"lint_clippy": | |
name: lint:clippy | |
needs: [changes, lint_fmt] | |
if: needs.changes.outputs.crates != '[]' && !github.event.pull_request.draft | |
strategy: | |
fail-fast: false | |
matrix: | |
crates: ${{ fromJSON(needs.changes.outputs.crates) }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Rust | |
run: | | |
rustup default ${{ env.RUST_VERSION }} | |
rustup component add clippy | |
- name: Clippy | |
run: | | |
cargo clippy --manifest-path ${{ matrix.crates }} --locked -- -D warnings | |