forked from ChorusOne/solido
-
Notifications
You must be signed in to change notification settings - Fork 8
133 lines (109 loc) · 4.13 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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