From: Elias Rohrer Date: Thu, 1 Aug 2024 15:47:45 +0000 (-0500) Subject: Enable caching for `bitcoind`/`electrs` in CI X-Git-Tag: v0.0.124-beta~15^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=4320f483f25eb3c76a6ec4487c4edde7e7e8f5b4;p=rust-lightning Enable caching for `bitcoind`/`electrs` in CI --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6d910656..d15932b5c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,6 +41,29 @@ jobs: - name: Set RUSTFLAGS to deny warnings if: "matrix.toolchain == '1.63.0'" run: echo "RUSTFLAGS=-D warnings" >> "$GITHUB_ENV" + - name: Enable caching for bitcoind + id: cache-bitcoind + uses: actions/cache@v4 + with: + path: bin/bitcoind-${{ runner.os }}-${{ runner.arch }} + key: bitcoind-${{ runner.os }}-${{ runner.arch }} + - name: Enable caching for electrs + id: cache-electrs + uses: actions/cache@v4 + with: + path: bin/electrs-${{ runner.os }}-${{ runner.arch }} + key: electrs-${{ runner.os }}-${{ runner.arch }} + - name: Download bitcoind/electrs + if: "matrix.platform != 'windows-latest' && (steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true')" + run: | + source ./contrib/download_bitcoind_electrs.sh + mkdir bin + mv "$BITCOIND_EXE" bin/bitcoind-${{ runner.os }}-${{ runner.arch }} + mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }} + - name: Set bitcoind/electrs environment variables + run: | + echo "BITCOIND_EXE=$( pwd )/bin/bitcoind-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV" + echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV" - name: Run CI script shell: bash # Default on Winblows is powershell run: CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh diff --git a/ci/ci-tests.sh b/ci/ci-tests.sh index bc5b74d38..74bf427d6 100755 --- a/ci/ci-tests.sh +++ b/ci/ci-tests.sh @@ -3,7 +3,6 @@ set -eox pipefail RUSTC_MINOR_VERSION=$(rustc --version | awk '{ split($2,a,"."); print a[2] }') HOST_PLATFORM="$(rustc --version --verbose | grep "host:" | awk '{ print $2 }')" -CONTRIB_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )/../contrib" && pwd ) # Some crates require pinning to meet our MSRV even for our downstream users, # which we do here. @@ -45,20 +44,22 @@ cargo check --verbose --color always --features rpc-client,rest-client,tokio popd if [[ "$HOST_PLATFORM" != *windows* ]]; then - echo -e "\n\nBuilding and testing Transaction Sync Clients with features" - pushd lightning-transaction-sync - - source "$CONTRIB_DIR/download_bitcoind_electrs.sh" - - cargo test --verbose --color always --features esplora-blocking - cargo check --verbose --color always --features esplora-blocking - cargo test --verbose --color always --features esplora-async - cargo check --verbose --color always --features esplora-async - cargo test --verbose --color always --features esplora-async-https - cargo check --verbose --color always --features esplora-async-https - cargo test --verbose --color always --features electrum - cargo check --verbose --color always --features electrum - popd + if [ -z "$BITCOIND_EXE" ] || [ -z "$ELECTRS_EXE" ]; then + echo -e "\n\nSkipping testing Transaction Sync Clients due to BITCOIND_EXE or ELECTRS_EXE being unset." + else + echo -e "\n\nBuilding and testing Transaction Sync Clients with features" + pushd lightning-transaction-sync + + cargo test --verbose --color always --features esplora-blocking + cargo check --verbose --color always --features esplora-blocking + cargo test --verbose --color always --features esplora-async + cargo check --verbose --color always --features esplora-async + cargo test --verbose --color always --features esplora-async-https + cargo check --verbose --color always --features esplora-async-https + cargo test --verbose --color always --features electrum + cargo check --verbose --color always --features electrum + popd + fi fi echo -e "\n\nTest futures builds"