-
Notifications
You must be signed in to change notification settings - Fork 13
236 lines (210 loc) · 8.72 KB
/
build_and_test.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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
name: Build And Test
on: [push]
env:
CARGO_TERM_COLOR: always
CARGO_TERM_VERBOSE: true
CARGOFLAGS: --workspace --all-targets
RUST_LOG: trace
jobs:
debug_mode_build:
name: Compile code in debug mode
runs-on: ubicloud-standard-4
steps:
- uses: actions/checkout@v4
- name: Compile in debug mode
run: cargo build $CARGOFLAGS
- name: Save build artifacts
uses: actions/cache/save@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
release_mode_build:
name: Compile code in release mode
runs-on: ubicloud-standard-4
steps:
- uses: actions/checkout@v4
- name: Compile in release mode
run: cargo build $CARGOFLAGS --release
- name: Save build artifacts
uses: actions/cache/save@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
debug_mode_test:
name: Test code in debug mode
runs-on: ubicloud-standard-4
needs: debug_mode_build
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: clementine
POSTGRES_USER: clementine
POSTGRES_PASSWORD: clementine
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 50
steps:
- uses: actions/checkout@v4
- name: Restore cached build artifacts
uses: actions/cache/restore@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
- name: Download Bitcoin
run: wget https://bitcoin.org/bin/bitcoin-core-27.0/bitcoin-27.0-x86_64-linux-gnu.tar.gz
- name: Unpack Bitcoin
run: tar -xzvf bitcoin-27.0-x86_64-linux-gnu.tar.gz
- name: Start Bitcoind
run: bitcoin-27.0/bin/bitcoind -regtest -rpcuser=admin -rpcpassword=admin -rpcport=18443 -fallbackfee=0.00001 -wallet=admin -txindex=1 &
- name: Create a wallet in Bitcoin regtest
run: bitcoin-27.0/bin/bitcoin-cli -regtest -rpcuser=admin -rpcpassword=admin -rpcport=18443 createwallet "admin"
- name: Create funds in Bitcoin regtest
run: bitcoin-27.0/bin/bitcoin-cli -regtest -rpcuser=admin -rpcpassword=admin -rpcport=18443 generatetoaddress 101 $(bitcoin-27.0/bin/bitcoin-cli -regtest -rpcuser=admin -rpcpassword=admin -rpcport=18443 getnewaddress)
- name: Create config overwrite file
run: |
cat << EOF > /home/runner/overwrite.toml
tracing_debug = "debug,bitcoincore_rpc=info,hyper=error"
host = "127.0.0.1"
port = 3000
secret_key = "5555555555555555555555555555555555555555555555555555555555555555"
verifiers_public_keys = [
"4f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa",
"466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27",
"3c72addb4fdf09af94f0c94d7fe92a386a7e70cf8a1d85916386bb2535c7b1b1",
"2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",
"9ac20335eb38768d2052be1dbbc3c8f6178407458e51e6b4ad22f1d91758895b",
]
db_file_path = "database"
num_verifiers = 4
min_relay_fee = 305
user_takes_after = 200
confirmation_treshold = 1
network = "regtest"
bitcoin_rpc_url = "http://127.0.0.1:18443"
bitcoin_rpc_user = "admin"
bitcoin_rpc_password = "admin"
all_secret_keys = [
"1111111111111111111111111111111111111111111111111111111111111111",
"2222222222222222222222222222222222222222222222222222222222222222",
"3333333333333333333333333333333333333333333333333333333333333333",
"4444444444444444444444444444444444444444444444444444444444444444",
"5555555555555555555555555555555555555555555555555555555555555555",
]
db_host = "127.0.0.1"
db_port = 5432
db_user = "clementine"
db_password = "clementine"
db_name = "clementine"
citrea_rpc_url = "http://159.89.214.47/"
bridge_contract_address = "3100000000000000000000000000000000000002"
EOF
- name: Debug mode cache warm up with max paralel jobs
run: cargo build $CARGOFLAGS
- name: Run tests on Bitcoin regtest
run: RISC0_DEV_MODE=1 TEST_CONFIG=/home/runner/overwrite.toml cargo test --verbose --jobs 1
- name: Run tests on mock RPC
run: RISC0_DEV_MODE=1 TEST_CONFIG=/home/runner/overwrite.toml cargo test --verbose --features mock_rpc
release_mode_test:
name: Test code in release mode
runs-on: ubicloud-standard-4
needs: release_mode_build
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: clementine
POSTGRES_USER: clementine
POSTGRES_PASSWORD: clementine
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 50
steps:
- uses: actions/checkout@v4
- name: Restore cached build artifacts
uses: actions/cache/restore@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
- name: Download Bitcoin
run: wget https://bitcoin.org/bin/bitcoin-core-27.0/bitcoin-27.0-x86_64-linux-gnu.tar.gz
- name: Unpack Bitcoin
run: tar -xzvf bitcoin-27.0-x86_64-linux-gnu.tar.gz
- name: Start Bitcoind
run: bitcoin-27.0/bin/bitcoind -regtest -rpcuser=admin -rpcpassword=admin -rpcport=18443 -fallbackfee=0.00001 -wallet=admin -txindex=1 &
- name: Create a wallet in Bitcoin regtest
run: bitcoin-27.0/bin/bitcoin-cli -regtest -rpcuser=admin -rpcpassword=admin -rpcport=18443 createwallet "admin"
- name: Create funds in Bitcoin regtest
run: bitcoin-27.0/bin/bitcoin-cli -regtest -rpcuser=admin -rpcpassword=admin -rpcport=18443 generatetoaddress 101 $(bitcoin-27.0/bin/bitcoin-cli -regtest -rpcuser=admin -rpcpassword=admin -rpcport=18443 getnewaddress)
- name: Create config overwrite file
run: |
cat << EOF > /home/runner/overwrite.toml
tracing_debug = "debug,bitcoincore_rpc=info,hyper=error"
host = "127.0.0.1"
port = 3000
secret_key = "5555555555555555555555555555555555555555555555555555555555555555"
verifiers_public_keys = [
"4f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa",
"466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27",
"3c72addb4fdf09af94f0c94d7fe92a386a7e70cf8a1d85916386bb2535c7b1b1",
"2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",
"9ac20335eb38768d2052be1dbbc3c8f6178407458e51e6b4ad22f1d91758895b",
]
db_file_path = "database"
num_verifiers = 4
min_relay_fee = 305
user_takes_after = 200
confirmation_treshold = 1
network = "regtest"
bitcoin_rpc_url = "http://127.0.0.1:18443"
bitcoin_rpc_user = "admin"
bitcoin_rpc_password = "admin"
all_secret_keys = [
"1111111111111111111111111111111111111111111111111111111111111111",
"2222222222222222222222222222222222222222222222222222222222222222",
"3333333333333333333333333333333333333333333333333333333333333333",
"4444444444444444444444444444444444444444444444444444444444444444",
"5555555555555555555555555555555555555555555555555555555555555555",
]
db_host = "127.0.0.1"
db_port = 5432
db_user = "clementine"
db_password = "clementine"
db_name = "clementine"
citrea_rpc_url = "http://159.89.214.47/"
bridge_contract_address = "3100000000000000000000000000000000000002"
EOF
- name: Release mode cache warm up with max paralel jobs
run: cargo build $CARGOFLAGS --release
- name: Run tests on Bitcoin regtest with release build
run: RISC0_DEV_MODE=1 TEST_CONFIG=/home/runner/overwrite.toml cargo test --verbose --jobs 1 --release
- name: Run tests on mock RPC with release build
run: RISC0_DEV_MODE=1 TEST_CONFIG=/home/runner/overwrite.toml cargo test --verbose --features mock_rpc --release