Skip to content

HOP nit

HOP nit #2896

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
changes:
uses: ./.github/workflows/check-changed-files.yml
permissions:
contents: read
pull-requests: read
set-image:
if: needs.changes.outputs.should-run == 'true'
needs: [changes]
uses: ./.github/workflows/set-image.yml
check-fmt:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Load common environment variables via env file
run: cat .github/env >> $GITHUB_ENV
- name: Install Rust toolchains
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
with:
toolchain: nightly
components: rustfmt
- name: Install Rust stable
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
with:
toolchain: ${{ env.RUST_STABLE_VERSION }}
- name: Cargo fmt
run: cargo +nightly fmt --all -- --check
- name: Cache taplo
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
id: cache-taplo
with:
path: ~/.cargo/bin/taplo
key: taplo-${{ runner.os }}-${{ env.TAPLO_VERSION }}
- name: Install taplo
if: steps.cache-taplo.outputs.cache-hit != 'true'
run: cargo install taplo-cli --version ${{ env.TAPLO_VERSION }}
- name: Cache zepter
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
id: cache-zepter
with:
path: ~/.cargo/bin/zepter
key: zepter-${{ runner.os }}-${{ env.ZEPTER_VERSION }}
- name: Install zepter
if: steps.cache-zepter.outputs.cache-hit != 'true'
run: cargo install zepter --locked --version ${{ env.ZEPTER_VERSION }}
- name: Check TOML format
run: |
taplo --version
zepter --version
if ! taplo format --check --config .config/taplo.toml; then
echo "Please run 'taplo format --config .config/taplo.toml' to fix any TOML formatting issues"
exit 1
fi
if ! zepter run check --config .config/zepter.yaml; then
echo "Please run 'zepter run --config .config/zepter.yaml' to fix any TOML formatting issues"
exit 1
fi
clippy:
name: Cargo clippy
runs-on: parity-default
needs: [set-image, check-fmt]
container:
image: ${{ needs.set-image.outputs.CI_IMAGE }}
env:
RUSTFLAGS: "-D warnings"
SKIP_WASM_BUILD: 1
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Rust cache
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: "bulletin-cache-clippy"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Cargo clippy
run: |
cargo clippy --all-targets --locked --workspace --quiet
cargo clippy --all-targets --all-features --locked --workspace --quiet
test:
name: Test (${{ matrix.target.name }})
runs-on: parity-large
timeout-minutes: 30
needs: [set-image, check-fmt]
container:
image: ${{ needs.set-image.outputs.CI_IMAGE }}
strategy:
fail-fast: false
matrix:
target:
- name: pallets
cmd: |
SKIP_WASM_BUILD=1 cargo test -p pallet-bulletin-transaction-storage
SKIP_WASM_BUILD=1 cargo test -p pallet-bulletin-transaction-storage --features=runtime-benchmarks
- name: bulletin-westend-runtime
cmd: SKIP_WASM_BUILD=1 cargo test -p bulletin-westend-runtime
- name: bulletin-paseo-runtime
cmd: SKIP_WASM_BUILD=1 cargo test -p bulletin-paseo-runtime
- name: xcm-integration
cmd: cargo test -p bulletin-westend-integration-tests
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Rust cache
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: "bulletin-cache-tests-${{ matrix.target.name }}"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Run tests
run: ${{ matrix.target.cmd }}
prepare-bencher:
name: Prepare frame-omni-bencher
needs: [set-image, check-fmt]
runs-on: parity-large
container:
image: ${{ needs.set-image.outputs.CI_IMAGE }}
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Polkadot binaries
uses: ./.github/actions/use-polkadot-binaries
with:
groups: frame-omni-bencher
mode: prepare
benchmarks:
name: Check Benchmarks (${{ matrix.runtime.name }})
runs-on: parity-large
timeout-minutes: 60
needs: [set-image, check-fmt, prepare-bencher]
container:
image: ${{ needs.set-image.outputs.CI_IMAGE }}
strategy:
fail-fast: false
matrix:
runtime:
- name: bulletin-westend
package: bulletin-westend-runtime
- name: bulletin-paseo
package: bulletin-paseo-runtime
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Rust cache
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: "bulletin-cache-benchmarks-${{ matrix.runtime.name }}"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Set up Polkadot binaries
uses: ./.github/actions/use-polkadot-binaries
with:
groups: frame-omni-bencher
mode: consume
- name: Run benchmarks (${{ matrix.runtime.name }})
run: |
python3 ./scripts/cmd/cmd.py bench --runtime ${{ matrix.runtime.name }} --steps 2 --repeat 1 --profile release
- name: Run release check (${{ matrix.runtime.name }})
run: |
cargo check --profile release -p ${{ matrix.runtime.package }}
all-tests-passed:
name: All tests passed
if: always()
needs: [changes, check-fmt, clippy, test, prepare-bencher, benchmarks]
runs-on: ubuntu-latest
steps:
- name: Decide outcome
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1