Skip to content

Commit ff8f114

Browse files
committed
Merge #1979: feat: add justfile
501766e feat: add `justfile` (Luis Schwab) Pull request description: <!-- You can erase any parts of this template not applicable to your Pull Request. --> ### Description Closes #1967. This PR adds a `justfile`, updates the PR template to use it, and adds a section on the `README.md` to show available recipes. These are the implemented recipes: ```justfile 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 ``` `check` will verify if `HEAD` was signed and echo that warning if not. It does not check all commits, but I think that checking only the last is a pretty good heuristic (who signs the last commit only?). Before pushing, one only needs to run `just p`. ### Checklists #### All Submissions: * [X] I've signed all my commits * [X] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [X] I ran `just p` before pushing ACKs for top commit: ValuedMammal: ACK 501766e evanlinjin: ACK 501766e Tree-SHA512: b42109c7c3e01f529b794f37bacf8c6c2298243dd5f827c59ce74e7c64a4ef48eac84c4de86280bec828f56a81854c57458d9ea2b10acb83766fc1bdb34d24b6
2 parents c496cde + 501766e commit ff8f114

File tree

4 files changed

+78
-11
lines changed

4 files changed

+78
-11
lines changed

.github/pull_request_template.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ of the PR were done in a specific way -->
1818

1919
#### All Submissions:
2020

21-
* [ ] I've signed all my commits
2221
* [ ] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
23-
* [ ] I ran `cargo +nightly fmt` and `cargo clippy` before committing
2422

2523
#### New Features:
2624

CONTRIBUTING.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ To facilitate communication with other contributors, the project is making use
5555
of GitHub's "assignee" field. First check that no one is assigned and then
5656
comment suggesting that you're working on it. If someone is already assigned,
5757
don't hesitate to ask if the assigned party or previous commenter are still
58-
working on it if it has been awhile.
58+
working on it if it has been a while.
5959

6060
Deprecation policy
6161
------------------
@@ -87,7 +87,7 @@ Coding Conventions
8787
------------------
8888

8989
This codebase uses spaces, not tabs.
90-
Use `cargo fmt` with the default settings to format code before committing.
90+
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.
9191
This is also enforced by the CI.
9292
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.
9393

@@ -105,6 +105,10 @@ Note that BDK is currently considered "pre-production" during this time, there
105105
is no special handling of security issues. Please simply open an issue on
106106
Github.
107107

108+
BDK requires all commits to be signed using PGP. Refer to
109+
[this guide](https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work)
110+
if you don't have a PGP key set up with `git` yet.
111+
108112
Testing
109113
-------
110114

@@ -117,16 +121,16 @@ effort.
117121
First Time Contributors
118122
-----------------------
119123

120-
If it is your first time contributing to the BDK family of libraries, welcome! We're glad to have you with us. If your
121-
first (or few first) PRs are focused on very small fixes to documentation, however, they might not meet our threshold
124+
If it is your first time contributing to the BDK family of libraries, welcome! We're glad to have you with us. If your
125+
first (or few first) PRs are focused on very small fixes to documentation, however, they might not meet our threshold
122126
for acceptance for first time contributors.
123127

124-
Minor grammar and punctuation fixes aren't a good way to start contributing to a project, and instead we suggest you
125-
start with something a little more substantial. It's better to find an issue where you can demonstrate some knowledge
126-
of bitcoin or the code base, such as improving the substance of documentation, testing, or fixing some small issue
128+
Minor grammar and punctuation fixes aren't a good way to start contributing to a project, and instead we suggest you
129+
start with something a little more substantial. It's better to find an issue where you can demonstrate some knowledge
130+
of bitcoin or the code base, such as improving the substance of documentation, testing, or fixing some small issue
127131
even if it's considered low priority.
128132

129-
This being said we are always looking forward to working with new folks interested in contributing to our libraries.
133+
This being said we are always looking forward to working with new folks interested in contributing to our libraries.
130134
If you are looking for issues to work on, check out the good first issue label and join our Discord server!
131135

132136
Going further

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The workspace in this repository contains several crates in the `/crates` direct
3939
| [`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) |
4040
| [`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) |
4141

42-
The [`bdk_wallet`] repository and crate contains a higher level `Wallet` type that depends on the above lower-level mechanism crates.
42+
The [`bdk_wallet`] repository and crate contains a higher level `Wallet` type that depends on the above lower-level mechanism crates.
4343

4444
Fully working examples of how to use these components are in `/examples`:
4545

@@ -68,6 +68,12 @@ The following BDK crates maintains a MSRV of 1.63.0. To build these crates with
6868

6969
The MSRV of the `bdk_electrum` crate is 1.75.0.
7070

71+
## Just
72+
73+
This project has a [`justfile`](/justfile) for easy command running. You must have [`just`](https://github.com/casey/just) installed.
74+
75+
To see a list of available recipes: `just`
76+
7177
## License
7278

7379
Licensed under either of

justfile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
alias b := build
2+
alias c := check
3+
alias f := fmt
4+
alias t := test
5+
alias p := pre-push
6+
7+
_default:
8+
@just --list
9+
10+
# Build the project
11+
build:
12+
cargo build
13+
14+
# Check code: formatting, compilation, linting, and commit signature
15+
check:
16+
cargo +nightly fmt --all -- --check
17+
cargo check --workspace --all-features
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
24+
fmt:
25+
cargo +nightly fmt
26+
27+
# Run all tests for all crates with all features enabled
28+
test:
29+
@just _test-bitcoind_rpc
30+
@just _test-chain
31+
@just _test-core
32+
@just _test-electrum
33+
@just _test-esplora
34+
@just _test-file_store
35+
@just _test-testenv
36+
37+
_test-bitcoind_rpc:
38+
cargo test -p bdk_bitcoind_rpc --all-features
39+
40+
_test-chain:
41+
cargo test -p bdk_chain --all-features
42+
43+
_test-core:
44+
cargo test -p bdk_core --all-features
45+
46+
_test-electrum:
47+
cargo test -p bdk_electrum --all-features
48+
49+
_test-esplora:
50+
cargo test -p bdk_esplora --all-features
51+
52+
_test-file_store:
53+
cargo test -p bdk_file_store --all-features
54+
55+
_test-testenv:
56+
cargo test -p bdk_testenv --all-features
57+
58+
# Run pre-push suite: format, check, and test
59+
pre-push: fmt check test

0 commit comments

Comments
 (0)