Skip to content

Commit 0d4ff37

Browse files
authored
Merge pull request #340 from tnull/2024-08-cache-downloads
Enable caching for `bitcoind`/`electrs` in CI
2 parents 952b889 + 40170d9 commit 0d4ff37

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

.github/workflows/rust.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,27 @@ jobs:
5353
- name: Set RUSTFLAGS to deny warnings
5454
if: "matrix.toolchain == 'stable'"
5555
run: echo "RUSTFLAGS=-D warnings" >> "$GITHUB_ENV"
56+
- name: Enable caching for bitcoind
57+
id: cache-bitcoind
58+
uses: actions/cache@v4
59+
with:
60+
path: $HOME/bin/bitcoind
61+
key: bitcoind
62+
- name: Enable caching for electrs
63+
id: cache-electrs
64+
uses: actions/cache@v4
65+
with:
66+
path: $HOME/bin/electrs
67+
key: electrs
5668
- name: Download bitcoind/electrs and set environment variables
57-
if: "matrix.platform != 'windows-latest'"
69+
if: "matrix.platform != 'windows-latest' && (steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true')"
5870
run: |
5971
source ./scripts/download_bitcoind_electrs.sh
60-
cp "$BITCOIND_EXE" "$HOME"/bitcoind
61-
cp "$ELECTRS_EXE" "$HOME"/electrs
62-
echo "BITCOIND_EXE=$HOME/bitcoind" >> "$GITHUB_ENV"
63-
echo "ELECTRS_EXE=$HOME/electrs" >> "$GITHUB_ENV"
72+
mkdir -p "$HOME"/bin
73+
mv "$BITCOIND_EXE" "$HOME"/bin/bitcoind
74+
mv "$ELECTRS_EXE" "$HOME"/bin/electrs
75+
echo "BITCOIND_EXE=$HOME/bin/bitcoind" >> "$GITHUB_ENV"
76+
echo "ELECTRS_EXE=$HOME/bin/electrs" >> "$GITHUB_ENV"
6477
- name: Build on Rust ${{ matrix.toolchain }}
6578
run: cargo build --verbose --color always
6679
- name: Build with UniFFI support on Rust ${{ matrix.toolchain }}

0 commit comments

Comments
 (0)