Skip to content

Commit 9506ecf

Browse files
committed
Add Docker Compose and CI workflows for integration tests
- Add docker-compose configs for CLN (bitcoind 29.1), LND (bitcoind 29.1), and Eclair (bitcoind 30.2 required by Eclair latest) - Add CI workflows: cln-integration.yml, lnd-integration.yml, eclair-integration.yml - Bump corepc-node feature to 29_0 and update download_bitcoind_electrs.sh
1 parent d736136 commit 9506ecf

12 files changed

+291
-44
lines changed

.github/workflows/benchmarks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: actions/cache@v4
2424
with:
2525
path: bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
26-
key: bitcoind-${{ runner.os }}-${{ runner.arch }}
26+
key: bitcoind-29.0-${{ runner.os }}-${{ runner.arch }}
2727
- name: Enable caching for electrs
2828
id: cache-electrs
2929
uses: actions/cache@v4
@@ -34,7 +34,7 @@ jobs:
3434
if: "(steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true')"
3535
run: |
3636
source ./scripts/download_bitcoind_electrs.sh
37-
mkdir bin
37+
mkdir -p bin
3838
mv "$BITCOIND_EXE" bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
3939
mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }}
4040
- name: Set bitcoind/electrs environment variables

.github/workflows/cln-integration.yml

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,64 @@ jobs:
1313
- name: Checkout repository
1414
uses: actions/checkout@v4
1515

16-
- name: Install dependencies
16+
- name: Create temporary directory for CLN data
17+
run: echo "CLN_DATA_DIR=$(mktemp -d)" >> $GITHUB_ENV
18+
19+
- name: Start bitcoind and electrs
20+
run: docker compose -f docker-compose-cln.yml up -d bitcoin electrs
21+
env:
22+
CLN_DATA_DIR: ${{ env.CLN_DATA_DIR }}
23+
24+
- name: Wait for bitcoind to be healthy
25+
run: |
26+
for i in $(seq 1 30); do
27+
if docker compose -f docker-compose-cln.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass getblockchaininfo > /dev/null 2>&1; then
28+
echo "bitcoind is ready"
29+
exit 0
30+
fi
31+
echo "Waiting for bitcoind... ($i/30)"
32+
sleep 2
33+
done
34+
echo "ERROR: bitcoind not ready"
35+
exit 1
36+
37+
- name: Mine initial block for CLN
1738
run: |
18-
sudo apt-get update -y
19-
sudo apt-get install -y socat
39+
docker compose -f docker-compose-cln.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass createwallet miner
40+
ADDR=$(docker compose -f docker-compose-cln.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass -rpcwallet=miner getnewaddress)
41+
docker compose -f docker-compose-cln.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass generatetoaddress 1 "$ADDR"
42+
docker compose -f docker-compose-cln.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass unloadwallet miner
43+
44+
- name: Start lightningd
45+
run: docker compose -f docker-compose-cln.yml up -d cln
46+
env:
47+
CLN_DATA_DIR: ${{ env.CLN_DATA_DIR }}
2048

21-
- name: Start bitcoind, electrs, and lightningd
22-
run: docker compose -f docker-compose-cln.yml up -d
49+
- name: Wait for CLN to be ready
50+
run: |
51+
for i in $(seq 1 30); do
52+
if docker compose -f docker-compose-cln.yml exec cln test -S /root/.lightning/regtest/lightning-rpc 2>/dev/null; then
53+
echo "CLN RPC socket found"
54+
break
55+
fi
56+
echo "Waiting for CLN RPC socket... ($i/30)"
57+
sleep 2
58+
done
59+
docker compose -f docker-compose-cln.yml exec cln test -S /root/.lightning/regtest/lightning-rpc || {
60+
echo "ERROR: CLN RPC socket not found after 60 seconds"
61+
docker compose -f docker-compose-cln.yml logs cln
62+
exit 1
63+
}
2364
24-
- name: Forward lightningd RPC socket
65+
- name: Set permissions for CLN data directory
2566
run: |
26-
docker exec ldk-node-cln-1 sh -c "socat -d -d TCP-LISTEN:9937,fork,reuseaddr UNIX-CONNECT:/root/.lightning/regtest/lightning-rpc&"
27-
socat -d -d UNIX-LISTEN:/tmp/lightning-rpc,reuseaddr,fork TCP:127.0.0.1:9937&
67+
sudo chown -R $(id -u):$(id -g) $CLN_DATA_DIR
68+
sudo chmod -R 755 $CLN_DATA_DIR
69+
env:
70+
CLN_DATA_DIR: ${{ env.CLN_DATA_DIR }}
2871

2972
- name: Run CLN integration tests
30-
run: RUSTFLAGS="--cfg cln_test" cargo test --test integration_tests_cln
73+
run: CLN_SOCKET_PATH=$CLN_DATA_DIR/regtest/lightning-rpc
74+
RUSTFLAGS="--cfg cln_test" cargo test --test integration_tests_cln -- --show-output --test-threads=1
75+
env:
76+
CLN_DATA_DIR: ${{ env.CLN_DATA_DIR }}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CI Checks - Eclair Integration Tests
2+
3+
on: [push, pull_request]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
check-eclair:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Start bitcoind and electrs
17+
run: docker compose -f docker-compose-eclair.yml up -d bitcoin electrs
18+
19+
- name: Wait for bitcoind to be healthy
20+
run: |
21+
for i in $(seq 1 30); do
22+
if docker compose -f docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass getblockchaininfo > /dev/null 2>&1; then
23+
echo "bitcoind is ready"
24+
exit 0
25+
fi
26+
echo "Waiting for bitcoind... ($i/30)"
27+
sleep 2
28+
done
29+
echo "ERROR: bitcoind not ready"
30+
exit 1
31+
32+
- name: Create wallets on bitcoind
33+
run: |
34+
docker compose -f docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass createwallet eclair
35+
docker compose -f docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass -rpcwallet=eclair getnewaddress
36+
docker compose -f docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass createwallet ldk_node_test
37+
38+
- name: Start Eclair
39+
run: docker compose -f docker-compose-eclair.yml up -d eclair
40+
41+
- name: Wait for Eclair to be ready
42+
run: |
43+
for i in $(seq 1 60); do
44+
if curl -s -u :eclairpassword -X POST http://127.0.0.1:8080/getinfo > /dev/null 2>&1; then
45+
echo "Eclair is ready"
46+
exit 0
47+
fi
48+
echo "Waiting for Eclair... ($i/60)"
49+
sleep 5
50+
done
51+
echo "Eclair failed to start"
52+
docker compose -f docker-compose-eclair.yml logs eclair
53+
exit 1
54+
55+
- name: Run Eclair integration tests
56+
run: RUSTFLAGS="--cfg eclair_test" cargo test --test integration_tests_eclair -- --show-output --test-threads=1

.github/workflows/lnd-integration.yml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ jobs:
1414
uses: actions/checkout@v4
1515

1616
- name: Check and install CMake if needed
17-
# lnd_grpc_rust (via prost-build v0.10.4) requires CMake >= 3.5 but is incompatible with CMake >= 4.0.
18-
# This step checks if CMake is missing, below 3.5, or 4.0 or higher, and installs CMake 3.31.6 if needed,
19-
# ensuring compatibility with prost-build in ubuntu-latest.
2017
run: |
2118
if ! command -v cmake &> /dev/null ||
2219
[ "$(cmake --version | head -n1 | cut -d' ' -f3)" \< "3.5" ] ||
@@ -33,24 +30,54 @@ jobs:
3330
fi
3431
3532
- name: Create temporary directory for LND data
36-
id: create-temp-dir
3733
run: echo "LND_DATA_DIR=$(mktemp -d)" >> $GITHUB_ENV
3834

3935
- name: Start bitcoind, electrs, and LND
4036
run: docker compose -f docker-compose-lnd.yml up -d
4137
env:
4238
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}
4339

40+
- name: Wait for LND to be ready
41+
run: |
42+
for i in $(seq 1 30); do
43+
if docker exec ldk-node-lnd test -f /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon 2>/dev/null; then
44+
echo "LND macaroon found"
45+
break
46+
fi
47+
echo "Waiting for LND macaroon... ($i/30)"
48+
sleep 2
49+
done
50+
docker exec ldk-node-lnd test -f /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon || {
51+
echo "ERROR: LND macaroon not found after 60 seconds"
52+
docker compose -f docker-compose-lnd.yml logs lnd
53+
exit 1
54+
}
55+
4456
- name: Set permissions for LND data directory
45-
# In PR 4622 (https://github.com/lightningnetwork/lnd/pull/4622),
46-
# LND sets file permissions to 0700, preventing test code from accessing them.
47-
# This step ensures the test suite has the necessary permissions.
4857
run: sudo chmod -R 755 $LND_DATA_DIR
4958
env:
5059
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}
5160

61+
- name: Wait for LND gRPC to be ready
62+
run: |
63+
for i in $(seq 1 15); do
64+
if docker exec ldk-node-lnd lncli \
65+
--rpcserver=localhost:8081 \
66+
--tlscertpath=/root/.lnd/tls.cert \
67+
--macaroonpath=/root/.lnd/data/chain/bitcoin/regtest/admin.macaroon \
68+
--network=regtest getinfo 2>/dev/null; then
69+
echo "LND gRPC is ready"
70+
exit 0
71+
fi
72+
echo "Waiting for LND gRPC... ($i/15)"
73+
sleep 2
74+
done
75+
echo "ERROR: LND gRPC not ready after 30 seconds"
76+
docker compose -f docker-compose-lnd.yml logs lnd
77+
exit 1
78+
5279
- name: Run LND integration tests
5380
run: LND_CERT_PATH=$LND_DATA_DIR/tls.cert LND_MACAROON_PATH=$LND_DATA_DIR/data/chain/bitcoin/regtest/admin.macaroon
54-
RUSTFLAGS="--cfg lnd_test" cargo test --test integration_tests_lnd -- --exact --show-output
81+
RUSTFLAGS="--cfg lnd_test" cargo test --test integration_tests_lnd -- --show-output --test-threads=1
5582
env:
5683
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
uses: actions/cache@v4
5050
with:
5151
path: bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
52-
key: bitcoind-${{ runner.os }}-${{ runner.arch }}
52+
key: bitcoind-29.0-${{ runner.os }}-${{ runner.arch }}
5353
- name: Enable caching for electrs
5454
id: cache-electrs
5555
uses: actions/cache@v4
@@ -60,7 +60,7 @@ jobs:
6060
if: "matrix.platform != 'windows-latest' && (steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true')"
6161
run: |
6262
source ./scripts/download_bitcoind_electrs.sh
63-
mkdir bin
63+
mkdir -p bin
6464
mv "$BITCOIND_EXE" bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
6565
mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }}
6666
- name: Set bitcoind/electrs environment variables

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,18 @@ winapi = { version = "0.3", features = ["winbase"] }
8888
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "49912057895ddfbd69d503de67c80d5576c09953", features = ["std", "_test_utils"] }
8989
rand = { version = "0.9.2", default-features = false, features = ["std", "thread_rng", "os_rng"] }
9090
proptest = "1.0.0"
91+
paste = "1.0"
9192
regex = "1.5.6"
9293
criterion = { version = "0.7.0", features = ["async_tokio"] }
9394
ldk-node-062 = { package = "ldk-node", version = "=0.6.2" }
9495
ldk-node-070 = { package = "ldk-node", version = "=0.7.0" }
9596

9697
[target.'cfg(not(no_download))'.dev-dependencies]
97-
electrsd = { version = "0.36.1", default-features = false, features = ["legacy", "esplora_a33e97e1", "corepc-node_27_2"] }
98+
electrsd = { version = "0.36.1", default-features = false, features = ["legacy", "esplora_a33e97e1", "corepc-node_29_0"] }
9899

99100
[target.'cfg(no_download)'.dev-dependencies]
100101
electrsd = { version = "0.36.1", default-features = false, features = ["legacy"] }
101-
corepc-node = { version = "0.10.0", default-features = false, features = ["27_2"] }
102+
corepc-node = { version = "0.10.0", default-features = false, features = ["29_0"] }
102103

103104
[target.'cfg(cln_test)'.dev-dependencies]
104105
clightningrpc = { version = "0.3.0-beta.8", default-features = false }

Dockerfile.eclair

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Repackage acinq/eclair:latest onto a glibc-based runtime.
2+
# The official image uses Alpine (musl libc), which causes SIGSEGV in
3+
# secp256k1-jni because the native library is compiled against glibc.
4+
FROM acinq/eclair:latest AS source
5+
6+
FROM eclipse-temurin:21-jre-jammy
7+
WORKDIR /app
8+
9+
RUN apt-get update && apt-get install -y --no-install-recommends \
10+
bash jq curl unzip && \
11+
rm -rf /var/lib/apt/lists/*
12+
13+
COPY --from=source /sbin/eclair-cli /sbin/eclair-cli
14+
COPY --from=source /app/eclair-node /app/eclair-node
15+
16+
ENV ECLAIR_DATADIR=/data
17+
ENV JAVA_OPTS=
18+
19+
RUN mkdir -p "$ECLAIR_DATADIR"
20+
VOLUME [ "/data" ]
21+
22+
ENTRYPOINT JAVA_OPTS="${JAVA_OPTS}" eclair-node/bin/eclair-node.sh "-Declair.datadir=${ECLAIR_DATADIR}"

docker-compose-cln.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
bitcoin:
3-
image: blockstream/bitcoind:27.2
3+
image: blockstream/bitcoind:30.2
44
platform: linux/amd64
55
command:
66
[
@@ -11,11 +11,16 @@ services:
1111
"-rpcbind=0.0.0.0",
1212
"-rpcuser=user",
1313
"-rpcpassword=pass",
14-
"-fallbackfee=0.00001"
14+
"-fallbackfee=0.00001",
15+
"-rest",
16+
"-zmqpubrawblock=tcp://0.0.0.0:28332",
17+
"-zmqpubrawtx=tcp://0.0.0.0:28333"
1518
]
1619
ports:
17-
- "18443:18443" # Regtest RPC port
18-
- "18444:18444" # Regtest P2P port
20+
- "18443:18443"
21+
- "18444:18444"
22+
- "28332:28332"
23+
- "28333:28333"
1924
networks:
2025
- bitcoin-electrs
2126
healthcheck:
@@ -48,19 +53,23 @@ services:
4853
- bitcoin-electrs
4954

5055
cln:
51-
image: blockstream/lightningd:v23.08
56+
image: elementsproject/lightningd:v24.08.2
5257
platform: linux/amd64
5358
depends_on:
5459
bitcoin:
5560
condition: service_healthy
61+
volumes:
62+
- ${CLN_DATA_DIR:-/tmp/cln-data}:/root/.lightning
5663
command:
5764
[
5865
"--bitcoin-rpcconnect=bitcoin",
5966
"--bitcoin-rpcport=18443",
6067
"--bitcoin-rpcuser=user",
6168
"--bitcoin-rpcpassword=pass",
6269
"--regtest",
63-
"--experimental-anchors",
70+
"--experimental-splicing",
71+
"--allow-deprecated-apis=true",
72+
"--rpc-file-mode=0666",
6473
]
6574
ports:
6675
- "19846:19846"

0 commit comments

Comments
 (0)