Skip to content

Commit 9eff2dc

Browse files
committed
CI: Use a separate script to run integration tests
In preparation for using the `run_task.sh` script from `rust-bitcoin-maintainer-tools` pull the integration stuff out of `test.sh` and into a separate script. Update the CI job to use the new script. Includes switch to the dtolnay runner (maintaining use of stable toolchain).
1 parent 4cf09b4 commit 9eff2dc

File tree

2 files changed

+54
-13
lines changed

2 files changed

+54
-13
lines changed

.github/workflows/rust.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ jobs:
3131
env: ${{ matrix.env }}
3232
run: ./contrib/test.sh
3333

34-
integrations-tests:
35-
name: Integration Tests
34+
Integration:
35+
name: Integration tests - stable toolchain
3636
runs-on: ubuntu-latest
3737
strategy:
38+
fail-fast: false
3839
matrix:
39-
rust: [stable]
4040
bitcoinversion:
4141
[
4242
"0.18.0",
@@ -48,15 +48,11 @@ jobs:
4848
"0.21.0",
4949
]
5050
steps:
51-
- name: Checkout Crate
52-
uses: actions/checkout@v2
53-
- name: Checkout Toolchain
54-
uses: actions-rs/toolchain@v1
55-
with:
56-
profile: minimal
57-
toolchain: ${{ matrix.rust }}
58-
override: true
59-
- name: Running test script
51+
- name: "Checkout repo"
52+
uses: actions/checkout@v4
53+
- name: "Select toolchain"
54+
uses: dtolnay/rust-toolchain@stable
55+
- name: "Run integration tests"
6056
env:
6157
BITCOINVERSION: ${{ matrix.bitcoinversion }}
62-
run: ./contrib/test.sh
58+
run: ./contrib/integration_test.sh

contrib/integration_test.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Run the integration test optionally downloading Bitcoin Core binary if BITCOINVERSION is set.
4+
5+
set -euo pipefail
6+
7+
REPO_DIR=$(git rev-parse --show-toplevel)
8+
9+
# Make all cargo invocations verbose.
10+
export CARGO_TERM_VERBOSE=true
11+
12+
main() {
13+
# If a specific version of Bitcoin Core is set then download the binary.
14+
if [ -n "${BITCOINVERSION+x}" ]; then
15+
download_binary
16+
fi
17+
18+
need_cmd bitcoind
19+
20+
cd integration_test
21+
./run.sh
22+
}
23+
24+
download_binary() {
25+
wget https://bitcoincore.org/bin/bitcoin-core-$BITCOINVERSION/bitcoin-$BITCOINVERSION-x86_64-linux-gnu.tar.gz
26+
tar -xzvf bitcoin-$BITCOINVERSION-x86_64-linux-gnu.tar.gz
27+
export PATH=$PATH:$(pwd)/bitcoin-$BITCOINVERSION/bin
28+
}
29+
30+
err() {
31+
echo "$1" >&2
32+
exit 1
33+
}
34+
35+
need_cmd() {
36+
if ! command -v "$1" > /dev/null 2>&1
37+
then err "need '$1' (command not found)"
38+
fi
39+
}
40+
41+
#
42+
# Main script
43+
#
44+
main "$@"
45+
exit 0

0 commit comments

Comments
 (0)