Skip to content

[CI] minor improvements: extract cargo fmt job + run clippy on all targets #891

[CI] minor improvements: extract cargo fmt job + run clippy on all targets

[CI] minor improvements: extract cargo fmt job + run clippy on all targets #891

Workflow file for this run

name: CI
on:
push:
branches: [ master, 'polkadot-v[0-9]+.[0-9]+.[0-9]+' ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
RUST_NIGHTLY: 2024-11-19
jobs:
cancel_previous_runs:
name: Cancel Previous Runs
runs-on: ubuntu-20.04
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
check:
name: Rust check ${{ matrix.check }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
check: [ cargo build --release,
cargo test --all --features runtime-benchmarks --features try-runtime,
cargo clippy --all-features --all-targets -- -D warnings
]
steps:
- uses: actions/checkout@v3
- name: Install protoc
run: sudo apt-get install protobuf-compiler
- name: Setup Rust toolchain
run: rustup show
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.check }}
- name: ${{ matrix.check }}
run: ${{ matrix.check }}
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install nightly toolchain
run: rustup toolchain install nightly-${{ env.RUST_NIGHTLY }} --profile minimal --component rustfmt
- name: cargo fmt (nightly)
run: cargo +nightly-${{ env.RUST_NIGHTLY }} fmt --all -- --check
cargo-toml-fmt:
runs-on: ubuntu-latest
container: "tamasfe/taplo:0.7.0-alpine"
steps:
- uses: actions/checkout@v3
- name: Run Taplo fmt
run: taplo fmt --check
- name: Fail-fast; cancel other jobs
if: failure()
uses: andymckay/[email protected]
check-wasm:
if: ${{ !startsWith(github.head_ref, 'release/') }}
name: Check wasm build
runs-on: ubuntu-latest
continue-on-error: false
steps:
- uses: actions/checkout@v3
- run: sudo apt-get install -y protobuf-compiler
- uses: Swatinem/rust-cache@v2
with:
key: check-debug-cache
- run: ./scripts/run_for_all_no_std_crates.sh check --no-default-features --target=wasm32-unknown-unknown