Add EventReport and failed xt check to examples #1404
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: Build & Test & Clippy | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ master, 'polkadot-v[0-9]+.[0-9]+.[0-9]+*' ] | |
pull_request: | |
branches: [ master, 'polkadot-v[0-9]+.[0-9]+.[0-9]+*' ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
cancel_previous_runs: | |
name: Cancel Previous Runs | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: styfle/[email protected] | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
name: ${{ matrix.check }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest ] | |
# We need to compile `test-no-std` separately, otherwise we have std leaks from the build-deps. | |
# | |
# `test-no-std` is only meant to check if the `substrate-api-client` compiles to `no_std`, hence | |
# we omit clippy and test there. | |
check: [ | |
# Test for no-std compatibility. | |
# `--locked` to enforce an up-to-date Cargo.lock | |
cargo build --release --workspace --locked --exclude test-no-std, | |
# Test for no-std compatibility. | |
cargo build --release -p test-no-std --features api-client, | |
cargo build --release -p test-no-std --features compose-macros, | |
cargo build --release -p test-no-std --features node-api, | |
cargo build --release -p test-no-std --features primitives, | |
# Test for 32 bit and wasm32-unknown-unknown compatibility | |
cargo build --target wasm32-unknown-unknown --no-default-features --features sync-api, | |
# Test for async compilation | |
cargo build --no-default-features --features "std jsonrpsee-client", | |
# Compile async example separately to enable async-mode | |
cargo build --release -p ac-examples --example get_blocks_async --no-default-features, | |
# Clippy | |
cargo clippy --workspace --exclude test-no-std -- -D warnings, | |
cargo clippy --all-features --examples -- -D warnings, | |
# Run tests and build examples | |
cargo test --release --workspace --all-features --exclude test-no-std, | |
# Fmt | |
cargo fmt --all -- --check | |
] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: init-rust-target | |
run: rustup show | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.check }} | |
- name: ${{ matrix.check }} | |
run: ${{ matrix.check }} | |
- name: Upload sync examples | |
uses: actions/upload-artifact@v3 | |
if: contains(matrix.check, 'cargo test') | |
with: | |
name: examples | |
path: | | |
target/release/examples/* | |
!target/release/examples/*async* | |
!target/release/examples/*.d | |
!target/release/examples/*-* | |
- name: Upload async examples | |
uses: actions/upload-artifact@v3 | |
if: contains(matrix.check, 'async') | |
with: | |
name: examples | |
path: | | |
target/release/examples/*async | |
taplo-fmt: | |
name: "Taplo 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 | |
license-check: | |
name: "License check" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install cargo-about | |
uses: baptiste0928/cargo-install@v2 | |
with: | |
crate: cargo-about | |
version: "0.5" | |
- name: Run license check | |
# Explicitly use stable because otherwise cargo will trigger a download of | |
# the nightly version specified in rust-toolchain.toml | |
run: cargo +stable about generate about.hbs > license.html | |
- name: Archive license file | |
uses: actions/upload-artifact@v3 | |
with: | |
name: license | |
path: license.html | |
examples: | |
runs-on: ${{ matrix.os }} | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest ] | |
example: [ | |
benchmark_bulk_xt, | |
compose_extrinsic_offline, | |
custom_nonce, | |
check_extrinsic_events, | |
get_account_identity, | |
get_blocks_async, | |
get_storage, | |
print_metadata, | |
staking_batch_payout, | |
subscribe_events, | |
sudo, | |
transfer_with_tungstenite_client, | |
transfer_with_ws_client, | |
author_tests, | |
chain_tests, | |
dispatch_errors_tests, | |
frame_system_tests, | |
keystore_tests, | |
pallet_balances_tests, | |
pallet_transaction_payment_tests, | |
state_tests, | |
] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run latest node | |
run: | | |
docker run -p 9944:9944 -p 9933:9933 -p 30333:30333 parity/substrate:latest --dev --rpc-external & | |
- name: Wait until node has started | |
run: sleep 20s | |
shell: bash | |
- name: Download example from previous run | |
uses: actions/download-artifact@v3 | |
with: | |
name: examples | |
- name: Run Examples | |
timeout-minutes: 5 | |
run: | | |
docker ps | |
nc -z -v 127.0.0.1 9944 | |
chmod +x ${{ matrix.example }} | |
./${{ matrix.example }} |