forked from ChorusOne/solido
-
Notifications
You must be signed in to change notification settings - Fork 1
191 lines (159 loc) · 6.15 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
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