Skip to content

Commit 6016d5a

Browse files
committed
feat(ci): use cargo-rbmt for CI and local testing
Introduce `cargo-rbmt` for all things cargo, such as linting, formatting and testing. The `rbmt-version` file defines what version is used. The `Cargo.toml` manifest is updated with `cargo-rbmt` specific fields, defining: - Stable and MSRV toolchains - Necessary pins for MSRV (all of them due to `corepc`, once they use `cargo-rbmt` there these can be removed). Fix incorrect MSRV on `Cargo.toml`: from 1.75.0 to 1.85.0 Update the `justfile` to use `cargo-rbmt` for recipes, and updates CI jobs to use the recipes defined in the `justfile` (which use `cargo-rbmt` under the hood). This simplifies configuration by centralizing it in the `justfile`. Update `.gitignore` to exclude `Cargo.lock`. Add a `sigs.yml` CI job that asserts all commits in the branch are signed (no-op on `master`). This job runs `just check-sigs` under the hood.
1 parent f5fce39 commit 6016d5a

9 files changed

Lines changed: 152 additions & 134 deletions

File tree

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ of the PR were done in a specific way -->
1919
#### All Submissions:
2020

2121
* [ ] I've signed all my commits
22+
* [ ] I ran `just pre-push` before committing
2223
* [ ] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
23-
* [ ] I ran `cargo fmt` and `cargo clippy` before committing
2424

2525
#### New Features:
2626

.github/workflows/audit.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ on:
1212
schedule:
1313
- cron: '0 0 * * 0' # At 00:00 on Sunday
1414
workflow_dispatch:
15-
15+
permissions: {}
1616
env:
1717
CARGO_TERM_COLOR: always
1818

19-
permissions: {}
20-
2119
jobs:
2220
cargo-audit:
2321
name: RustSec Audit (vulnerabilities)
@@ -42,7 +40,7 @@ jobs:
4240
- name: Install cargo-audit
4341
run: cargo install cargo-audit --locked
4442

45-
- name: Run cargo audit
43+
- name: Run cargo audit
4644
run: cargo audit --deny warnings
4745

4846
- name: Upload SARIF to GitHub Security tab
Lines changed: 25 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,51 @@
1-
on: [push, pull_request]
2-
31
name: CI
42

3+
on: [push, pull_request]
54
permissions: {}
6-
75
env:
86
CARGO_TERM_COLOR: always
97
RUST_BACKTRACE: 1
108

119
jobs:
12-
fmt:
13-
name: Rust fmt
10+
check:
11+
name: Check
1412
runs-on: ubuntu-latest
1513
steps:
16-
- name: Checkout
17-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
14+
- name: Checkout repository
15+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1816
with:
1917
persist-credentials: false
20-
- name: Install Rust toolchain
21-
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
22-
with:
23-
toolchain: stable
24-
components: rustfmt
25-
cache: true
2618

27-
- name: Check fmt
28-
run: cargo fmt --all -- --check
19+
- name: Install just
20+
uses: extractions/setup-just@f8a3cce218d9f83db3a2ecd90e41ac3de6cdfd9b # v3
2921

30-
# Clippy lints
31-
clippy:
32-
name: Clippy (${{ matrix.features }})
33-
runs-on: ubuntu-latest
34-
strategy:
35-
matrix:
36-
features:
37-
- --no-default-features
38-
- --all-features
39-
steps:
40-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
41-
with:
42-
persist-credentials: false
43-
- name: Install Rust toolchain
44-
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
45-
with:
46-
toolchain: stable
47-
components: clippy
48-
cache: true
22+
- name: Setup cargo-rbmt
23+
uses: rust-bitcoin/rust-bitcoin-maintainer-tools/.github/actions/setup-rbmt@6560b728ae6a81af9d92713b630ba26772fbd970
4924

50-
- name: Run Clippy
51-
run: cargo clippy ${{ matrix.features }} --all-targets -- -D warnings
25+
- name: Check check
26+
run: just check
5227

53-
# Build and test
5428
test:
55-
name: Test (stable, ${{ matrix.features }})
29+
name: Test - ${{ matrix.toolchain }} toolchain, ${{ matrix.lockfile }} deps
5630
runs-on: ubuntu-latest
5731
strategy:
5832
fail-fast: false
5933
matrix:
60-
features:
61-
- --no-default-features
62-
- --all-features
63-
steps:
64-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
65-
with:
66-
persist-credentials: false
67-
- name: Install Rust toolchain
68-
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
69-
with:
70-
toolchain: stable
71-
cache: true
72-
73-
- name: Build
74-
run: cargo build ${{ matrix.features }} --verbose
75-
76-
- name: Run unit tests
77-
run: cargo test ${{ matrix.features }} --lib --verbose
34+
toolchain: [stable, msrv]
35+
lockfile: [minimal, recent]
36+
exclude:
37+
# Exclude MSRV toolchain + `Cargo-recent.lock`
38+
- toolchain: msrv
39+
lockfile: recent
7840

79-
- name: Run doc tests
80-
run: cargo test ${{ matrix.features }} --doc --verbose
81-
82-
- name: Run RPC client tests
83-
run: cargo test --test test_rpc_client --verbose -- --test-threads=2
84-
85-
# MSRV
86-
msrv:
87-
name: MSRV
88-
runs-on: ubuntu-latest
8941
steps:
90-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
42+
- name: Checkout repository
43+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
9144
with:
9245
persist-credentials: false
93-
- name: Install Rust toolchain
94-
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
95-
with:
96-
toolchain: 1.75.0
97-
cache: true
9846

99-
- name: Check MSRV
100-
run: cargo check --all-features
47+
- name: Setup cargo-rbmt
48+
uses: rust-bitcoin/rust-bitcoin-maintainer-tools/.github/actions/setup-rbmt@6560b728ae6a81af9d92713b630ba26772fbd970
49+
50+
- name: Run tests
51+
run: cargo rbmt test --toolchain ${{ matrix.toolchain }} --lock-file ${{ matrix.lockfile }}

.github/workflows/sigs.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Signed Commits
2+
on: [push, pull_request]
3+
permissions: {}
4+
env:
5+
CARGO_TERM_COLOR: always
6+
7+
jobs:
8+
Signatures:
9+
name: Assert all commits are signed
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
14+
with:
15+
persist-credentials: false
16+
fetch-depth: 0
17+
18+
- name: Setup just
19+
uses: extractions/setup-just@f8a3cce218d9f83db3a2ecd90e41ac3de6cdfd9b # v3
20+
21+
- name: Check commit signatures
22+
run: just check-sigs

.github/workflows/zizmor.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: GitHub Actions Security Analysis with zizmor
1+
name: Zizmor GitHub Action Static Analysis
22

33
on:
44
pull_request:
@@ -8,8 +8,9 @@ on:
88
schedule:
99
- cron: '0 0 * * 0' # At 00:00 on Sunday
1010
workflow_dispatch:
11-
1211
permissions: {}
12+
env:
13+
CARGO_TERM_COLOR: always
1314

1415
jobs:
1516
zizmor:
@@ -22,7 +23,7 @@ jobs:
2223

2324
steps:
2425
- name: Checkout repository
25-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
26+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2627
with:
2728
persist-credentials: false
2829

.gitignore

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
1-
# Generated by Cargo
2-
# will have compiled files and executables
3-
debug
4-
target
5-
6-
# These are backup files generated by rustfmt
1+
Cargo.lock
2+
/target
73
**/*.rs.bk
8-
9-
# MSVC Windows builds of rustc generate these, which store debugging information
104
*.pdb
11-
12-
# Generated by cargo mutants
13-
# Contains mutation testing data
145
**/mutants.out*/
15-
16-
# RustRover
17-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
18-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
19-
# and can be added to the global gitignore or merged into this file. For a more nuclear
20-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
21-
#.idea/
22-
23-
24-
# Added by cargo
25-
26-
/target

Cargo.toml

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,46 @@
11
[package]
2-
name = "bdk-bitcoind-client"
32
version = "0.1.0"
4-
edition = "2021"
5-
rust-version = "1.75.0"
6-
homepage = "https://bitcoindevkit.org"
3+
name = "bdk-bitcoind-client"
4+
description = "A minimal `bitcoind` RPC client custom built for BDK"
5+
authors = ["Bitcoin Dev Kit Developers"]
76
repository = "https://github.com/bitcoindevkit/bdk-bitcoind-client"
87
documentation = "https://docs.rs/bdk-bitcoind-client"
9-
description = "A minimal production-ready bitcoind RPC client for Bitcoin Dev Kit."
8+
homepage = "https://bitcoindevkit.org"
109
license = "MIT OR Apache-2.0"
11-
authors = ["Bitcoin Dev Kit Developers"]
1210
readme = "README.md"
13-
14-
[dependencies]
15-
corepc-types = { version = "0.11.0", features = ["default"]}
16-
jsonrpc = { version = "0.19.0", features = ["simple_http", "simple_tcp", "bitreq_http", "simple_uds", "proxy"] }
11+
edition = "2024"
12+
rust-version = "1.85.0"
1713

1814
[features]
1915
default = ["30_0"]
2016
30_0 = []
2117
29_0 = []
2218
28_0 = []
2319

20+
[dependencies]
21+
corepc-types = { version = "0.11.0", features = ["default"]}
22+
jsonrpc = { version = "0.19.0", features = ["simple_http", "simple_tcp", "bitreq_http", "simple_uds", "proxy"] }
23+
24+
# These pins are needed for `Cargo-minimal.lock`:
25+
hex-conservative = { version = "0.2.1" } # blame: corepc-node
26+
tar = { version = "0.4.43" } # blame: corepc-node
27+
filetime = { version = "0.2.8" } # blame: corepc-node
28+
log = { version = "0.4.14" } # blame: corepc-node
29+
2430
[dev-dependencies]
25-
anyhow = "1"
31+
anyhow = { version = "1.0.66" }
2632
corepc-node = { version = "0.10.1", features = ["download", "29_0"] }
33+
34+
[package.metadata.rbmt.toolchains]
35+
stable = "1.94.1"
36+
nightly = "nightly-2026-03-18"
37+
38+
[package.metadata.rbmt.test]
39+
exclude_features = ["default", "30_0", "29_0", "28_0"]
40+
41+
# Allow multiple versions of the same package in the dependency tree.
42+
[package.metadata.rbmt.lint]
43+
allowed_duplicates = [
44+
"base64",
45+
"corepc"
46+
]

justfile

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,78 @@
11
alias b := build
22
alias c := check
3+
alias cf := check-features
4+
alias cs := check-sigs
5+
alias d := doc
6+
alias do := doc-open
37
alias f := fmt
4-
alias t := test
8+
alias l := lock
9+
alias m := msrv
510
alias p := pre-push
11+
alias t := test
12+
alias tv := test-version
613

714
_default:
8-
@just --list
15+
@echo "> bdk-bitcoind-client"
16+
@echo "> An experimental \`bitcoind\` RPC client for BDK"
17+
@echo ""
18+
@just --list
919

10-
# Build the project
20+
[doc: "Build the `bdk-bitcoind-client`"]
1121
build:
12-
cargo build
22+
cargo build
1323

14-
# Check code: formatting, compilation, linting, and commit signature
24+
[doc: "Check code formatting, compilation, and linting"]
1525
check:
16-
cargo +nightly fmt --all -- --check
17-
cargo check --all-features --all-targets
18-
cargo clippy --all-features --all-targets -- -D warnings
19-
@[ "$(git log --pretty='format:%G?' -1 HEAD)" = "N" ] && \
20-
echo "\n⚠️ Unsigned commit: BDK requires that commits be signed." || \
21-
true
22-
23-
# Format all code
26+
cargo rbmt fmt --check
27+
cargo rbmt lint
28+
cargo rbmt docs
29+
30+
[doc: "Check that all feature combinations compile"]
31+
check-features:
32+
cargo rbmt test --toolchain stable --lock-file recent
33+
34+
[doc: "Checks whether all commits in this branch are PGP-signed"]
35+
check-sigs:
36+
#!/usr/bin/env bash
37+
TOTAL=$(git log --pretty='tformat:%H' origin/master..HEAD | wc -l | tr -d ' ')
38+
UNSIGNED=$(git log --pretty='tformat:%H %G?' origin/master..HEAD | grep " N$" | wc -l | tr -d ' ')
39+
if [ "$UNSIGNED" -gt 0 ]; then
40+
echo "⚠️ Unsigned commits in this branch [$UNSIGNED/$TOTAL]"
41+
exit 1
42+
else
43+
echo "🔏 All commits in this branch are signed [$TOTAL/$TOTAL]"
44+
fi
45+
46+
[doc: "Generate documentation"]
47+
doc:
48+
cargo rbmt docs
49+
cargo doc --no-deps
50+
51+
[doc: "Generate and open documetation"]
52+
doc-open:
53+
cargo rbmt docs
54+
cargo doc --no-deps --open
55+
56+
[doc: "Format code"]
2457
fmt:
25-
cargo +nightly fmt
58+
cargo rbmt fmt
59+
60+
[doc: "Regenerate `Cargo-recent.lock` and `Cargo-minimal.lock`"]
61+
lock:
62+
cargo +nightly rbmt lock
2663

27-
# Run all tests on the workspace with all features
64+
[doc: "Verify the library builds with the MSRV toolchain (1.85.0)"]
65+
msrv:
66+
cargo rbmt test --toolchain msrv --lock-file minimal
67+
68+
[doc: "Run all tests on the workspace with all features"]
2869
test:
29-
cargo test --all-features
70+
cargo rbmt test --toolchain stable --lock-file recent
71+
72+
# TODO: update this when https://github.com/rust-bitcoin/rust-bitcoin-maintainer-tools/issues/113 is fixed
73+
[doc: "Run tests against a specific Bitcoin Core version: 30_0, 29_0, 28_0"]
74+
test-version VERSION:
75+
cargo test --no-default-features --features {{VERSION}}
3076

31-
# Run pre-push suite: format, check, and test
32-
pre-push: fmt check test
77+
[doc: "Run pre-push suite: lock, check-sigs, fmt, check, test, and msrv"]
78+
pre-push: lock check-sigs fmt check test msrv

rbmt-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6560b728ae6a81af9d92713b630ba26772fbd970

0 commit comments

Comments
 (0)