Skip to content

Commit 7cf092c

Browse files
committed
CI: Use script from rust-bitcoin-maintainer-tools
We have a CI script in the `rust-bitcoin-maintainer-tools` repository, lets use it.
1 parent 57b3a9b commit 7cf092c

File tree

8 files changed

+171
-74
lines changed

8 files changed

+171
-74
lines changed

.github/workflows/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# rust-miniscript workflow notes
2+
3+
We are attempting to run max 20 parallel jobs using GitHub actions (usage limit for free tier).
4+
5+
ref: https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration
6+
7+
The minimal/recent lock files are handled by CI (`rust.yml`).
8+
9+
## Jobs
10+
11+
Run from `rust.yml` unless stated otherwise. Total 11 jobs.
12+
13+
1. `Stable - minimal`
14+
2. `Stable - recent`
15+
3. `Nightly - minimal`
16+
4. `Nightly - recent`
17+
5. `MSRV - minimal`
18+
6. `Integration - 0.18.0`
19+
7. `Integration - 0.18.1`
20+
8. `Integration - 0.19.0.1`
21+
9. `Integration - 0.19.1`
22+
10. `Integration - 0.20.0`
23+
11. `Integration - 0.21.0`

.github/workflows/rust.yml

Lines changed: 78 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,88 @@
1-
on: [push, pull_request]
1+
--- # rust-bitcoincore-rpc CI: If you edit this file please update README.md
2+
on: # yamllint disable-line rule:truthy
3+
push:
4+
branches:
5+
- master
6+
- 'test-ci/**'
7+
pull_request:
28

39
name: Continuous integration
410

511
jobs:
6-
tests:
7-
name: Tests
12+
Stable: # 2 jobs, one per lock file.
13+
name: Test - stable toolchain
814
runs-on: ubuntu-latest
915
strategy:
16+
fail-fast: false
1017
matrix:
11-
include:
12-
- rust: stable
13-
env:
14-
RUSTFMTCHK: true
15-
- rust: nightly
16-
env:
17-
RUSTFMTCHK: false
18-
- rust: 1.56.1
19-
env:
20-
RUSTFMTCHK: false
18+
dep: [minimal, recent]
2119
steps:
22-
- name: Checkout Crate
23-
uses: actions/checkout@v2
24-
- name: Checkout Toolchain
25-
uses: actions-rs/toolchain@v1
20+
- name: "Checkout repo"
21+
uses: actions/checkout@v4
22+
- name: "Checkout maintainer tools"
23+
uses: actions/checkout@v4
2624
with:
27-
profile: minimal
28-
toolchain: ${{ matrix.rust }}
29-
override: true
30-
- name: Running test script
31-
env: ${{ matrix.env }}
32-
run: ./contrib/test.sh
25+
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
26+
path: maintainer-tools
27+
- name: "Select toolchain"
28+
uses: dtolnay/rust-toolchain@stable
29+
- name: "Set dependencies"
30+
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
31+
- name: "Run test script"
32+
run: ./maintainer-tools/ci/run_task.sh stable
3333

34-
integrations-tests:
35-
name: Integration Tests
34+
Nightly: # 2 jobs, one per lock file.
35+
name: Test - nightly toolchain
3636
runs-on: ubuntu-latest
3737
strategy:
38+
fail-fast: false
39+
matrix:
40+
dep: [minimal, recent]
41+
steps:
42+
- name: "Checkout repo"
43+
uses: actions/checkout@v4
44+
- name: "Checkout maintainer tools"
45+
uses: actions/checkout@v4
46+
with:
47+
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
48+
path: maintainer-tools
49+
- name: "Select toolchain"
50+
uses: dtolnay/rust-toolchain@nightly
51+
- name: "Set dependencies"
52+
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
53+
- name: "Run test script"
54+
run: ./maintainer-tools/ci/run_task.sh nightly
55+
56+
MSRV: # Recent lock file currently does not work with MSRV.
57+
name: Test - 1.56.1 toolchain
58+
runs-on: ubuntu-latest
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
dep: [minimal]
63+
steps:
64+
- name: "Checkout repo"
65+
uses: actions/checkout@v4
66+
- name: "Checkout maintainer tools"
67+
uses: actions/checkout@v4
68+
with:
69+
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
70+
path: maintainer-tools
71+
- name: "Select toolchain"
72+
uses: dtolnay/rust-toolchain@stable
73+
with:
74+
toolchain: "1.56.1"
75+
- name: "Set dependencies"
76+
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
77+
- name: "Run test script"
78+
run: ./maintainer-tools/ci/run_task.sh msrv
79+
80+
Integration: # 1 job for each Bitcoin Core version.
81+
name: Integration tests - stable toolchain
82+
runs-on: ubuntu-latest
83+
strategy:
84+
fail-fast: false
3885
matrix:
39-
rust: [stable]
4086
bitcoinversion:
4187
[
4288
"0.18.0",
@@ -48,15 +94,11 @@ jobs:
4894
"0.21.0",
4995
]
5096
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
97+
- name: "Checkout repo"
98+
uses: actions/checkout@v4
99+
- name: "Select toolchain"
100+
uses: dtolnay/rust-toolchain@stable
101+
- name: "Run integration tests"
60102
env:
61103
BITCOINVERSION: ${{ matrix.bitcoinversion }}
62-
run: ./contrib/test.sh
104+
run: ./contrib/integration_test.sh

client/contrib/test_vars.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
# Test all these features with "std" enabled.
4+
FEATURES_WITH_STD=""
5+
6+
# Test all these features without "std" enabled.
7+
FEATURES_WITHOUT_STD="verifymessage"
8+
9+
# Run these examples.
10+
EXAMPLES="retry_client:verifymessage"

contrib/crates.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
# Crates in this workspace to test (excl. fuzz an integration-tests).
4+
CRATES=("json" "client")

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

contrib/test.sh

Lines changed: 0 additions & 38 deletions
This file was deleted.

json/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ serde = { version = "1", features = [ "derive" ] }
2727
serde_json = "1"
2828

2929
bitcoin = { version = "0.31.0", features = ["serde", "rand-std"]}
30+

json/contrib/test_vars.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
# Test all these features with "std" enabled.
4+
FEATURES_WITH_STD=""
5+
6+
# Test all these features without "std" enabled.
7+
FEATURES_WITHOUT_STD=""
8+
9+
# Run these examples.
10+
EXAMPLES=""

0 commit comments

Comments
 (0)