From: Luis Schwab Date: Tue, 1 Jul 2025 17:06:39 +0000 (-0300) Subject: feat: add `justfile` X-Git-Tag: bitcoind_rpc-0.21.0~13^2 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/crate::database::Database?a=commitdiff_plain;h=501766e7106f043d45b5ab6d29e9af83d6590e13;p=bdk feat: add `justfile` --- diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ace7e2cf..a9bcabef 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -18,9 +18,7 @@ of the PR were done in a specific way --> #### All Submissions: -* [ ] I've signed all my commits * [ ] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) -* [ ] I ran `cargo +nightly fmt` and `cargo clippy` before committing #### New Features: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6c893888..b7778f78 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,7 +55,7 @@ To facilitate communication with other contributors, the project is making use of GitHub's "assignee" field. First check that no one is assigned and then comment suggesting that you're working on it. If someone is already assigned, don't hesitate to ask if the assigned party or previous commenter are still -working on it if it has been awhile. +working on it if it has been a while. Deprecation policy ------------------ @@ -87,7 +87,7 @@ Coding Conventions ------------------ This codebase uses spaces, not tabs. -Use `cargo fmt` with the default settings to format code before committing. +Run `just check` to check formatting, linting, compilation and commit signing, `just fmt` to format code before commiting, and `just test` to run tests for all crates. This is also enforced by the CI. All public items must be documented. We adhere to the [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/about.html) with respect to documentation. @@ -105,6 +105,10 @@ Note that BDK is currently considered "pre-production" during this time, there is no special handling of security issues. Please simply open an issue on Github. +BDK requires all commits to be signed using PGP. Refer to +[this guide](https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work) +if you don't have a PGP key set up with `git` yet. + Testing ------- @@ -117,16 +121,16 @@ effort. First Time Contributors ----------------------- -If it is your first time contributing to the BDK family of libraries, welcome! We're glad to have you with us. If your -first (or few first) PRs are focused on very small fixes to documentation, however, they might not meet our threshold +If it is your first time contributing to the BDK family of libraries, welcome! We're glad to have you with us. If your +first (or few first) PRs are focused on very small fixes to documentation, however, they might not meet our threshold for acceptance for first time contributors. -Minor grammar and punctuation fixes aren't a good way to start contributing to a project, and instead we suggest you -start with something a little more substantial. It's better to find an issue where you can demonstrate some knowledge -of bitcoin or the code base, such as improving the substance of documentation, testing, or fixing some small issue +Minor grammar and punctuation fixes aren't a good way to start contributing to a project, and instead we suggest you +start with something a little more substantial. It's better to find an issue where you can demonstrate some knowledge +of bitcoin or the code base, such as improving the substance of documentation, testing, or fixing some small issue even if it's considered low priority. -This being said we are always looking forward to working with new folks interested in contributing to our libraries. +This being said we are always looking forward to working with new folks interested in contributing to our libraries. If you are looking for issues to work on, check out the good first issue label and join our Discord server! Going further diff --git a/README.md b/README.md index 27d5448e..635489d8 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ The workspace in this repository contains several crates in the `/crates` direct | [`bitcoind_rpc`](./crates/bitcoind_rpc) | Extends [`bitcoincore-rpc`] for emitting blockchain data from the `bitcoind` RPC interface in the form that [`bdk_chain`] and `Wallet` can consume. | ![BitcoinD RPC Crate Info](https://img.shields.io/crates/v/bdk_bitcoind_rpc.svg) ![BitcoinD RPC API Docs](https://img.shields.io/badge/docs.rs-bdk_bitcoind_rpc-green) | | [`file_store`](./crates/file_store) | Persistence backend for storing chain data in a single file. Intended for testing and development purposes, not for production. | ![File Store Crate Info](https://img.shields.io/crates/v/bdk_file_store.svg) ![File Store API Docs](https://img.shields.io/badge/docs.rs-bdk_file_store-green) | -The [`bdk_wallet`] repository and crate contains a higher level `Wallet` type that depends on the above lower-level mechanism crates. +The [`bdk_wallet`] repository and crate contains a higher level `Wallet` type that depends on the above lower-level mechanism crates. Fully working examples of how to use these components are in `/examples`: @@ -68,6 +68,12 @@ The following BDK crates maintains a MSRV of 1.63.0. To build these crates with The MSRV of the `bdk_electrum` crate is 1.75.0. +## Just + +This project has a [`justfile`](/justfile) for easy command running. You must have [`just`](https://github.com/casey/just) installed. + +To see a list of available recipes: `just` + ## License Licensed under either of diff --git a/justfile b/justfile new file mode 100644 index 00000000..b5ca94d1 --- /dev/null +++ b/justfile @@ -0,0 +1,59 @@ +alias b := build +alias c := check +alias f := fmt +alias t := test +alias p := pre-push + +_default: + @just --list + +# Build the project +build: + cargo build + +# Check code: formatting, compilation, linting, and commit signature +check: + cargo +nightly fmt --all -- --check + cargo check --workspace --all-features + cargo clippy --all-features --all-targets -- -D warnings + @[ "$(git log --pretty='format:%G?' -1 HEAD)" = "N" ] && \ + echo "\n⚠️ Unsigned commit: BDK requires that commits be signed." || \ + true + +# Format all code +fmt: + cargo +nightly fmt + +# Run all tests for all crates with all features enabled +test: + @just _test-bitcoind_rpc + @just _test-chain + @just _test-core + @just _test-electrum + @just _test-esplora + @just _test-file_store + @just _test-testenv + +_test-bitcoind_rpc: + cargo test -p bdk_bitcoind_rpc --all-features + +_test-chain: + cargo test -p bdk_chain --all-features + +_test-core: + cargo test -p bdk_core --all-features + +_test-electrum: + cargo test -p bdk_electrum --all-features + +_test-esplora: + cargo test -p bdk_esplora --all-features + +_test-file_store: + cargo test -p bdk_file_store --all-features + +_test-testenv: + cargo test -p bdk_testenv --all-features + +# Run pre-push suite: format, check, and test +pre-push: fmt check test