Skip to content

Commit fcdc24d

Browse files
CI: Add regtest bridge tests and compilation cache (BitVM#200)
* CI: Reactivate bridge tests * Update CI.yml * CI: Use regtest scripts * Add env variables, secrets and cache * Fix: Syntax for uses * Fix: Indentation * CI: Add own build job and reduce timeouts * CI: Add needs * CI: Create wallet * Update faucet.rs * CI: Disable bridge tests --------- Co-authored-by: Lukas <[email protected]> Co-authored-by: stillsaiko <[email protected]>
1 parent 4e54bf2 commit fcdc24d

File tree

3 files changed

+78
-33
lines changed

3 files changed

+78
-33
lines changed

.github/workflows/CI.yml

Lines changed: 73 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,50 +13,91 @@ env:
1313
jobs:
1414
clippy:
1515
if: github.event.pull_request.draft == false
16-
timeout-minutes: 60
16+
timeout-minutes: 10
1717
runs-on: self-hosted
1818
steps:
1919
- uses: actions/checkout@v4
2020
- name: Run clippy
2121
run: cargo clippy
22+
2223
build:
2324
if: github.event.pull_request.draft == false
24-
timeout-minutes: 60
25+
timeout-minutes: 10
26+
runs-on: self-hosted
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Cache Build Artifacts
31+
uses: actions/cache@v4
32+
with:
33+
path: |
34+
~/.cargo/bin/
35+
~/.cargo/registry/index/
36+
~/.cargo/registry/cache/
37+
~/.cargo/git/db/
38+
target/
39+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
40+
41+
- name: Build
42+
run: cargo build
43+
44+
test_script:
45+
if: github.event.pull_request.draft == false
46+
timeout-minutes: 30
47+
needs: build
2548
runs-on: self-hosted
2649
steps:
2750
- uses: actions/checkout@v4
51+
52+
- name: Cache Build Artifacts
53+
uses: actions/cache@v4
54+
with:
55+
path: |
56+
~/.cargo/bin/
57+
~/.cargo/registry/index/
58+
~/.cargo/registry/cache/
59+
~/.cargo/git/db/
60+
target/
61+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
62+
2863
- name: Build
2964
run: cargo build
65+
3066
- name: Run tests
3167
run: |
3268
cargo test -- --skip bridge::
33-
# cargo test -- --test-threads=4 \
34-
# --skip bn254::pairing::test::test_quad_miller_loop_with_c_wi \
35-
# --skip bn254::pairing::test::test_hinted_quad_miller_loop_with_c_wi \
36-
# --skip groth16::test::test_groth16_verifier \
37-
# --skip groth16::test::test_hinted_groth16_verifier \
38-
# --skip groth16::offchain_checker::test::test_checkpairing_with_c_wi_groth16 \
39-
# --skip bridge::
40-
# cargo test -- --test bn254::pairing::test::test_quad_miller_loop_with_c_wi --exact
41-
# cargo test -- --test bn254::pairing::test::test_hinted_quad_miller_loop_with_c_wi --exact
42-
# cargo test -- --test groth16::test::test_groth16_verifier --exact
43-
# cargo test -- --test groth16::test::test_hinted_groth16_verifier --exact
44-
# cargo test -- --test groth16::offchain_checker::test::test_checkpairing_with_c_wi_groth16 --exact
45-
# bridge:
46-
# if: github.event.pull_request.draft == false
47-
# timeout-minutes: 60
48-
# runs-on: ubuntu-latest
49-
# steps:
50-
# - uses: actions/checkout@v4
51-
# - name: Run bridge tests
52-
# run: |
53-
# docker pull blockstream/esplora:latest
54-
# docker run -e NO_REGTEST_MINING=1 -p 50001:50001 -p 8094:80 --volume $PWD/data_bitcoin_regtest:/data --rm -i -t blockstream/esplora bash -c "/srv/explorer/run.sh bitcoin-regtest explorer" &
55-
# sleep 720
56-
# docker exec -it $(docker ps | grep blockstream/esplora | awk '{print $1}') /bin/bash
57-
# /srv/explorer/bitcoin/bin/bitcoin-cli -conf=/data/.bitcoin.conf -datadir=/data/bitcoin createwallet default
58-
# address=`/srv/explorer/bitcoin/bin/bitcoin-cli -conf=/data/.bitcoin.conf -datadir=/data/bitcoin getnewaddress`
59-
# /srv/explorer/bitcoin/bin/bitcoin-cli -conf=/data/.bitcoin.conf -datadir=/data/bitcoin generatetoaddress 100 $address
60-
# watch -n 40 "/srv/explorer/bitcoin/bin/bitcoin-cli -conf=/data/.bitcoin.conf -datadir=/data/bitcoin generatetoaddress 1 $address" &>/dev/null &
61-
# exit
62-
# cargo test -- --test bridge::
69+
70+
# test_bridge:
71+
# if: github.event.pull_request.draft == false
72+
# timeout-minutes: 200
73+
# needs: build
74+
# runs-on: self-hosted
75+
# steps:
76+
# - uses: actions/checkout@v4
77+
#
78+
# - name: Cache Build Artifacts
79+
# uses: actions/cache@v4
80+
# with:
81+
# path: |
82+
# ~/.cargo/bin/
83+
# ~/.cargo/registry/index/
84+
# ~/.cargo/registry/cache/
85+
# ~/.cargo/git/db/
86+
# target/
87+
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
88+
#
89+
# - name: Build
90+
# run: cargo build
91+
#
92+
# - name: Run bridge tests
93+
# env:
94+
# BRIDGE_DATA_STORE_CLIENT_DATA_SUFFIX: bridge-client-data.json
95+
# BRIDGE_AWS_ACCESS_KEY_ID: ${{ secrets.BRIDGE_AWS_ACCESS_KEY_ID }}
96+
# BRIDGE_AWS_SECRET_ACCESS_KEY: ${{ secrets.BRIDGE_AWS_SECRET_ACCESS_KEY }}
97+
# BRIDGE_AWS_REGION: ap-southeast-1
98+
# BRIDGE_AWS_BUCKET: bitvm
99+
# run: |
100+
# cd regtest
101+
# ./install.sh <<< "."
102+
# ./start.sh
103+
# cargo test -- --test bridge::

bridge/tests/bridge/faucet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl Faucet {
8989
fn fund_input_by_cli(&self, address: &Address, amount: Amount) -> Txid {
9090
let funding_command = format!("/srv/explorer/bitcoin/bin/bitcoin-cli -conf=/data/.bitcoin.conf -datadir=/data/bitcoin sendtoaddress {} {}", address, amount.to_btc());
9191
let command = format!(
92-
r#"/usr/local/bin/docker exec $(/usr/local/bin/docker ps | grep blockstream/esplora | awk '{}') /bin/bash -c "{}""#,
92+
r#"docker exec $(docker ps | grep blockstream/esplora | awk '{}') /bin/bash -c "{}""#,
9393
"{print $1}", funding_command
9494
);
9595
let output = Command::new("/bin/bash")

regtest/start.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ if [ -n "$data_path" ]; then
1818
sleep 10
1919
fi
2020

21+
pid=`docker ps | grep blockstream/esplora | awk '{print $1}'`
22+
createwallet_command="/srv/explorer/bitcoin/bin/bitcoin-cli -conf=/data/.bitcoin.conf -datadir=/data/bitcoin createwallet default"
23+
docker exec $pid /bin/bash -c "$createwallet_command"
24+
2125
pid=`ps | grep "[b]lock-generator" | awk '{print $1}'`
2226
echo "Start up block miner ..."
2327
if [ -n "$pid" ]; then

0 commit comments

Comments
 (0)