Skip to content

Commit 415aebb

Browse files
committed
Enable caching for bitcoind/electrs in CI
1 parent 16cd4d9 commit 415aebb

File tree

2 files changed

+37
-15
lines changed

2 files changed

+37
-15
lines changed

.github/workflows/build.yml

+21
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,27 @@ jobs:
4141
- name: Set RUSTFLAGS to deny warnings
4242
if: "matrix.toolchain == '1.63.0'"
4343
run: echo "RUSTFLAGS=-D warnings" >> "$GITHUB_ENV"
44+
- name: Enable caching for bitcoind
45+
id: cache-bitcoind
46+
uses: actions/cache@v4
47+
with:
48+
path: $HOME/bin
49+
key: bitcoind
50+
- name: Enable caching for electrs
51+
id: cache-electrs
52+
uses: actions/cache@v4
53+
with:
54+
path: $HOME/bin
55+
key: electrs
56+
- name: Download bitcoind/electrs and set environment variables
57+
if: "matrix.platform != 'windows-latest' && (steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true')"
58+
run: |
59+
source ./contrib/download_bitcoind_electrs.sh
60+
mkdir -p "$HOME"/bin
61+
mv "$BITCOIND_EXE" "$HOME"/bin/bitcoind
62+
mv "$ELECTRS_EXE" "$HOME"/bin/electrs
63+
echo "BITCOIND_EXE=$HOME/bin/bitcoind" >> "$GITHUB_ENV"
64+
echo "ELECTRS_EXE=$HOME/bin/electrs" >> "$GITHUB_ENV"
4465
- name: Run CI script
4566
shell: bash # Default on Winblows is powershell
4667
run: CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh

ci/ci-tests.sh

+16-15
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ set -eox pipefail
33

44
RUSTC_MINOR_VERSION=$(rustc --version | awk '{ split($2,a,"."); print a[2] }')
55
HOST_PLATFORM="$(rustc --version --verbose | grep "host:" | awk '{ print $2 }')"
6-
CONTRIB_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )/../contrib" && pwd )
76

87
# Some crates require pinning to meet our MSRV even for our downstream users,
98
# which we do here.
@@ -45,20 +44,22 @@ cargo check --verbose --color always --features rpc-client,rest-client,tokio
4544
popd
4645

4746
if [[ "$HOST_PLATFORM" != *windows* ]]; then
48-
echo -e "\n\nBuilding and testing Transaction Sync Clients with features"
49-
pushd lightning-transaction-sync
50-
51-
source "$CONTRIB_DIR/download_bitcoind_electrs.sh"
52-
53-
cargo test --verbose --color always --features esplora-blocking
54-
cargo check --verbose --color always --features esplora-blocking
55-
cargo test --verbose --color always --features esplora-async
56-
cargo check --verbose --color always --features esplora-async
57-
cargo test --verbose --color always --features esplora-async-https
58-
cargo check --verbose --color always --features esplora-async-https
59-
cargo test --verbose --color always --features electrum
60-
cargo check --verbose --color always --features electrum
61-
popd
47+
if [ -z "$BITCOIND_EXE" ] || [ -z "$ELECTRS_EXE" ]; then
48+
echo -e "\n\nSkipping testing Transaction Sync Clients due to BITCOIND_EXE or ELECTRS_EXE being unset."
49+
else
50+
echo -e "\n\nBuilding and testing Transaction Sync Clients with features"
51+
pushd lightning-transaction-sync
52+
53+
cargo test --verbose --color always --features esplora-blocking
54+
cargo check --verbose --color always --features esplora-blocking
55+
cargo test --verbose --color always --features esplora-async
56+
cargo check --verbose --color always --features esplora-async
57+
cargo test --verbose --color always --features esplora-async-https
58+
cargo check --verbose --color always --features esplora-async-https
59+
cargo test --verbose --color always --features electrum
60+
cargo check --verbose --color always --features electrum
61+
popd
62+
fi
6263
fi
6364

6465
echo -e "\n\nTest futures builds"

0 commit comments

Comments
 (0)