diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml index 51da4c594..b26ef5451 100644 --- a/.github/workflows/rust.yaml +++ b/.github/workflows/rust.yaml @@ -9,93 +9,30 @@ on: # yamllint disable-line rule:truthy name: Continuous integration jobs: - Prepare: - runs-on: ubuntu-slim - outputs: - nightly_version: ${{ steps.read_toolchain.outputs.nightly_version }} - steps: - - name: "Checkout repo" - uses: actions/checkout@v4 - - name: "Read nightly version" - id: read_toolchain - run: echo "nightly_version=$(cat nightly-version)" >> $GITHUB_OUTPUT - - Stable: # 2 jobs, one per lock file. - name: Test - stable toolchain + Test: # 6 jobs: 3 toolchains × 2 lock files. + name: Test - ${{ matrix.toolchain }} toolchain (${{ matrix.dep }}) runs-on: ubuntu-latest strategy: fail-fast: false matrix: dep: [minimal, recent] + toolchain: [stable, nightly, msrv] steps: - name: "Checkout repo" uses: actions/checkout@v4 - - name: "Checkout maintainer tools" - uses: actions/checkout@v4 - with: - repository: rust-bitcoin/rust-bitcoin-maintainer-tools - ref: c3324024ced9bb1eb854397686919c3ff7d97e1e - path: maintainer-tools - - name: "Select toolchain" - uses: dtolnay/rust-toolchain@stable - - name: "Set dependencies" - run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock - - name: "Run test script" - run: ./maintainer-tools/ci/run_task.sh stable - - Nightly: # 2 jobs, one per lock file. - name: Test - nightly toolchain - needs: Prepare - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - dep: [minimal, recent] - steps: - - name: "Checkout repo" - uses: actions/checkout@v4 - - name: "Checkout maintainer tools" - uses: actions/checkout@v4 - with: - repository: rust-bitcoin/rust-bitcoin-maintainer-tools - ref: c3324024ced9bb1eb854397686919c3ff7d97e1e - path: maintainer-tools - - name: "Select toolchain" - uses: dtolnay/rust-toolchain@v1 - with: - toolchain: ${{ needs.Prepare.outputs.nightly_version }} - - name: "Set dependencies" - run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock - - name: "Run test script" - run: ./maintainer-tools/ci/run_task.sh nightly - - MSRV: # 2 jobs, one per lock file. - name: Test - 1.75.0 toolchain - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - dep: [minimal, recent] - steps: - - name: "Checkout repo" - uses: actions/checkout@v4 - - name: "Checkout maintainer tools" - uses: actions/checkout@v4 - with: - repository: rust-bitcoin/rust-bitcoin-maintainer-tools - path: maintainer-tools - - name: "Select toolchain" - uses: dtolnay/rust-toolchain@stable - with: - toolchain: "1.75.0" - - name: "Set dependencies" - run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock - - name: "Run test script" - run: ./maintainer-tools/ci/run_task.sh msrv + - uses: Swatinem/rust-cache@v2 + - uses: rust-bitcoin/rust-bitcoin-maintainer-tools/.github/actions/setup-rbmt@6560b728ae6a81af9d92713b630ba26772fbd970 # v0.1.0 + - name: "Run ${{ matrix.toolchain }} tests" + run: | + cargo rbmt --lock-file ${{ matrix.dep }} test --toolchain ${{ matrix.toolchain }} \ + -p bitreq \ + -p corepc-client \ + -p jsonrpc-fuzz \ + -p jsonrpc \ + -p corepc-types Lint: name: Lint - nightly toolchain - needs: Prepare runs-on: ubuntu-latest env: BITCOIND_SKIP_DOWNLOAD: "1" @@ -106,24 +43,17 @@ jobs: steps: - name: "Checkout repo" uses: actions/checkout@v4 - - name: "Checkout maintainer tools" - uses: actions/checkout@v4 - with: - repository: rust-bitcoin/rust-bitcoin-maintainer-tools - ref: c3324024ced9bb1eb854397686919c3ff7d97e1e - path: maintainer-tools - - name: "Select toolchain" - uses: dtolnay/rust-toolchain@v1 - with: - toolchain: ${{ needs.Prepare.outputs.nightly_version }} - - name: "Install clippy" - run: rustup component add clippy - - name: "Set dependencies" - run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock - - name: "Run test script" + - uses: Swatinem/rust-cache@v2 + - uses: rust-bitcoin/rust-bitcoin-maintainer-tools/.github/actions/setup-rbmt@6560b728ae6a81af9d92713b630ba26772fbd970 # v0.1.0 + - name: "Run lints" run: | - ./maintainer-tools/ci/run_task.sh lint - ./contrib/lint-integtation-tests.sh + cargo rbmt --lock-file ${{ matrix.dep }} lint \ + -p bitreq \ + -p corepc-client \ + -p jsonrpc-fuzz \ + -p jsonrpc \ + -p corepc-types + ./contrib/lint-integration-tests.sh ./contrib/lint-verify.sh Docs: @@ -138,22 +68,13 @@ jobs: steps: - name: "Checkout repo" uses: actions/checkout@v4 - - name: "Checkout maintainer tools" - uses: actions/checkout@v4 - with: - repository: rust-bitcoin/rust-bitcoin-maintainer-tools - ref: c3324024ced9bb1eb854397686919c3ff7d97e1e - path: maintainer-tools - - name: "Select toolchain" - uses: dtolnay/rust-toolchain@stable - - name: "Set dependencies" - run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock - - name: "Run test script" - run: ./maintainer-tools/ci/run_task.sh docs + - uses: Swatinem/rust-cache@v2 + - uses: rust-bitcoin/rust-bitcoin-maintainer-tools/.github/actions/setup-rbmt@6560b728ae6a81af9d92713b630ba26772fbd970 # v0.1.0 + - name: "Run doc tests" + run: cargo rbmt --lock-file ${{ matrix.dep }} docs Docsrs: name: Docs - nightly toolchain - needs: Prepare runs-on: ubuntu-latest env: BITCOIND_SKIP_DOWNLOAD: "1" @@ -164,43 +85,26 @@ jobs: steps: - name: "Checkout repo" uses: actions/checkout@v4 - - name: "Checkout maintainer tools" - uses: actions/checkout@v4 - with: - repository: rust-bitcoin/rust-bitcoin-maintainer-tools - ref: c3324024ced9bb1eb854397686919c3ff7d97e1e - path: maintainer-tools - - name: "Select toolchain" - uses: dtolnay/rust-toolchain@v1 - with: - toolchain: ${{ needs.Prepare.outputs.nightly_version }} - - name: "Set dependencies" - run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock - - name: "Run test script" - run: ./maintainer-tools/ci/run_task.sh docsrs + - uses: Swatinem/rust-cache@v2 + - uses: rust-bitcoin/rust-bitcoin-maintainer-tools/.github/actions/setup-rbmt@6560b728ae6a81af9d92713b630ba26772fbd970 # v0.1.0 + - name: "Run docsrs tests" + run: cargo rbmt --lock-file ${{ matrix.dep }} docsrs Format: # 1 job, run cargo fmt directly. name: Format - nightly toolchain - needs: Prepare runs-on: ubuntu-latest strategy: fail-fast: false steps: - name: "Checkout repo" uses: actions/checkout@v4 - - name: "Select toolchain" - uses: dtolnay/rust-toolchain@v1 - with: - toolchain: ${{ needs.Prepare.outputs.nightly_version }} - - name: "Install rustfmt" - run: rustup component add rustfmt + - uses: rust-bitcoin/rust-bitcoin-maintainer-tools/.github/actions/setup-rbmt@6560b728ae6a81af9d92713b630ba26772fbd970 # v0.1.0 - name: "Check formatting" run: | - cargo fmt --all -- --check + cargo rbmt fmt --check ./contrib/fmt-integration-tests.sh ./contrib/fmt-verify.sh - Verify: # 1 job, run `verify` directly. name: Verify - stable toolchain runs-on: ubuntu-latest @@ -247,8 +151,8 @@ jobs: steps: - name: "Checkout repo" uses: actions/checkout@v4 - - name: "Select toolchain" - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - uses: rust-bitcoin/rust-bitcoin-maintainer-tools/.github/actions/setup-rbmt@6560b728ae6a81af9d92713b630ba26772fbd970 # v0.1.0 - name: "Cache downloaded bitcoind" uses: actions/cache@v4 with: diff --git a/Cargo.toml b/Cargo.toml index d3231233c..7400e46a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ members = [ "bitreq", "client", "fuzz", "jsonrpc", "node", "types"] exclude = ["integration_test", "verify"] resolver = "2" +rust-version = "1.75.0" [patch.crates-io.corepc-client] path = "client" @@ -14,3 +15,31 @@ path = "node" [patch.crates-io.corepc-types] path = "types" + +[workspace.metadata.rbmt.toolchains] +nightly = "nightly-2025-09-12" +stable = "1.94.1" + +[workspace.metadata.rbmt.integration] +package = "integration-test" +versions = [ + "30_2", + "30_0", + "29_0", + "28_2", + "28_1", + "28_0", + "27_2", + "27_1", + "27_0", + "26_2", + "25_2", + "24_2", + "23_2", + "22_1", + "0_21_2", + "0_20_2", + "0_19_1", + "0_18_1", + "0_17_2", +] diff --git a/bitreq/Cargo.toml b/bitreq/Cargo.toml index 5f7dc5555..c6dbe1c30 100644 --- a/bitreq/Cargo.toml +++ b/bitreq/Cargo.toml @@ -45,6 +45,10 @@ url = { version = "2.4" } [package.metadata.docs.rs] all-features = true +[package.metadata.rbmt.lint] +# Unavoidable TLS/crypto dep-graph version conflicts. +allowed_duplicates = ["base64", "windows-sys"] + [features] default = ["std"] std = [] diff --git a/bitreq/src/url.rs b/bitreq/src/url.rs index 6ba589b57..9d9603136 100644 --- a/bitreq/src/url.rs +++ b/bitreq/src/url.rs @@ -383,6 +383,7 @@ impl Url { pub fn as_str(&self) -> &str { &self.serialization } /// Returns `true` if the URL scheme is "https" or "wss". + #[cfg(feature = "std")] pub(crate) fn is_https(&self) -> bool { matches!(self.scheme(), "https" | "wss") } /// Returns `true` if a non-default port was explicitly specified in the URL. @@ -401,6 +402,7 @@ impl Url { /// /// The returned string includes the leading `/` (if present) and the `?` /// separator (if there's a query string). Returns "/" if the path is empty. + #[cfg(feature = "std")] pub(crate) fn path_and_query(&self) -> String { let path = self.path(); let path = if path.is_empty() { "/" } else { path }; diff --git a/client/Cargo.toml b/client/Cargo.toml index b7c13e367..b1d9adecb 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -16,6 +16,10 @@ exclude = ["tests", "contrib"] all-features = true rustdoc-args = ["--cfg", "docsrs"] +[package.metadata.rbmt.lint] +# `base64`: bitcoin (via corepc-types) uses v0.21 while jsonrpc uses v0.22. +allowed_duplicates = ["base64"] + [features] # Enable this feature to get a blocking JSON-RPC client. client-sync = ["jsonrpc"] diff --git a/clippy.toml b/clippy.toml index 4dc6505ee..85355417c 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,2 +1 @@ -msrv = "1.75.0" too-many-arguments-threshold = 13 diff --git a/contrib/lint-integtation-tests.sh b/contrib/lint-integration-tests.sh similarity index 100% rename from contrib/lint-integtation-tests.sh rename to contrib/lint-integration-tests.sh diff --git a/justfile b/justfile index 30db50f8b..72c048680 100644 --- a/justfile +++ b/justfile @@ -39,7 +39,7 @@ lint-verify: $REPO_DIR/contrib/lint-verify.sh lint-integration-tests: - $REPO_DIR/contrib/lint-integtation-tests.sh + $REPO_DIR/contrib/lint-integration-tests.sh # Run cargo fmt fmt: diff --git a/node/Cargo.toml b/node/Cargo.toml index 7671ed326..7a89b7e46 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -73,3 +73,17 @@ latest = ["30_2"] [package.metadata.docs.rs] features = ["28_2"] rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.rbmt.lint] +# The node crate requires a version feature to compile; use `latest` for per-package lint. +features = ["latest"] +# Duplicates from build-dep/dep splits, --target=all, or upstream version conflicts. +allowed_duplicates = [ + "anyhow", # build-dep and regular dep, same version + "base64", # bitcoin uses v0.21, jsonrpc uses v0.22 + "bitcoin_hashes", # build-dep (download) and transitive dep via bitcoin, same version + "bitreq", # build-dep (download) and regular dep via jsonrpc, same version + "linux-raw-sys", # same version, appears twice under --target=all + "rustix", # same version, appears twice under --target=all + "windows-sys", # ring/rustls pin v0.52, tar/tempfile/rustix pin v0.59 +] diff --git a/rbmt-version b/rbmt-version new file mode 100644 index 000000000..de57ca2d2 --- /dev/null +++ b/rbmt-version @@ -0,0 +1 @@ +6560b728ae6a81af9d92713b630ba26772fbd970