Merge pull request #33 from lidofinance/exromany-patch-readme #377
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 | |
SOLANA_VERSION: "1.10.38" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Cache build artifacts | |
id: cache-cargo | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: Cache Solana toolchain | |
id: cache-solana | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/solana | |
~/.local/share/solana/install | |
key: ${{ runner.os }}-solana-${{ env.SOLANA_VERSION }} | |
restore-keys: ${{ runner.os }}-solana- | |
- name: Install Solana toolchain | |
if: steps.cache-solana.outputs.cache-hit != 'true' | |
run: | | |
sh -c "$(curl -sSfL https://release.solana.com/v${{ env.SOLANA_VERSION }}/install)" | |
- name: Setup Solana path | |
run: | | |
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH | |
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" | |
solana --version | |
solana config get | |
- uses: dtolnay/[email protected] | |
with: | |
components: rustfmt, clippy | |
- name: Check Rust formatting | |
run: cargo fmt --all -- --check | |
- name: Install `cargo-license` | |
run: cargo install cargo-license --version=0.4.1 | |
- name: Check licenses | |
run: scripts/check_licenses.py | |
- name: Install `libudev-dev` | |
run: | | |
# 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 libudev-dev | |
- name: 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: 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: | | |
# 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: | | |
# But only run the tests for Solido itself, the SPL tests are already | |
# executed upstream. | |
RUST_BACKTRACE=yesPlease cargo test-bpf --manifest-path program/Cargo.toml | |
- name: Build CLI client | |
run: cargo build --bin solido | |
- name: Run Solido integration test | |
run: | | |
validator=$(scripts/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 | |
scripts/airdrop_lamports.sh | |
scripts/test_solido.py | |
killall -9 solana-test-validator | |
rm -r test-ledger | |
- name: Run Multisig integration test | |
run: | | |
validator=$(scripts/start_test_validator.py) | |
scripts/airdrop_lamports.sh | |
scripts/test_multisig.py | |
killall -9 solana-test-validator | |
rm -r test-ledger |