Skip to content

Update dependencies (#797) #60

Update dependencies (#797)

Update dependencies (#797) #60

Workflow file for this run

name: Build & Test & Clippy
on:
workflow_dispatch:
push:
branches: [ master, 'polkadot-v[0-9]+.[0-9]+.[0-9]+*', 'release-polkadot-v[0-9]+.[0-9]+.[0-9]+*' ]
pull_request:
branches: [ master, 'polkadot-v[0-9]+.[0-9]+.[0-9]+*', 'release-polkadot-v[0-9]+.[0-9]+.[0-9]+*' ]
schedule:
- cron: "0 0 * * *"
env:
CARGO_TERM_COLOR: always
jobs:
cancel_previous_runs:
name: Cancel Previous Runs
runs-on: ubuntu-latest
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
free-disk-space:
runs-on: ubuntu-latest
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false
build:
name: ${{ matrix.check }}
runs-on: ${{ matrix.os }}
needs: free-disk-space
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
check: [
# Test for no-std compatibility.
# `--locked` to enforce an up-to-date Cargo.lock
cargo build --release --workspace --locked --exclude test-no-std,
# 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.
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,
# Check build of stand-alone features.
cargo check --no-default-features,
cargo check --no-default-features --features sync-api,
cargo check --no-default-features --features jsonrpsee-client,
cargo check --no-default-features --features tungstenite-client,
cargo check --no-default-features --features ws-client,
cargo check --no-default-features --features staking-xt,
cargo check --no-default-features --features contracts-xt,
cargo check --no-default-features --features std,
# Test for 32 bit and wasm32-unknown-unknown compatibility
cargo build --target wasm32-unknown-unknown --no-default-features --features sync-api,
cargo build --release -p ac-examples-wasm --examples --target wasm32-unknown-unknown,
# Test for 32 bit and wasm32-wasip1 compatibility
cargo build --target wasm32-wasip1 --no-default-features --features std --features staking-xt --features contracts-xt --features sync-api,
# Compile examples and integration test separately to ensure features are not cross-imported
cargo test --release -p ac-examples-async,
cargo test --release -p ac-examples-sync,
cargo test --release -p ac-testing-async,
cargo test --release -p ac-testing-sync,
# Clippy
cargo clippy -- -D warnings,
cargo clippy --no-default-features -- -D warnings,
cargo clippy --all-features --examples -- -D warnings,
# Run unit tests
cargo test --release --all-features --workspace --exclude test-no-std --exclude "ac-examples-*" --exclude "ac-testing-*",
# Fmt
cargo fmt --all -- --check
]
steps:
- uses: actions/checkout@v4
- name: init-rust-target
run: rustup show && rustup component add rust-src
- name: Cargo update
if: ${{ github.event_name == 'schedule' }}
run: cargo update
- name: Upload Cargo.lock
uses: actions/upload-artifact@v4
# Upload the Cargo.lock from the build with --locked as this one should not update the Cargo.lock anymore
if: contains(matrix.check, '--locked')
with:
name: cargo-lock
path: Cargo.lock
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.check }}
- name: ${{ matrix.check }}
run: ${{ matrix.check }}
- name: Upload async examples
uses: actions/upload-artifact@v4
if: contains(matrix.check, 'examples-async')
with:
name: examples-async
path: |
target/release/examples/*
!target/release/examples/*.d
!target/release/examples/*-*
- name: Upload sync examples
uses: actions/upload-artifact@v4
if: contains(matrix.check, 'examples-sync')
with:
name: examples-sync
path: |
target/release/examples/*
!target/release/examples/*.d
!target/release/examples/*-*
- name: Upload wasm examples
uses: actions/upload-artifact@v4
if: contains(matrix.check, 'examples-wasm')
with:
name: examples-wasm
path: |
target/wasm32-unknown-unknown/release/examples/*.wasm
- name: Upload async testing examples
uses: actions/upload-artifact@v4
if: contains(matrix.check, 'testing-async')
with:
name: examples-testing-async
path: |
target/release/examples/*
!target/release/examples/*.d
!target/release/examples/*-*
- name: Upload sync testing examples
uses: actions/upload-artifact@v4
if: contains(matrix.check, 'testing-sync')
with:
name: examples-testing-sync
path: |
target/release/examples/*
!target/release/examples/*.d
!target/release/examples/*-*
taplo-fmt:
name: "Taplo fmt"
runs-on: ubuntu-latest
container: "tamasfe/taplo:latest"
steps:
- uses: actions/checkout@v4
- name: Run Taplo fmt
run: taplo fmt --check
license-check:
name: "License check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install cargo-about
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-about
version: "0.6"
- 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@v4
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,
custom_nonce,
check_extrinsic_events,
get_account_identity,
get_blocks,
get_storage,
print_metadata,
staking_batch_payout,
subscribe_events,
sudo,
unstable_rpc_api_calls,
transfer_with_tungstenite_client,
transfer_with_ws_client,
author_tests,
chain_tests,
dispatch_errors_tests,
frame_system_tests,
jsonrpsee_tests,
keystore_tests,
pallet_balances_tests,
pallet_contract_tests,
pallet_transaction_payment_tests,
runtime_api_tests,
tungstenite_client_test,
ws_client_test,
state_tests,
query_runtime_api,
runtime_update_sync,
runtime_update_async,
]
steps:
- uses: actions/checkout@v4
- name: Run latest node
run: |
docker run -p 9944:9944 -p 9933:9933 -p 30333:30333 paritypr/substrate:master-178e699c --dev --rpc-external &
- name: Wait until node has started
run: sleep 20s
shell: bash
- name: Download examples from previous run
uses: actions/download-artifact@v4
with:
pattern: examples-*
merge-multiple: true
- name: Run Examples
timeout-minutes: 5
run: |
docker ps
nc -z -v 127.0.0.1 9944
chmod +x ${{ matrix.example }}
./${{ matrix.example }}
wasm_examples:
runs-on: ${{ matrix.os }}
needs: build
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
example: [
wasm_example,
]
steps:
- uses: actions/checkout@v4
- name: Download examples from previous run
uses: actions/download-artifact@v4
with:
pattern: examples-wasm
merge-multiple: true
- name: Setup `wasmtime`
uses: bytecodealliance/actions/wasmtime/setup@v1
- name: Run wasm example
run: wasmtime --invoke main ${{ matrix.example }}.wasm 0 0
merge:
runs-on: ubuntu-latest
needs: [examples, wasm_examples]
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
separate-directories: true
name: artifacts
delete-merged: true