Add maintainer-tools support to the justfile
What changed, and why it matters
This commit is a routine developer-experience improvement. It moves the version of an internal helper repository (maintainer-tools) into a plain text file so both CI and the local justfile use the same version. It adds local recipes to run the same checks that run in CI. There is no change to the actual Bitcoin library code, no bug fix, and no security-related content.
No security action needed. Reviewers may optionally verify that ensure-maintainer-tools.sh pins the expected ref and that the justfile recipes correctly pass through the toolchain and lock arguments.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors CI and local tooling coordination. It introduces maintainer-tools-version as the single source of truth for the rust-bitcoin-maintainer-tools ref, updates .github/workflows/rust.yml to read that ref dynamically, adds contrib/ensure-maintainer-tools.sh to clone/update the tools locally, and extends the justfile with ci/test-stable/test-nightly/test-msrv/lint/docs/docsrs/bench recipes. Existing lint/docsrs recipes are replaced by calls into the shared maintainer-tools script. No cryptographic, consensus, parsing, or network code is modified.
Changed components
.github/workflows/rust.ymljustfilecontrib/ensure-maintainer-tools.shmaintainer-tools-version.gitignoreInspect captured patch +79 / −22
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index 5cf109a7..7323aed0 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -13,15 +13,19 @@ jobs:
runs-on: ubuntu-24.04
outputs:
nightly_version: ${{ steps.read_toolchain.outputs.nightly_version }}
+ maintainer_tools_version: ${{ steps.read_toolchain.outputs.maintainer_tools_version }}
steps:
- name: "Checkout repo"
uses: actions/checkout@v5
- - name: "Read nightly version"
+ - name: "Read workspace versions"
id: read_toolchain
- run: echo "nightly_version=$(cat nightly-version)" >> $GITHUB_OUTPUT
+ run: |
+ echo "nightly_version=$(cat nightly-version)" >> $GITHUB_OUTPUT
+ echo "maintainer_tools_version=$(cat maintainer-tools-version)" >> $GITHUB_OUTPUT
Stable: # 2 jobs, one per manifest.
name: Test - stable toolchain
+ needs: Prepare
runs-on: ubuntu-24.04
strategy:
fail-fast: false
@@ -34,7 +38,7 @@ jobs:
uses: actions/checkout@v5
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
- ref: 22eff1e5c114949d4b88a24735da38b37e7984fb
+ ref: ${{ needs.Prepare.outputs.maintainer_tools_version }}
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
@@ -58,7 +62,7 @@ jobs:
uses: actions/checkout@v5
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
- ref: 22eff1e5c114949d4b88a24735da38b37e7984fb
+ ref: ${{ needs.Prepare.outputs.maintainer_tools_version }}
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@v1
@@ -71,6 +75,7 @@ jobs:
MSRV: # 2 jobs, one per manifest.
name: Test - MSRV toolchain
+ needs: Prepare
runs-on: ubuntu-24.04
strategy:
fail-fast: false
@@ -83,7 +88,7 @@ jobs:
uses: actions/checkout@v5
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
- ref: 22eff1e5c114949d4b88a24735da38b37e7984fb
+ ref: ${{ needs.Prepare.outputs.maintainer_tools_version }}
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
@@ -109,7 +114,7 @@ jobs:
uses: actions/checkout@v5
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
- ref: 22eff1e5c114949d4b88a24735da38b37e7984fb
+ ref: ${{ needs.Prepare.outputs.maintainer_tools_version }}
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@v1
@@ -124,6 +129,7 @@ jobs:
Docs:
name: Docs - stable toolchain
+ needs: Prepare
runs-on: ubuntu-24.04
strategy:
fail-fast: false
@@ -136,7 +142,7 @@ jobs:
uses: actions/checkout@v5
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
- ref: 22eff1e5c114949d4b88a24735da38b37e7984fb
+ ref: ${{ needs.Prepare.outputs.maintainer_tools_version }}
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
@@ -160,7 +166,7 @@ jobs:
uses: actions/checkout@v5
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
- ref: 22eff1e5c114949d4b88a24735da38b37e7984fb
+ ref: ${{ needs.Prepare.outputs.maintainer_tools_version }}
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@v1
@@ -186,7 +192,7 @@ jobs:
uses: actions/checkout@v5
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
- ref: 22eff1e5c114949d4b88a24735da38b37e7984fb
+ ref: ${{ needs.Prepare.outputs.maintainer_tools_version }}
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@v1
@@ -335,8 +341,6 @@ jobs:
steps:
- name: "Checkout repo"
uses: actions/checkout@v5
- - name: "Checkout maintainer tools"
- uses: actions/checkout@v5
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
- name: "Run policy script"
diff --git a/.gitignore b/.gitignore
index 48c9cedc..ab54b690 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,6 @@ mutants.out*
# Fuzz artifacts
hfuzz_target
hfuzz_workspace
+
+# Local tooling
+.maintainer-tools
diff --git a/contrib/ensure-maintainer-tools.sh b/contrib/ensure-maintainer-tools.sh
new file mode 100755
index 00000000..fdb14552
--- /dev/null
+++ b/contrib/ensure-maintainer-tools.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+#
+# Ensure maintainer tools are available locally for CI task execution.
+
+set -euo pipefail
+
+REPO_DIR=$(git rev-parse --show-toplevel)
+MAINTAINER_TOOLS_REF=$(cat "$REPO_DIR/maintainer-tools-version")
+
+cd "$REPO_DIR"
+
+if [ ! -d ".maintainer-tools" ]; then
+ echo "Fetching maintainer tools..."
+ git clone "https://github.com/rust-bitcoin/rust-bitcoin-maintainer-tools.git" ".maintainer-tools"
+ cd ".maintainer-tools"
+ git checkout "$MAINTAINER_TOOLS_REF"
+else
+ cd ".maintainer-tools"
+ CURRENT_REF=$(git rev-parse HEAD)
+ if [ "$CURRENT_REF" != "$MAINTAINER_TOOLS_REF" ]; then
+ echo "Updating maintainer tools to $MAINTAINER_TOOLS_REF"
+ git fetch
+ git checkout "$MAINTAINER_TOOLS_REF"
+ fi
+fi
+
+if ! command -v jq >/dev/null 2>&1; then
+ echo "Error: jq is required for maintainer tools but not found in PATH" >&2
+ echo "Please install jq or ensure it's available in your environment" >&2
+ exit 1
+fi
diff --git a/justfile b/justfile
index 5c10344d..61833347 100644
--- a/justfile
+++ b/justfile
@@ -1,10 +1,39 @@
set positional-arguments
+NIGHTLY_VERSION := `cat nightly-version`
+
alias ulf := update-lock-files
default:
@just --list
+# Run the given CI task using maintainer tools.
+@ci task toolchain="stable" lock="recent":
+ {{justfile_directory()}}/contrib/ensure-maintainer-tools.sh
+ cp -f {{justfile_directory()}}/Cargo-{{lock}}.lock {{justfile_directory()}}/Cargo.lock
+ rustup run {{toolchain}} {{justfile_directory()}}/.maintainer-tools/ci/run_task.sh {{task}}
+
+# Test with stable toolchain.
+test-stable: (ci "stable")
+
+# Test with nightly toolchain.
+test-nightly: (ci "nightly")
+
+# Test with MSRV toolchain.
+test-msrv: (ci "msrv")
+
+# Lint workspace.
+lint: (ci "lint" NIGHTLY_VERSION)
+
+# Generate documentation.
+docs: (ci "docs")
+
+# Generate documentation with nightly.
+docsrs: (ci "docsrs" NIGHTLY_VERSION)
+
+# Run benchmarks.
+bench: (ci "bench")
+
# Cargo build everything.
build:
cargo build --workspace --all-targets --all-features
@@ -13,12 +42,6 @@ build:
check:
cargo check --workspace --all-targets --all-features
-# Lint everything.
-lint:
- cargo +$(cat ./nightly-version) clippy --workspace --all-targets --all-features -- --deny warnings
- # lint warnings get inhibited unless we use `--nocapture`
- cargo test --quiet --workspace --doc -- --nocapture
-
# Run cargo fmt
fmt:
cargo +$(cat ./nightly-version) fmt --all
@@ -27,10 +50,6 @@ fmt:
format:
cargo +$(cat ./nightly-version) fmt --all --check
-# Generate documentation.
-docsrs *flags:
- RUSTDOCFLAGS="--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" cargo +$(cat ./nightly-version) doc --all-features {{flags}}
-
# Quick and dirty CI useful for pre-push checks.
sane: lint
cargo test --quiet --workspace --all-targets --no-default-features > /dev/null || exit 1
@@ -67,4 +86,3 @@ gen-dep-tree:
-p bitcoin -p bitcoin-internals -p bitcoin_hashes@0.16.0 -p bitcoin-units \
-p bitcoin-primitives -p chacha20-poly1305 -p base58ck -p bitcoin-addresses -p bitcoin-io@0.2.0 \
-p bitcoin-consensus-encoding
-
\ No newline at end of file
diff --git a/maintainer-tools-version b/maintainer-tools-version
new file mode 100644
index 00000000..866abbff
--- /dev/null
+++ b/maintainer-tools-version
@@ -0,0 +1 @@
+22eff1e5c114949d4b88a24735da38b37e7984fb
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.