Removal of devices #874
Workflow file for this run
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 | |
CRATE_TO_RUST_VERSION_MAP: '{}' | |
DEFAULT_RUST_VERSION: "1.76" | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read | |
name: 'Detect changes' | |
outputs: | |
crates: ${{ steps.filter.outputs.changes }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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: | | |
RUST_VERSION=$(echo '${{ env.CRATE_TO_RUST_VERSION_MAP }}' | jq -r '.["${{ matrix.crates }}"] // "${{ env.DEFAULT_RUST_VERSION }}"') | |
rustup default $RUST_VERSION | |
rustup component add clippy | |
- name: Clippy | |
run: | | |
cargo clippy --manifest-path ${{ matrix.crates }} --locked -- -D warnings | |
tests: | |
name: tests | |
runs-on: ubuntu-latest | |
needs: [changes, lint_fmt] | |
strategy: | |
fail-fast: false | |
matrix: | |
crates: ${{ fromJSON(needs.changes.outputs.crates) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Rust | |
run: | | |
RUST_VERSION=$(echo '${{ env.CRATE_TO_RUST_VERSION_MAP }}' | jq -r '.["${{ matrix.crates }}"] // "${{ env.DEFAULT_RUST_VERSION }}"') | |
rustup default $RUST_VERSION | |
- name: Setup dependencies | |
if: matrix.crates == 'notification-server/Cargo.toml' | |
run: | | |
cd notification-server | |
make setup-db && make | |
- name: Cargo tests | |
run: | | |
cargo test --manifest-path ${{ matrix.crates }} --locked |