Skip to content

Add tx index from block mapping to data index. #806

Add tx index from block mapping to data index.

Add tx index from block mapping to data index. #806

Workflow file for this run

name: Avail CI
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
env:
BUILD_TOOLCHAIN: nightly-2022-11-15
CARGO_SCCACHE_COMMIT: bed5571c
SCCACHE_DIR: /home/runner/.cache/cargo-sccache-bed5571c
SCCACHE_BIN: /home/runner/.cache/cargo-sccache-bed5571c/bin/sccache
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install nightly ${{ env.BUILD_TOOLCHAIN }}
uses: actions-rs/toolchain@v1
with:
# NOTE: Until https://github.com/actions-rs/toolchain/pull/209 is merged,
# this should be synced with rust-toolchain.toml file.
# After merge, this section should be removed.
# toolchain: nightly-2022-11-25
toolchain: ${{ env.BUILD_TOOLCHAIN }}
components: rustfmt
profile: minimal
- name: Check Avail code formatting
uses: actions-rs/cargo@v1
with:
toolchain: ${{ env.BUILD_TOOLCHAIN }}
command: fmt
args: --check
- name: Check Avail-SubXt code formatting
uses: actions-rs/cargo@v1
with:
toolchain: ${{ env.BUILD_TOOLCHAIN }}
command: fmt
args: --manifest-path avail-subxt/Cargo.toml --check
build:
runs-on: ubuntu-latest
needs: [lint]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: ${{ env.SCCACHE_DIR }}
key: ${{ runner.OS }}-sccache-bin-${{ env.CARGO_SCCACHE_COMMIT }}-v1
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: '3.x'
# With rustup's nice new toml format, we just need to run rustup show to install the toolchain
# https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659
- name: Setup Rust toolchain
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
rustup default ${{ env.BUILD_TOOLCHAIN }}
rustup target add wasm32-unknown-unknown --toolchain ${{ env.BUILD_TOOLCHAIN }}
- name: SCCache
run: |
# We altered the path to avoid old actions to overwrite it
if [ ! -f $SCCACHE_BIN ]; then
cargo install sccache --git https://github.com/purestake/sccache.git --rev $CARGO_SCCACHE_COMMIT --force --no-default-features --features=dist-client --root $SCCACHE_DIR
fi
ls -la $SCCACHE_BIN
ps aux | grep sccache
if [[ -z `pgrep sccache` ]]; then
chmod +x $SCCACHE_BIN
$SCCACHE_BIN --start-server
fi
$SCCACHE_BIN -s
echo "RUSTC_WRAPPER=$SCCACHE_BIN" >> $GITHUB_ENV
- name: Build node
run: cargo build --release -p data-avail
- name: Upload data-avail binary
uses: actions/upload-artifact@v2
with:
name: data-avail
path: target/release/data-avail
- name: Display SCCache Stats
run: ${{ env.SCCACHE_BIN }} --show-stats
- name: Check other features
run: cargo check --release --workspace --features "runtime-benchmarks try-runtime" -p data-avail
unit_tests:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v2
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
- name: Install build-essential
run: |
sudo apt update
sudo apt install -y build-essential
sudo apt install -y git clang curl libssl-dev protobuf-compiler
# Restore cache from `build`
- uses: actions/cache/restore@v3
with:
path: ${{ env.SCCACHE_DIR }}
key: ${{ runner.OS }}-sccache-bin-${{ env.CARGO_SCCACHE_COMMIT }}-v1
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: '3.x'
# With rustup's nice new toml format, we just need to run rustup show to install the toolchain
# https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659
- name: Setup Rust toolchain
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
rustup default ${{ env.BUILD_TOOLCHAIN }}
rustup target add wasm32-unknown-unknown --toolchain ${{ env.BUILD_TOOLCHAIN }}
- name: SCCache
run: |
# We altered the path to avoid old actions to overwrite it
if [ ! -f $SCCACHE_BIN ]; then
cargo install sccache --git https://github.com/purestake/sccache.git --rev $CARGO_SCCACHE_COMMIT --force --no-default-features --features=dist-client --root $SCCACHE_DIR
fi
ls -la $SCCACHE_BIN
ps aux | grep sccache
if [[ -z `pgrep sccache` ]]; then
chmod +x $SCCACHE_BIN
$SCCACHE_BIN --start-server
fi
$SCCACHE_BIN -s
echo "RUSTC_WRAPPER=$SCCACHE_BIN" >> $GITHUB_ENV
- name: Run tests
run: |
env
cargo test --release --workspace
cargo test --release --manifest-path avail-subxt/Cargo.toml
env:
RUSTFLAGS: "-C instrument-coverage"
LLVM_PROFILE_FILE: "profile-%p-%m.profraw"
- name: Display SCCache Stats
run: ${{ env.SCCACHE_BIN }} --show-stats
- name: Generate test code coverage report
run: |
df -h
cargo +stable install --force grcov
grcov . -s . --binary-path ./target/release/ -t lcov --branch --ignore-not-existing -o lcov.info
- name: Upload test code coverage report to codecov.io
uses: codecov/codecov-action@v2
with:
files: lcov.info
- name: Cleanup
run: find . -name \*.profraw -type f -exec rm -f {} +
e2e_tests:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v2
# Restore cache from `build`
- uses: actions/cache/restore@v3
with:
path: ${{ env.SCCACHE_DIR }}
key: ${{ runner.OS }}-sccache-bin-${{ env.CARGO_SCCACHE_COMMIT }}-v1
# With rustup's nice new toml format, we just need to run rustup show to install the toolchain
# https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659
- name: Setup Rust toolchain
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
rustup default ${{ env.BUILD_TOOLCHAIN }}
rustup target add wasm32-unknown-unknown --toolchain ${{ env.BUILD_TOOLCHAIN }}
- name: SCCache
run: |
# We altered the path to avoid old actions to overwrite it
# SCCACHE_DIR=${{ runner.tool_cache }}/cargo-sccache-${CARGO_SCCACHE_COMMIT}
# SCCACHE_BIN=${SCCACHE_DIR}/bin/sccache
if [ ! -f $SCCACHE_BIN ]; then
cargo install sccache --git https://github.com/purestake/sccache.git --rev $CARGO_SCCACHE_COMMIT --force --no-default-features --features=dist-client --root $SCCACHE_DIR
fi
ls -la $SCCACHE_BIN
ps aux | grep sccache
if [[ -z `pgrep sccache` ]]; then
chmod +x $SCCACHE_BIN
$SCCACHE_BIN --start-server
fi
$SCCACHE_BIN -s
echo "RUSTC_WRAPPER=$SCCACHE_BIN" >> $GITHUB_ENV
- uses: actions/download-artifact@v2
with:
name: data-avail
- name: Run E2E SubXt tests
run: |
chmod uog+x data-avail
./data-avail --dev --tmp &
sleep 5
cargo run --release --manifest-path avail-subxt/Cargo.toml --example accounts_from_mnemonics
cargo run --release --manifest-path avail-subxt/Cargo.toml --example da_bridge_actor
cargo run --release --manifest-path avail-subxt/Cargo.toml --example headers
cargo run --release --manifest-path avail-subxt/Cargo.toml --example max_block_submit
cargo run --release --manifest-path avail-subxt/Cargo.toml --example submit_data
cargo run --release --manifest-path avail-subxt/Cargo.toml --example submit_data_and_dispatch_data_root
cargo run --release --manifest-path avail-subxt/Cargo.toml --example submit_block_length_proposal
# Democracy calls are executable only with fast runtime (with democracy InstantAllowed set to true)
# cargo run --release --manifest-path avail-subxt/Cargo.toml --example democracy_external
# cargo run --release --manifest-path avail-subxt/Cargo.toml --example submit_block_length_proposal_democracy
- name: Display SCCache Stats
run: ${{ env.SCCACHE_BIN }} --show-stats