Skip to content

Commit

Permalink
Reduce number of supported minor versions
Browse files Browse the repository at this point in the history
We support Core back to v0.17.1 and currently explicitly test all minor
versions back to v22 - this is probably an overkill and is only going to
increase as Core progresses. Instead lets just test all minor versions
of the last three releases and then the latest minor version for older
releases.

This has the benefit of reducing the number of CI jobs.
  • Loading branch information
tcharding committed Dec 6, 2024
1 parent 07210b0 commit 93a3a99
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ Run from `rust.yml` unless stated otherwise. Total 11 jobs.
9. `Docsrs`
10. `Format`

+1 job for each supported version of Core.
+15 jobs - 1 for each supported version of Core.


7 changes: 0 additions & 7 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,9 @@ jobs:
"26_1",
"26_0",
"25_2",
"25_1",
"25_0",
"24_2",
"24_1",
"24_0_1",
"23_2",
"23_1",
"23_0",
"22_1",
"22_0",
"0_21_2",
"0_20_2",
"0_19_1",
Expand Down
11 changes: 2 additions & 9 deletions integration_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,19 @@ edition = "2021"
# - `cargo test --no-default-features` skips all tests.
[features]
# Enable the same feature in `node` and the version feature here.
# All minor releases (but only the latest patch release).
# All minor releases of the latest three versions.
28_0 = ["v28", "node/28_0"]
27_2 = ["v27", "node/27_2"]
27_1 = ["v27", "node/27_1"]
27_0 = ["v27", "node/27_0"]
26_2 = ["v26", "node/26_2"]
26_1 = ["v26", "node/26_1"]
26_0 = ["v26", "node/26_0"]
# Only the latest minor version for older versions.
25_2 = ["v25", "node/25_2"]
25_1 = ["v25", "node/25_1"]
25_0 = ["v25", "node/25_0"]
24_2 = ["v24", "node/24_2"]
24_1 = ["v24", "node/24_1"]
24_0_1 = ["v24", "node/24_0_1"]
23_2 = ["v23", "node/23_2"]
23_1 = ["v23", "node/23_1"]
23_0 = ["v23", "node/23_0"]
22_1 = ["v22", "node/22_1"]
22_0 = ["v22", "node/22_0"]
# Only the latest minor version for these.
0_21_2 = ["v21", "node/0_21_2"]
0_20_2 = ["v20", "node/0_20_2"]
0_19_1 = ["v19", "node/0_19_1"]
Expand Down
19 changes: 6 additions & 13 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,19 @@ default = ["28_0"]
# download is not supposed to be used directly only through selecting one of the version feature
download = ["bitcoin_hashes", "flate2", "tar", "minreq", "zip"]

# We support all minor releases (but only the latest patch release).
# We support all minor releases of the latest three versions.
28_0 = ["download", "27_2"]
27_2 = ["download", "27_1"]
27_1 = ["download", "27_0"]
27_0 = ["download", "26_2"]
26_2 = ["download", "26_1"]
26_1 = ["download", "26_0"]
26_0 = ["download", "25_2"]
25_2 = ["download", "25_1"]
25_1 = ["download", "25_0"]
25_0 = ["download", "24_2"]
24_2 = ["download", "24_1"]
24_1 = ["download", "24_0_1"]
24_0_1 = ["download", "23_2"]
23_2 = ["download", "23_1"]
23_1 = ["download", "23_0"]
23_0 = ["download", "22_1"]
22_1 = ["download", "22_0"]
22_0 = ["download", "0_21_2"]
# We only support the latest minor version for these.
# We only support the latest minor version for older versions.
25_2 = ["download", "24_2"]
24_2 = ["download", "23_2"]
23_2 = ["download", "22_1"]
22_1 = ["download", "0_21_2"]
0_21_2 = ["download", "0_20_2"]
0_20_2 = ["download", "0_19_1"]
0_19_1 = ["download", "0_18_1"]
Expand Down
4 changes: 2 additions & 2 deletions node/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mod download {

#[cfg(all(target_os = "macos", any(target_arch = "x86_64", target_arch = "aarch64"),))]
fn download_filename() -> String {
if cfg!(not(feature = "23_1")) {
if cfg!(not(feature = "23_2")) {
format!("bitcoin-{}-osx64.tar.gz", &VERSION)
} else {
format!("bitcoin-{}-x86_64-apple-darwin.tar.gz", &VERSION)
Expand All @@ -43,7 +43,7 @@ mod download {
#[allow(clippy::lines_filter_map_ok)] // clippy doesn't like the `lines` call below and the suggested fix is incorrect.
fn get_expected_sha256(filename: &str) -> anyhow::Result<sha256::Hash> {
let sha256sums_filename = format!("sha256/bitcoin-core-{}-SHA256SUMS", &VERSION);
#[cfg(not(feature = "22_0"))]
#[cfg(not(feature = "22_1"))]
let sha256sums_filename = format!("{}.asc", sha256sums_filename);
let file = File::open(&sha256sums_filename)
.with_context(|| format!("cannot find {:?}", sha256sums_filename))?;
Expand Down
38 changes: 5 additions & 33 deletions node/src/client_versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,47 +38,19 @@ pub use corepc_client::{client_sync::v26::{Client, AddressType}, types::v26 as t
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v25::{Client, AddressType}, types::v25 as types};

#[cfg(all(feature = "25_1", not(feature = "25_2")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v25::{Client, AddressType}, types::v25 as types};

#[cfg(all(feature = "25_0", not(feature = "25_1")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v25::{Client, AddressType}, types::v25 as types};

#[cfg(all(feature = "24_2", not(feature = "25_0")))]
#[cfg(all(feature = "24_2", not(feature = "25_2")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v24::{Client, AddressType}, types::v24 as types};

#[cfg(all(feature = "24_1", not(feature = "24_2")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v24::{Client, AddressType}, types::v24 as types};

#[cfg(all(feature = "24_0_1", not(feature = "24_1")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v24::{Client, AddressType}, types::v24 as types};

#[cfg(all(feature = "23_2", not(feature = "24_0_1")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v23::{Client, AddressType}, types::v23 as types};

#[cfg(all(feature = "23_1", not(feature = "23_2")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v23::{Client, AddressType}, types::v23 as types};

#[cfg(all(feature = "23_0", not(feature = "23_1")))]
#[cfg(all(feature = "23_2", not(feature = "24_2")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v23::{Client, AddressType}, types::v23 as types};

#[cfg(all(feature = "22_1", not(feature = "23_0")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v22::{Client, AddressType}, types::v22 as types};

#[cfg(all(feature = "22_0", not(feature = "22_1")))]
#[cfg(all(feature = "22_1", not(feature = "23_2")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v22::{Client, AddressType}, types::v22 as types};

#[cfg(all(feature = "0_21_2", not(feature = "22_0")))]
#[cfg(all(feature = "0_21_2", not(feature = "22_1")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v21::{Client, AddressType}, types::v21 as types};

Expand All @@ -99,6 +71,6 @@ pub use corepc_client::{client_sync::v18::{Client, AddressType}, types::v18 as t
pub use corepc_client::{client_sync::v17::{Client, AddressType}, types::v17 as types};

// To make --no-default-features work we have to re-export a the types, use most recent version same as we do for all features.
#[cfg(all(not(feature = "28_0"), not(feature = "27_1"), not(feature = "27_0"), not(feature = "26_2"), not(feature = "26_1"), not(feature = "26_0"), not(feature = "25_2"), not(feature = "25_1"), not(feature = "25_0"), not(feature = "24_2"),not(feature = "24_1"), not(feature = "24_0_1"), not(feature = "23_2"), not(feature = "23_1"), not(feature = "23_0"), not(feature = "22_1"), not(feature = "22_0"), not(feature = "0_21_2"), not(feature = "0_20_2"), not(feature = "0_19_1"), not(feature = "0_18_1"), not(feature = "0_17_1")))]
#[cfg(all(not(feature = "28_0"), not(feature = "27_1"), not(feature = "27_0"), not(feature = "26_2"), not(feature = "26_1"), not(feature = "26_0"), not(feature = "25_2"), not(feature = "24_2"), not(feature = "23_2"), not(feature = "22_1"), not(feature = "0_21_2"), not(feature = "0_20_2"), not(feature = "0_19_1"), not(feature = "0_18_1"), not(feature = "0_17_1")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v28::{Client, AddressType}, types::v28 as types};
31 changes: 5 additions & 26 deletions node/src/versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,16 @@ pub const VERSION: &str = "26.0";
#[cfg(all(feature = "25_2", not(feature = "26_0")))]
pub const VERSION: &str = "25.2";

#[cfg(all(feature = "25_1", not(feature = "25_2")))]
pub const VERSION: &str = "25.1";

#[cfg(all(feature = "25_0", not(feature = "25_1")))]
pub const VERSION: &str = "25.0";

#[cfg(all(feature = "24_2", not(feature = "25_0")))]
#[cfg(all(feature = "24_2", not(feature = "25_2")))]
pub const VERSION: &str = "24.2";

#[cfg(all(feature = "24_1", not(feature = "24_2")))]
pub const VERSION: &str = "24.1";

#[cfg(all(feature = "24_0_1", not(feature = "24_1")))]
pub const VERSION: &str = "24.0.1";

#[cfg(all(feature = "23_2", not(feature = "24_0_1")))]
#[cfg(all(feature = "23_2", not(feature = "24_2")))]
pub const VERSION: &str = "23.2";

#[cfg(all(feature = "23_1", not(feature = "23_2")))]
pub const VERSION: &str = "23.1";

#[cfg(all(feature = "23_0", not(feature = "23_1")))]
pub const VERSION: &str = "23.0";

#[cfg(all(feature = "22_1", not(feature = "23_0")))]
#[cfg(all(feature = "22_1", not(feature = "23_2")))]
pub const VERSION: &str = "22.1";

#[cfg(all(feature = "22_0", not(feature = "22_1")))]
pub const VERSION: &str = "22.0";

#[cfg(all(feature = "0_21_2", not(feature = "22_0")))]
#[cfg(all(feature = "0_21_2", not(feature = "22_1")))]
pub const VERSION: &str = "0.21.2";

#[cfg(all(feature = "0_20_2", not(feature = "0_21_2")))]
Expand All @@ -68,6 +47,6 @@ pub const VERSION: &str = "0.18.1";
pub const VERSION: &str = "0.17.1";

// To make --no-default-features work we have to enable some feature, use most recent version same as for default.
#[cfg(all(not(feature = "28_0"), not(feature = "27_1"), not(feature = "27_0"), not(feature = "26_2"), not(feature = "26_1"), not(feature = "26_0"), not(feature = "25_2"), not(feature = "25_1"), not(feature = "25_0"), not(feature = "24_2"),not(feature = "24_1"), not(feature = "24_0_1"), not(feature = "23_2"), not(feature = "23_1"), not(feature = "23_0"), not(feature = "22_1"), not(feature = "22_0"), not(feature = "0_21_2"), not(feature = "0_20_2"), not(feature = "0_19_1"), not(feature = "0_18_1"), not(feature = "0_17_1")))]
#[cfg(all(not(feature = "28_0"), not(feature = "27_1"), not(feature = "27_0"), not(feature = "26_2"), not(feature = "26_1"), not(feature = "26_0"), not(feature = "25_2"), not(feature = "24_2"), not(feature = "23_2"), not(feature = "22_1"), not(feature = "0_21_2"), not(feature = "0_20_2"), not(feature = "0_19_1"), not(feature = "0_18_1"), not(feature = "0_17_1")))]
#[allow(dead_code)] // for --no-default-features
pub const VERSION: &str = "28.0";

0 comments on commit 93a3a99

Please sign in to comment.