@@ -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 }}
0 commit comments