Skip to content

Commit 1351c20

Browse files
committed
Merge #532: Fix CI. Move bitcoind tests to inner crate
8a07904 Add int tests to workflow (sanket1729) 4311760 Move bitcoind tests to inner crate (sanket1729) Pull request description: This will allow us to have separate test dependacies and test CI only on stable. Ideally, we would want to have to a conditional dev dependancy but that is not possible currently Everytime `bitcoind` breaks with MSRV and we don't really need int tests with MSRV. Another issue is that testing this MSRV(2 years old) becomes a part of CI. When backporting fixes, we need to take care of making it pass. We need to support MSRV of old release(which is 2 + 2 = 4 years old). While our main code passes, the CI fails because we cannot build old bitcoind and we waste time figuring old versions. ACKs for top commit: apoelstra: ACK 8a07904 Tree-SHA512: 869c938600a283be6ba9d17f1244343a018f670b75eb7e581ec1f1ff96a22ea004a58d1332c3187c5622645a4576ec2fd37701660dab51028a838278fda27a19
2 parents 6884d36 + 8a07904 commit 1351c20

File tree

12 files changed

+63
-25
lines changed

12 files changed

+63
-25
lines changed

.github/workflows/rust.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,23 @@ jobs:
4747
DO_FMT: true
4848
run: ./contrib/test.sh
4949

50+
Int-tests:
51+
name: Integration tests
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Checkout Crate
55+
uses: actions/checkout@v2
56+
- name: Checkout Toolchain
57+
uses: actions-rs/toolchain@v1
58+
with:
59+
profile: minimal
60+
toolchain: stable
61+
override: true
62+
- name: Running integration tests
63+
env:
64+
DO_BITCOIND_TESTS: true
65+
run: ./contrib/test.sh
66+
5067
Tests:
5168
name: Tests
5269
runs-on: ubuntu-latest

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ hashbrown = { version = "0.11", optional = true }
3030
actual-serde = { package = "serde", version = "1.0", optional = true }
3131

3232
[dev-dependencies]
33-
bitcoind = { version = "0.27.0", features=["23_0"] }
34-
actual-rand = { package = "rand", version = "0.8.4"}
35-
secp256k1 = {version = "0.24.0", features = ["rand-std"]}
3633
serde_test = "1.0.147"
34+
bitcoin = { version = "0.29.2", features = ["base64"] }
35+
secp256k1 = {version = "0.24.0", features = ["rand-std"]}
36+
actual-base64 = { package = "base64", version = "0.13.0" }
3737

3838
[[example]]
3939
name = "htlc"
@@ -65,4 +65,4 @@ required-features = ["compiler","std"]
6565

6666
[[example]]
6767
name = "psbt_sign_finalize"
68-
required-features = ["std"]
68+
required-features = ["std", "base64"]

bitcoind-tests/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[package]
2+
name = "bitcoind-tests"
3+
version = "0.1.0"
4+
authors = ["sanket1729 <[email protected]>"]
5+
edition = "2018"
6+
7+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8+
9+
[dependencies]
10+
miniscript = {path = "../"}
11+
bitcoind = { version = "0.29.3", features=["23_0"] }
12+
actual-rand = { package = "rand", version = "0.8.4"}
13+
secp256k1 = {version = "0.24.0", features = ["rand-std"]}

bitcoind-tests/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
println!("Hello, world!");
3+
}
File renamed without changes.
File renamed without changes.

tests/setup/test_util.rs renamed to bitcoind-tests/tests/setup/test_util.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
2020
use std::str::FromStr;
2121

22+
use miniscript::bitcoin;
2223
use actual_rand as rand;
2324
use bitcoin::hashes::hex::ToHex;
2425
use bitcoin::hashes::{hash160, ripemd160, sha256, Hash};
@@ -29,6 +30,7 @@ use miniscript::{
2930
Translator,
3031
};
3132
use rand::RngCore;
33+
3234
#[derive(Clone, Debug)]
3335
pub struct PubData {
3436
pub pks: Vec<bitcoin::PublicKey>,

tests/test_cpp.rs renamed to bitcoind-tests/tests/test_cpp.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ use bitcoin::hashes::{sha256d, Hash};
1313
use bitcoin::secp256k1::{self, Secp256k1};
1414
use bitcoin::util::psbt;
1515
use bitcoin::util::psbt::PartiallySignedTransaction as Psbt;
16-
use bitcoin::{self, Amount, LockTime, OutPoint, Sequence, Transaction, TxIn, TxOut, Txid};
16+
use bitcoin::{Amount, LockTime, OutPoint, Sequence, Transaction, TxIn, TxOut, Txid};
1717
use bitcoind::bitcoincore_rpc::{json, Client, RpcApi};
18+
use miniscript::bitcoin;
1819
use miniscript::psbt::PsbtExt;
1920
use miniscript::Descriptor;
2021

tests/test_desc.rs renamed to bitcoind-tests/tests/test_desc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use std::collections::BTreeMap;
88
use std::{error, fmt};
99

10+
use miniscript::bitcoin;
1011
use actual_rand as rand;
1112
use bitcoin::blockdata::witness::Witness;
1213
use bitcoin::hashes::{sha256d, Hash};
@@ -15,7 +16,7 @@ use bitcoin::util::sighash::SighashCache;
1516
use bitcoin::util::taproot::{LeafVersion, TapLeafHash};
1617
use bitcoin::util::{psbt, sighash};
1718
use bitcoin::{
18-
self, secp256k1, Amount, LockTime, OutPoint, SchnorrSig, Script, Sequence, Transaction, TxIn,
19+
secp256k1, Amount, LockTime, OutPoint, SchnorrSig, Script, Sequence, Transaction, TxIn,
1920
TxOut, Txid,
2021
};
2122
use bitcoind::bitcoincore_rpc::{json, Client, RpcApi};

contrib/test.sh

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,26 @@ set -ex
44

55
FEATURES="compiler serde rand base64"
66

7-
cargo update -p serde --precise 1.0.142
8-
cargo update -p serde_derive --precise 1.0.142
9-
107
cargo --version
118
rustc --version
129

10+
# Format if told to
11+
if [ "$DO_FMT" = true ]
12+
then
13+
rustup component add rustfmt
14+
cargo fmt -- --check
15+
fi
16+
1317
# Pin dependencies required to build with Rust 1.41.1
1418
if cargo --version | grep "1\.41\.0"; then
15-
cargo update -p url --precise 2.2.2
16-
cargo update -p form_urlencoded --precise 1.0.1
1719
cargo update -p once_cell --precise 1.13.1
18-
cargo update -p bzip2 --precise 0.4.2
19-
cargo update -p which --precise 4.3.0
2020
fi
2121

2222
# Pin dependencies required to build with Rust 1.47.0
2323
if cargo --version | grep "1\.47\.0"; then
2424
cargo update -p once_cell --precise 1.13.1
2525
fi
2626

27-
# Format if told to
28-
if [ "$DO_FMT" = true ]
29-
then
30-
rustup component add rustfmt
31-
cargo fmt -- --check
32-
fi
33-
3427
# Fuzz if told to
3528
if [ "$DO_FUZZ" = true ]
3629
then
@@ -42,6 +35,15 @@ then
4235
exit 0
4336
fi
4437

38+
# Test bitcoind integration tests if told to (this only works with the stable toolchain)
39+
if [ "$DO_BITCOIND_TESTS" = true ]; then
40+
cd bitcoind-tests
41+
cargo test --verbose
42+
43+
# Exit integration tests, do not run other tests.
44+
exit 0
45+
fi
46+
4547
# Defaults / sanity checks
4648
cargo test
4749

@@ -65,7 +67,7 @@ then
6567
cargo run --example psbt
6668
cargo run --example xpub_descriptors
6769
cargo run --example taproot --features=compiler
68-
cargo run --example psbt_sign_finalize
70+
cargo run --example psbt_sign_finalize --features=base64
6971
fi
7072

7173
if [ "$DO_NO_STD" = true ]

0 commit comments

Comments
 (0)