Skip to content

Commit 20d6a04

Browse files
committed
Merge #35: Run verify in CI
b2d962c CI: Add a job that runs verify (Tobin C. Harding) 4b20b3e verify: Use clap and add version arg (Tobin C. Harding) 5d0be0e Exclude verify from workspace (Tobin C. Harding) Pull request description: The `verify` crate is a dev tool and should not have been included in the workspace because it has no lock file requirements. Exclude `verify` from the workspace and update the lock files and add a job that runs it from CI. ACKs for top commit: apoelstra: ACK b2d962c; successfully ran local tests; though "local tests" no longer include `verify` :) Tree-SHA512: 9e1c38856882eb9d6c3146d410940af3a1b7321045e548995efe82295fb732abf94c437748c9b24c124b7dcbfe19aace808d6fb94b50af467eb5df0d9ad262f0
2 parents dc11a47 + b2d962c commit 20d6a04

File tree

7 files changed

+55
-132
lines changed

7 files changed

+55
-132
lines changed

.github/workflows/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Run from `rust.yml` unless stated otherwise. Total 11 jobs.
2222
8. `Docs`
2323
9. `Docsrs`
2424
10. `Format`
25+
11. `Verify`
2526

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

.github/workflows/rust.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,20 @@ jobs:
188188
- name: "Check formatting"
189189
run: cargo fmt --all -- --check
190190

191+
Verify: # 1 job, run `verify` directly.
192+
name: Verify - stable toolchain
193+
runs-on: ubuntu-latest
194+
strategy:
195+
fail-fast: false
196+
steps:
197+
- name: "Checkout repo"
198+
uses: actions/checkout@v4
199+
- name: "Select toolchain"
200+
uses: dtolnay/rust-toolchain@stable
201+
- name: "Run the verify program"
202+
# Verify all versions (known to the verify program)
203+
run: cd verify && cargo run all
204+
191205
Integration: # 1 job for each bitcoind version we support.
192206
name: Integration tests - stable toolchain
193207
runs-on: ubuntu-latest

Cargo-minimal.lock

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,6 @@
22
# It is not intended for manual editing.
33
version = 3
44

5-
[[package]]
6-
name = "aho-corasick"
7-
version = "1.1.3"
8-
source = "registry+https://github.com/rust-lang/crates.io-index"
9-
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
10-
dependencies = [
11-
"memchr",
12-
]
13-
14-
[[package]]
15-
name = "anyhow"
16-
version = "1.0.94"
17-
source = "registry+https://github.com/rust-lang/crates.io-index"
18-
checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7"
19-
205
[[package]]
216
name = "arrayvec"
227
version = "0.7.4"
@@ -184,12 +169,6 @@ version = "0.4.18"
184169
source = "registry+https://github.com/rust-lang/crates.io-index"
185170
checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de"
186171

187-
[[package]]
188-
name = "memchr"
189-
version = "2.7.4"
190-
source = "registry+https://github.com/rust-lang/crates.io-index"
191-
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
192-
193172
[[package]]
194173
name = "minreq"
195174
version = "2.11.2"
@@ -219,35 +198,6 @@ dependencies = [
219198
"proc-macro2",
220199
]
221200

222-
[[package]]
223-
name = "regex"
224-
version = "1.11.1"
225-
source = "registry+https://github.com/rust-lang/crates.io-index"
226-
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
227-
dependencies = [
228-
"aho-corasick",
229-
"memchr",
230-
"regex-automata",
231-
"regex-syntax",
232-
]
233-
234-
[[package]]
235-
name = "regex-automata"
236-
version = "0.4.9"
237-
source = "registry+https://github.com/rust-lang/crates.io-index"
238-
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
239-
dependencies = [
240-
"aho-corasick",
241-
"memchr",
242-
"regex-syntax",
243-
]
244-
245-
[[package]]
246-
name = "regex-syntax"
247-
version = "0.8.5"
248-
source = "registry+https://github.com/rust-lang/crates.io-index"
249-
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
250-
251201
[[package]]
252202
name = "ryu"
253203
version = "1.0.18"
@@ -333,14 +283,6 @@ version = "1.0.8"
333283
source = "registry+https://github.com/rust-lang/crates.io-index"
334284
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
335285

336-
[[package]]
337-
name = "verify"
338-
version = "0.1.0"
339-
dependencies = [
340-
"anyhow",
341-
"regex",
342-
]
343-
344286
[[package]]
345287
name = "winapi"
346288
version = "0.3.9"

Cargo-recent.lock

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,6 @@
22
# It is not intended for manual editing.
33
version = 3
44

5-
[[package]]
6-
name = "aho-corasick"
7-
version = "1.1.3"
8-
source = "registry+https://github.com/rust-lang/crates.io-index"
9-
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
10-
dependencies = [
11-
"memchr",
12-
]
13-
14-
[[package]]
15-
name = "anyhow"
16-
version = "1.0.94"
17-
source = "registry+https://github.com/rust-lang/crates.io-index"
18-
checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7"
19-
205
[[package]]
216
name = "arrayvec"
227
version = "0.7.4"
@@ -184,12 +169,6 @@ version = "0.4.18"
184169
source = "registry+https://github.com/rust-lang/crates.io-index"
185170
checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de"
186171

187-
[[package]]
188-
name = "memchr"
189-
version = "2.7.4"
190-
source = "registry+https://github.com/rust-lang/crates.io-index"
191-
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
192-
193172
[[package]]
194173
name = "minreq"
195174
version = "2.11.2"
@@ -219,35 +198,6 @@ dependencies = [
219198
"proc-macro2",
220199
]
221200

222-
[[package]]
223-
name = "regex"
224-
version = "1.11.1"
225-
source = "registry+https://github.com/rust-lang/crates.io-index"
226-
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
227-
dependencies = [
228-
"aho-corasick",
229-
"memchr",
230-
"regex-automata",
231-
"regex-syntax",
232-
]
233-
234-
[[package]]
235-
name = "regex-automata"
236-
version = "0.4.9"
237-
source = "registry+https://github.com/rust-lang/crates.io-index"
238-
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
239-
dependencies = [
240-
"aho-corasick",
241-
"memchr",
242-
"regex-syntax",
243-
]
244-
245-
[[package]]
246-
name = "regex-syntax"
247-
version = "0.8.5"
248-
source = "registry+https://github.com/rust-lang/crates.io-index"
249-
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
250-
251201
[[package]]
252202
name = "ryu"
253203
version = "1.0.18"
@@ -333,14 +283,6 @@ version = "1.0.8"
333283
source = "registry+https://github.com/rust-lang/crates.io-index"
334284
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
335285

336-
[[package]]
337-
name = "verify"
338-
version = "0.1.0"
339-
dependencies = [
340-
"anyhow",
341-
"regex",
342-
]
343-
344286
[[package]]
345287
name = "winapi"
346288
version = "0.3.9"

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[workspace]
2-
members = ["client", "types", "jsonrpc", "verify"]
3-
exclude = ["integration_test", "node"]
2+
members = ["client", "types", "jsonrpc"]
3+
exclude = ["integration_test", "node", "verify"]
44
resolver = "2"
55

66
[patch.crates-io.corepc-client]

verify/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ edition = "2021"
55

66
[dependencies]
77
anyhow = "1.0.93"
8+
clap = { version = "4.5.23", features = ["cargo"] }
89
regex = "1"

verify/src/main.rs

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,59 @@
99
//! - That there is a `model` type if required.
1010
//! - That the method has an integration test.
1111
12-
use std::env;
12+
use std::process;
1313

1414
use anyhow::Result;
15+
use clap::{arg, Command};
1516
use verify::method::{Method, Return};
1617
use verify::versioned::{self, Status};
1718
use verify::{method, model, ssot, Version};
1819

19-
/// The default version of Core if no command line argument is provided.
20-
const DEFAULT_VERSION: Version = Version::V17;
20+
// TODO: Enable running from any directory, currently errors if run from `src/`.
21+
// TODO: Add a --quiet option.
2122

22-
// FIXME: Enable running from any directory, currently errors if run from `src/`.
23+
const VERSIONS: [Version; 2] = [Version::V17, Version::V18];
2324

2425
fn main() -> Result<()> {
25-
let args: Vec<String> = env::args().collect();
26-
27-
let version = if args.len() < 2 {
28-
DEFAULT_VERSION
26+
let cmd = Command::new("verify")
27+
.args([
28+
arg!([version] "Verify specific version of Core (use \"all\" for all versions)").required(true),
29+
]);
30+
31+
let matches = cmd.clone().get_matches();
32+
let version = matches.get_one::<String>("version").unwrap();
33+
34+
if version == "all" {
35+
verify_all_versions()?;
36+
} else if let Ok(v) = version.parse::<Version>() {
37+
verify_version(v)?;
2938
} else {
30-
let v = &args[1];
31-
v.parse::<Version>()?
32-
};
33-
println!("\nVerifying support for Bitcoin Core {}\n", version);
39+
eprint!("Unrecognised version: {} (supported versions:", version);
40+
for version in VERSIONS {
41+
eprint!(" {}", version);
42+
}
43+
eprintln!(")");
44+
process::exit(1);
45+
}
46+
Ok(())
47+
}
48+
49+
fn verify_all_versions() -> Result<()> {
50+
for version in VERSIONS {
51+
println!("Verifying for Bitcoin Core version {} ...\n", version);
52+
verify_version(version)?;
53+
}
54+
Ok(())
55+
}
3456

57+
fn verify_version(version: Version) -> Result<()> {
3558
let s = format!("{}::METHOD data", version);
3659
let msg = format!("Checking that the {} list is correct", s);
3760
check(&msg);
3861
let correct = verify_correct_methods(version, method::all_methods(version), &s)?;
3962
close(correct);
4063
if !correct {
41-
std::process::exit(1);
64+
process::exit(1);
4265
}
4366

4467
let s = "rustdoc version specific rustdocs";
@@ -47,7 +70,7 @@ fn main() -> Result<()> {
4770
let correct = verify_correct_methods(version, method::all_methods(version), s)?;
4871
close(correct);
4972
if !correct {
50-
std::process::exit(1);
73+
process::exit(1);
5174
}
5275

5376
let msg = "Checking that the status claimed in the version specific rustdocs is correct";

0 commit comments

Comments
 (0)