mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-22 06:47:58 +00:00
4bda673847
* Cargo update in prep for wasm build Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Add light client test Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Implement low level socket Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Add native platform primitives Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Add wasm platform primitives Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Implement smoldot platform Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Adjust code to use custom platform Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Adjust feature flags Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * tests: Adjust wasm endpoint to accept ws for p2p Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Adjust wasm socket Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Book mention of wasm Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * ci: Propagate env variable properly Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * subxt: Revert to native feature flags Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cli: Use tokio rt-multi-thread feature Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * subxt: Add tokio feature flags for native platform Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * wasm: Use polkadot live for wasm testing Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * wasm: Add support for DNS p2p addresses Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * wasm: Disable logs Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * wasm: Run wasm test for firefox driver Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * wasm: Reenable chrome driver Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Move lightclient RPC to dedicated crate for better feature flags and modularity Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Use subxt-lightclient low level RPC crate Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Apply cargo fmt Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Enable default:native feature for cargo check Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * ci: Extra step for subxt-lightclient similar to signer crate Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Remove native platform code and use smoldot instead Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * codegen: Enable tokio/multi-threads Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * lightclient: Refactor modules Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Adjust testing crates Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * ci: Run light-client WASM tests Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * wasm-rpc: Remove light-client imports Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * testing: Update wasm cargo.lock files Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * ci: Spawn substrate node with deterministic p2p address for WASM tests Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * wasm_socket: Use rc and refcell Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * wasm_socket: Switch back to Arc<Mutex<>> Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Add comments Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
291 lines
10 KiB
YAML
291 lines
10 KiB
YAML
name: Rust
|
|
|
|
on:
|
|
push:
|
|
# Run jobs when commits are pushed to
|
|
# master or release-like branches:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
# Run jobs for any external PR that wants
|
|
# to merge to master, too:
|
|
branches:
|
|
- master
|
|
|
|
concurrency:
|
|
group: ${{ github.ref }}-${{ github.workflow }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
# TODO: Currently pointing at latest substrate; is there a suitable binary we can pin to here?
|
|
SUBSTRATE_URL: https://releases.parity.io/substrate/x86_64-debian:bullseye/latest/substrate/substrate
|
|
# Increase wasm test timeout from 20 seconds (default) to 1 minute.
|
|
WASM_BINDGEN_TEST_TIMEOUT: 60
|
|
|
|
jobs:
|
|
build:
|
|
name: Cargo check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Download Substrate
|
|
run: |
|
|
curl $SUBSTRATE_URL --output substrate --location
|
|
chmod +x substrate
|
|
./substrate --version
|
|
mkdir -p ~/.local/bin
|
|
mv substrate ~/.local/bin
|
|
|
|
- name: Install Rust stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1
|
|
|
|
- name: Install cargo-hack
|
|
uses: baptiste0928/cargo-install@v2
|
|
with:
|
|
crate: cargo-hack
|
|
version: 0.5
|
|
|
|
# A basic check over all targets together. This may lead to features being combined etc,
|
|
# and doesn't test combinations of different features.
|
|
- name: Cargo check all targets.
|
|
run: cargo check --all-targets
|
|
|
|
# Next, check subxt features.
|
|
# - `native` feature must always be enabled
|
|
# - `web` feature is always ignored.
|
|
# - This means, don't check --no-default-features and don't try enabling --all-features; both will fail
|
|
- name: Cargo hack; check each subxt feature
|
|
run: cargo hack -p subxt --each-feature check --exclude-no-default-features --exclude-all-features --exclude-features web --features native
|
|
|
|
# Subxt-signer has the "subxt" features enabled in the "check all targets" test. Run it on its own to
|
|
# check it without. We can't enable subxt or web features here, so no cargo hack.
|
|
- name: Cargo check subxt-signer
|
|
run: cargo check -p subxt-signer
|
|
|
|
# We can't enable web features here, so no cargo hack.
|
|
- name: Cargo check subxt-lightclient
|
|
run: cargo check -p subxt-lightclient
|
|
|
|
# Next, check each other package in isolation.
|
|
- name: Cargo hack; check each feature/crate on its own
|
|
run: cargo hack --exclude subxt --exclude subxt-signer --exclude subxt-lightclient --exclude-all-features --each-feature check --workspace
|
|
|
|
fmt:
|
|
name: Cargo fmt
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Rust nightly toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
components: rustfmt
|
|
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1
|
|
|
|
- name: Cargo fmt
|
|
uses: actions-rs/cargo@v1.0.3
|
|
with:
|
|
command: fmt
|
|
args: --all -- --check
|
|
|
|
docs:
|
|
name: Check documentation and run doc tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Download Substrate
|
|
run: |
|
|
curl $SUBSTRATE_URL --output substrate --location
|
|
chmod +x substrate
|
|
./substrate --version
|
|
mkdir -p ~/.local/bin
|
|
mv substrate ~/.local/bin
|
|
|
|
- name: Install Rust stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1
|
|
|
|
- name: Check internal documentation links
|
|
run: RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc -vv --workspace --no-deps --document-private-items
|
|
|
|
- name: Run cargo test on documentation
|
|
uses: actions-rs/cargo@v1.0.3
|
|
with:
|
|
command: test
|
|
args: --doc
|
|
|
|
nonwasm_tests:
|
|
name: "Test non-wasm"
|
|
runs-on: ubuntu-latest-16-cores
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Download Substrate
|
|
run: |
|
|
curl $SUBSTRATE_URL --output substrate --location
|
|
chmod +x substrate
|
|
./substrate --version
|
|
mkdir -p ~/.local/bin
|
|
mv substrate ~/.local/bin
|
|
|
|
- name: Install Rust stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1
|
|
|
|
- name: Install cargo-nextest
|
|
run: cargo install cargo-nextest
|
|
|
|
- name: Run tests
|
|
uses: actions-rs/cargo@v1.0.3
|
|
with:
|
|
command: nextest
|
|
args: run --workspace
|
|
|
|
nonwasm_light_client_tests:
|
|
name: "Test Light Client"
|
|
runs-on: ubuntu-latest-16-cores
|
|
timeout-minutes: 25
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Download Substrate
|
|
run: |
|
|
curl $SUBSTRATE_URL --output substrate --location
|
|
chmod +x substrate
|
|
./substrate --version
|
|
mkdir -p ~/.local/bin
|
|
mv substrate ~/.local/bin
|
|
|
|
- name: Install Rust stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1
|
|
|
|
- name: Run tests
|
|
uses: actions-rs/cargo@v1.0.3
|
|
with:
|
|
command: test
|
|
args: --release --package integration-tests --features unstable-light-client
|
|
|
|
clippy:
|
|
name: Cargo clippy
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Download Substrate
|
|
run: |
|
|
curl $SUBSTRATE_URL --output substrate --location
|
|
chmod +x substrate
|
|
./substrate --version
|
|
mkdir -p ~/.local/bin
|
|
mv substrate ~/.local/bin
|
|
|
|
- name: Install Rust stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
components: clippy
|
|
override: true
|
|
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1
|
|
|
|
- name: Run clippy
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: clippy
|
|
args: --all-targets -- -D warnings
|
|
|
|
wasm_tests:
|
|
name: Test wasm
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3.1.0
|
|
|
|
- name: Install wasm-pack
|
|
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
|
|
- name: Install firefox
|
|
uses: browser-actions/setup-firefox@latest
|
|
|
|
- name: Install chrome
|
|
uses: browser-actions/setup-chrome@latest
|
|
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1
|
|
|
|
- name: Download Substrate
|
|
run: |
|
|
curl $SUBSTRATE_URL --output substrate --location
|
|
chmod +x substrate
|
|
./substrate --version
|
|
mkdir -p ~/.local/bin
|
|
mv substrate ~/.local/bin
|
|
|
|
- name: Run subxt WASM tests
|
|
run: |
|
|
# `listen-addr` is used to configure p2p to accept websocket connections instead of TCP.
|
|
# `node-key` provides a deterministic p2p address.
|
|
substrate --dev --node-key 0000000000000000000000000000000000000000000000000000000000000001 --listen-addr /ip4/0.0.0.0/tcp/30333/ws > /dev/null 2>&1 &
|
|
wasm-pack test --headless --firefox
|
|
wasm-pack test --headless --chrome
|
|
pkill substrate
|
|
working-directory: testing/wasm-rpc-tests
|
|
|
|
- name: Run subxt-lightclient WASM tests
|
|
run: |
|
|
# `listen-addr` is used to configure p2p to accept websocket connections instead of TCP.
|
|
# `node-key` provides a deterministic p2p address.
|
|
substrate --dev --node-key 0000000000000000000000000000000000000000000000000000000000000001 --listen-addr /ip4/0.0.0.0/tcp/30333/ws > /dev/null 2>&1 &
|
|
wasm-pack test --headless --firefox
|
|
wasm-pack test --headless --chrome
|
|
pkill substrate
|
|
working-directory: testing/wasm-lightclient-tests
|
|
|
|
- name: Run subxt-signer WASM tests
|
|
run: |
|
|
wasm-pack test --headless --firefox
|
|
wasm-pack test --headless --chrome
|
|
working-directory: signer/wasm-tests
|