Skip to content

Commit dafeae0

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 1d980dc commit dafeae0

File tree

8 files changed

+174
-74
lines changed

8 files changed

+174
-74
lines changed

.github/workflows/README.md

+23
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

+81-36
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,91 @@
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+
rev: b2ac115
27+
path: maintainer-tools
28+
- name: "Select toolchain"
29+
uses: dtolnay/rust-toolchain@stable
30+
- name: "Set dependencies"
31+
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
32+
- name: "Run test script"
33+
run: ./maintainer-tools/ci/run_task.sh stable
3334

34-
integrations-tests:
35-
name: Integration Tests
35+
Nightly: # 2 jobs, one per lock file.
36+
name: Test - nightly toolchain
3637
runs-on: ubuntu-latest
3738
strategy:
39+
fail-fast: false
40+
matrix:
41+
dep: [minimal, recent]
42+
steps:
43+
- name: "Checkout repo"
44+
uses: actions/checkout@v4
45+
- name: "Checkout maintainer tools"
46+
uses: actions/checkout@v4
47+
with:
48+
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
49+
rev: b2ac115
50+
path: maintainer-tools
51+
- name: "Select toolchain"
52+
uses: dtolnay/rust-toolchain@nightly
53+
- name: "Set dependencies"
54+
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
55+
- name: "Run test script"
56+
run: ./maintainer-tools/ci/run_task.sh nightly
57+
58+
MSRV: # 2 jobs, one per lock file.
59+
name: Test - 1.56.1 toolchain
60+
runs-on: ubuntu-latest
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
dep: [minimal, recent]
65+
steps:
66+
- name: "Checkout repo"
67+
uses: actions/checkout@v4
68+
- name: "Checkout maintainer tools"
69+
uses: actions/checkout@v4
70+
with:
71+
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
72+
rev: b2ac115
73+
path: maintainer-tools
74+
- name: "Select toolchain"
75+
uses: dtolnay/rust-toolchain@stable
76+
with:
77+
toolchain: "1.56.1"
78+
- name: "Set dependencies"
79+
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
80+
- name: "Run test script"
81+
run: ./maintainer-tools/ci/run_task.sh msrv
82+
83+
Integration: # 1 job for each Bitcoin Core version.
84+
name: Integration tests - stable toolchain
85+
runs-on: ubuntu-latest
86+
strategy:
87+
fail-fast: false
3888
matrix:
39-
rust: [stable]
4089
bitcoinversion:
4190
[
4291
"0.18.0",
@@ -48,15 +97,11 @@ jobs:
4897
"0.21.0",
4998
]
5099
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
100+
- name: "Checkout repo"
101+
uses: actions/checkout@v4
102+
- name: "Select toolchain"
103+
uses: dtolnay/rust-toolchain@stable
104+
- name: "Run integration tests"
60105
env:
61106
BITCOINVERSION: ${{ matrix.bitcoinversion }}
62-
run: ./contrib/test.sh
107+
run: ./contrib/integration_test.sh

client/contrib/test_vars.sh

+10
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

+4
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

+45
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

-38
This file was deleted.

json/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ serde = { version = "1", features = [ "derive" ] }
2424
serde_json = "1"
2525

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

json/contrib/test_vars.sh

+10
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)