Skip to content

Improved error handling, so that it doesn't crash when a maintainer account has an empty balance #381

Improved error handling, so that it doesn't crash when a maintainer account has an empty balance

Improved error handling, so that it doesn't crash when a maintainer account has an empty balance #381

Workflow file for this run

name: build
on:
push:
branches: [ main, migrate_v2]
pull_request:
branches: '*'
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.60.0
override: true
components: rustfmt
- name: Check Rust formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Install tools
run: |
# Install with Pip instead of Apt because Ubuntu ships ancient versions.
# TODO: Pin the exact version with Nix instead, to make it easier to use
# the same version locally.
sudo apt update
sudo apt-get install -y python3-pip
sudo pip3 install black==21.6b0 click==7.1.2
- name: Check Python formatting
run: |
git ls-files | grep '\.py$' | xargs black --skip-string-normalization --check --diff --color
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.60.0
override: true
- name: cache-build-artifacts
uses: actions/cache@v2
with:
path: |
~/.rustup/toolchains
# If we only cache ~/.cargo, for some reason Cargo still downloads crates later,
# so instead we cache the individual subdirectories and files, which hopefully
# works. Some of the top-level files are needed to make "cargo install" work.
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: build-1.9.28-v1-${{ hashFiles('Cargo.lock') }}
restore-keys: build-1.9.28-v1
- name: Install development tools
run: |
sudo apt update
sudo apt-get install -y libudev-dev
sh -c "$(curl -sSfL https://release.solana.com/v1.9.28/install)"
- name: Run unit tests
run: |
cargo test --manifest-path program/Cargo.toml
cargo test --manifest-path cli/maintainer/Cargo.toml
cargo test --manifest-path cli/listener/Cargo.toml
cargo test --manifest-path cli/common/Cargo.toml
- name: Build on-chain BPF programs
run: |
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
# Build all BPF programs in the workspace, including the multisig program,
# because we will need them later to test Solido.
cargo build-bpf
- name: Test on-chain BPF programs
run: |
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
# But only run the tests for Solido itself, the SPL tests are already
# executed upstream.
RUST_BACKTRACE=1 cargo test-bpf --manifest-path program/Cargo.toml
- name: Build CLI client
run: cargo build --bin solido
- name: Run Solido integration test
run: |
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
validator=$(tests/start_test_validator.py)
# Perform initial Solana setup.
solana-keygen new --no-bip39-passphrase --silent
solana config set --url http://127.0.0.1:8899
# Try to airdrop some times in case it fails
tests/airdrop_lamports.sh
tests/test_solido.py
killall -9 solana-test-validator
rm -r test-ledger
- name: Run Multisig integration test
run: |
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
validator=$(tests/start_test_validator.py)
tests/airdrop_lamports.sh
tests/test_multisig.py
killall -9 solana-test-validator
rm -r test-ledger
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.60.0
override: true
components: rustfmt, clippy
- name: cache-build-artifacts
uses: actions/cache@v2
with:
path: |
~/.rustup/toolchains
# If we only cache ~/.cargo, for some reason Cargo still downloads crates later,
# so instead we cache the individual subdirectories and files, which hopefully
# works. Some of the top-level files are needed to make "cargo install" work.
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
cli/listener/fuzz/target/
key: lint-1.9.28-v1-${{ hashFiles('Cargo.lock', 'cli/listener/fuzz/Cargo.lock') }}
restore-keys: lint-1.9.28-v1
- name: Install linters
run: |
# TODO: Pin the exact version with Nix.
sudo apt update
sudo apt-get install -y python3-pip libudev-dev
# Install with Pip instead of Apt because Ubuntu ships ancient versions.
# TODO: Pin the exact version with Nix instead, to make it easier to use
# the same version locally.
sudo pip3 install mypy==0.902
cargo install cargo-license --version 0.4.1
- name: Run Clippy
run: |
cargo clippy --manifest-path cli/common/Cargo.toml -- --deny warnings
cargo clippy --manifest-path cli/listener/Cargo.toml -- --deny warnings
cargo clippy --manifest-path cli/listener/fuzz/Cargo.toml -- --deny warnings
cargo clippy --manifest-path cli/maintainer/Cargo.toml -- --deny warnings
cargo clippy --manifest-path program/Cargo.toml -- --deny warnings
cargo clippy --manifest-path testlib/Cargo.toml -- --deny warnings
- name: Check license compatibility
run: |
tests/check_licenses.py
- name: Typecheck Python
run: |
git ls-files | grep '\.py$' | xargs mypy