Skip to content

Avalanche Config

Avalanche Config #885

Workflow file for this run

name: test
on:
push:
branches:
- master
- staging
- release-v*
pull_request:
jobs:
rustfmt:
runs-on: self-hosted
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.78.0
components: rustfmt, clippy
- name: Install dprint
run: cargo install --locked dprint
- name: Dprint check
run: dprint check
- name: Install nightly toolchain
run: rustup toolchain install nightly
- name: Install cargo-fmt for nightly toolchain
run: rustup component add rustfmt --toolchain nightly
- name: cargo fmt
run: cargo +nightly fmt --all -- --check
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: --enable=all --shell=bash
with:
severity: style
scandir: './scripts'
cargo-deny:
runs-on: self-hosted
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: cargo-deny check
uses: EmbarkStudios/cargo-deny-action@v1
# Test each client individually, once testing the whole workspace can hide some compilation errors
# ex: testing using --workspace enable the same feature flags for all crates
test-client:
needs: [rustfmt]
strategy:
matrix:
crate: [rosetta-server-astar, rosetta-server-ethereum, rosetta-server-polkadot, rosetta-client, rosetta-testing-arbitrum, rosetta-testing-binance]
name: ${{ matrix.crate }}
runs-on: self-hosted
steps:
- name: Checkout sources
uses: actions/checkout@v4
- run: sudo add-apt-repository ppa:ethereum/ethereum
- run: sudo apt-get update -y
- name: Install deps
run: sudo apt-get install -y musl-dev musl-tools solc
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.78.0
components: clippy
target: x86_64-unknown-linux-musl
override: true
- name: cargo clippy (${{ matrix.crate }})
run: |
cargo clippy --locked -p ${{ matrix.crate }} --examples --tests -- \
-Dwarnings \
-Dclippy::unwrap_used \
-Dclippy::expect_used \
-Dclippy::nursery \
-Dclippy::pedantic \
-Aclippy::module_name_repetitions
- name: Cleanup Docker
run: ./scripts/reset_docker.sh
- name: Pull nodes
run: ./scripts/pull_nodes.sh
- name: Checkout nitro-testnode
if: ${{ matrix.crate == 'rosetta-testing-arbitrum' }}
run: git clone -b release --depth=1 --no-tags --recurse-submodules https://github.com/ManojJiSharma/nitro-testnode.git
- name: Start arbitrum nitro-testnode
if: ${{ matrix.crate == 'rosetta-testing-arbitrum' }}
run: |
cd nitro-testnode
./test-node.bash --detach
- name: Setup BSC node
if: ${{ matrix.crate == 'rosetta-testing-binance' }}
run: |
docker pull manojanalog/bsc_for_analog
docker run -d -p 8545:8545 -p 8546:8546 manojanalog/bsc_for_analog:latest geth --datadir ./datadir --unlock 0x5e5C830f97292a3C6Bfea464D3ad4CE631e6Fbc5 --allow-insecure-unlock --http --http.addr 0.0.0.0 --http.port 8545 --http.api personal,db,eth,net,web3 --mine --miner.etherbase 0x5e5C830f97292a3C6Bfea464D3ad4CE631e6Fbc5 --ws --ws.addr 0.0.0.0 --ws.port 8546 --ws.api personal,db,eth,net,web3 --rpc.allow-unprotected-txs --password password.txt
- name: Setup avalanche-cli node
if: ${{matrix.crate == 'rosetta-testing-avalanche'}}
run: |
docker pull avaplatform/avalanche-cli
docker run avaplatform/avalanche-cli:latest subnet create local --evm --evm-chain-id 676767 --evm-defaults --evm-token SUB
docker run avaplatform/avalanche-cli:latest subnet deploy local --local
- name: test (${{ matrix.crate }})
run: cargo test --locked -p ${{ matrix.crate }}
# Test all crates, excluding the clients
test:
needs: [rustfmt]
runs-on: self-hosted
name: cargo test --workspace --all-features
steps:
- name: Checkout sources
uses: actions/checkout@v4
- run: sudo add-apt-repository ppa:ethereum/ethereum
- run: sudo apt-get update -y
- name: Install deps
run: sudo apt-get install -y musl-dev musl-tools solc
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.78.0
components: clippy
target: wasm32-unknown-unknown
override: true
- name: clippy
run: |
cargo clippy --locked --workspace --examples --tests --all-features \
--exclude rosetta-testing-arbitrum \
--exclude rosetta-server-astar \
--exclude rosetta-testing-binance \
--exclude rosetta-server-ethereum \
--exclude rosetta-server-polkadot \
--exclude rosetta-client \
-- \
-Dwarnings \
-Dclippy::unwrap_used \
-Dclippy::expect_used \
-Dclippy::nursery \
-Dclippy::pedantic \
-Aclippy::module_name_repetitions
- name: ethereum-types no-std
run: cargo build --locked -p rosetta-ethereum-types --no-default-features --target wasm32-unknown-unknown
- name: Pull nodes
run: ./scripts/pull_nodes.sh
- name: cargo test
run: |
cargo test --locked --workspace --all-features \
--exclude rosetta-testing-arbitrum \
--exclude rosetta-server-astar \
--exclude rosetta-testing-binance \
--exclude rosetta-server-ethereum \
--exclude rosetta-server-polkadot \
--exclude rosetta-client
- name: Cleanup Docker
run: ./scripts/reset_docker.sh