Add note about new upstream location #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: '*' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- 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 | |
- 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 anker/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 | |
RUST_BACKTRACE=1 cargo test-bpf --manifest-path anker/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 | |
- name: Run Anker 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_anker.py | |
killall -9 solana-test-validator | |
rm -r test-ledger | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: 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/ | |
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 | |
rustup component add clippy | |
cargo install cargo-license --version 0.4.1 | |
- name: Run Clippy | |
run: | | |
cargo clippy --manifest-path anker/Cargo.toml -- --deny warnings | |
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: Typecheck Python | |
run: | | |
git ls-files | grep '\.py$' | xargs mypy --strict | |
- name: Check license compatibility | |
run: | | |
tests/check_licenses.py |