Commit Graph

68 Commits

Author SHA1 Message Date
Andrew Poelstra 9df59639ce
Merge rust-bitcoin/rust-bitcoin#2621: Release tracking PR: `hashes v0.14.0`
0ca5a43ce5 hashes: Bump version to v0.14.0 (Tobin C. Harding)

Pull request description:

  In preparation for release add a changlelog entry and bump the version.

  Note the hashes 0.13.0 dependency stays in the dependency graph because of secp, we can update secp after releasing `hashes` then update the secp dependency in `rust-bitcoin` thereby removing the `hashes v0.13.0` dependency - phew.

  Note we are right to release this immediately, the two open PRs (#2337 and #2541) that touch `hashes` only add a clippy attribute so can safely be ignored.

ACKs for top commit:
  apoelstra:
    ACK 0ca5a43ce5
  sanket1729:
    ACK 0ca5a43ce5

Tree-SHA512: d1d26acb8fbf13f785b25add3f1dac05bb392b5bdbad16ead2bc5dd26f3d668824c4b653c373f88c3562a37e775146766680606cedd19db40e0f197b26ca86b8
2024-03-25 22:23:30 +00:00
Tobin C. Harding 0ca5a43ce5
hashes: Bump version to v0.14.0
In preparation for release add a changlelog entry and bump the version.

I'm not 100% sure that this release is API breaking, dependencies
definitely changed. The rest might be only additives but I didn't bother
looking exactly because I think its better to bump the minor version and
err on the side of caution.

Note the hashes 0.13.0 dependency stays in the dependency graph because
of secp, we can update secp after releasing `hashes` then update the
secp dependency in `rust-bitcoin` thereby removing the `hashes v0.13.0`
dependency - phew.
2024-03-22 06:04:40 +11:00
Andrew Poelstra 50e772fe79
Revert "ci: introduce `classify-pr.sh` script which determines whether a PR should have CI run"
This reverts commit 9aca8a18c7.
2024-03-20 14:08:17 +00:00
Andrew Poelstra ec3e4e8801
Revert "ci: gate coverage analysis on whether source code changed"
This reverts commit 32f9b1a231.
2024-03-20 14:08:14 +00:00
Andrew Poelstra f495bd9681
Merge rust-bitcoin/rust-bitcoin#2525: ci: skip CI for things that modify only markdown files
32f9b1a231 ci: gate coverage analysis on whether source code changed (Andrew Poelstra)
2203c02347 ci: gate fuzztesting on whether source code changed (Andrew Poelstra)
09f7fc3cff ci: gate CI workflow on source being changed (Andrew Poelstra)
9aca8a18c7 ci: introduce `classify-pr.sh` script which determines whether a PR should have CI run (Andrew Poelstra)

Pull request description:

  Fixes #2523

ACKs for top commit:
  tcharding:
    ACK 32f9b1a231

Tree-SHA512: 7d53365bdf4e8ae5480221e43b4c515d4b16048ec1a00cb62ab65b2d2b91a37f8945c39b619a82bfe4ca74f3508176d9879481b908bb8d3fe8d214b173d3bf18
2024-03-20 14:01:32 +00:00
Tobin C. Harding 097a00b133
CI: Disable MSAN job
I believe there is currently a bug in the MemorySanitizer, when we pass
various types across the FFI boundry MSAN gives a unititialized variable
error:

- `usize` passed as `size_t` (cannot be uninitialized)
- byte slice passed as `const char *`

In order to let other work continue disable the MSAN job.
2024-03-15 09:44:38 +11:00
Andrew Poelstra 32f9b1a231
ci: gate coverage analysis on whether source code changed 2024-03-01 16:13:40 +00:00
Andrew Poelstra 9aca8a18c7
ci: introduce `classify-pr.sh` script which determines whether a PR should have CI run 2024-03-01 16:12:19 +00:00
Andrew Poelstra c97f2ccc69
ci: require a nightly compiler rather than using +nightly
If we pin the version of nightly to a specific date then `cargo
+nightly` will stop working. And even locally, if you want to use a
specific version of nightly, you can't if the script is overriding your
version with "+nightly". Instead the user should set RUSTUP_TOOLCHAIN.
2024-02-28 20:47:35 +00:00
Andrew Poelstra e386cbfadf
ci: delete *test.sh files
These are not run in CI since #2353 and are likely to go out of date. If
we want a script that users can run locally then we should create a new
script that wraps our current CI.
2024-02-28 20:45:56 +00:00
Tobin C. Harding 01a66a7fa7
CI: Check for required commands
Add a function to check for commands used by the `run_task` script. Move
the version printing to after the check. Also print the bash version in
use.
2024-02-02 11:35:56 +11:00
Martin Habovstiak 5c15ed5441
CI: Epic overhaul
Re-write the whole CI pipeline.

Co-developed-by: Martin Habovstiak <martin.habovstiak@gmail.com>
2024-02-02 05:57:23 +11:00
Tobin C. Harding 242aa676b3
Use env bash instead of /bin/bash
As we do in all the other shell scripts use `env` to call `bash`.
2024-02-02 05:57:23 +11:00
Tobin C. Harding 422d30117c
Use bash to run shell scripts
Use `bash` instead of `sh` to run shell scripts.

We would like to support Nix users who do not typically have any shell
other than `sh` at a known path, therefore use `/usr/bin/env bash`.
2024-02-02 05:55:51 +11:00
Martin Habovstiak c6c5f07880 Add automated labeler job
Rather than modifying the labels manually, which we often forget, we can
label the PRs automatically. This will make it easier to search PRs.
2024-01-20 16:35:37 +01:00
Tobin C. Harding 69e56a64ed
Add bitcoin-units crate
Add a new crate `bitcoin-units`, move the `amount` module over to it and
re-export all types from `bitcoin::amount` so this as not a breaking
change.
2023-12-11 08:52:31 +11:00
Tobin C. Harding 6f1cb42d84
Remove NEXT_RELEASE from release script comment
Recently we remove the usage of `NEXT_RELEASE` in favour of `TBD` but I
missed the code comment.
2023-12-05 15:03:38 +11:00
Tobin C. Harding c27f101840
Introduce usage of TBD instead of NEXT-RELEASE
There is an ecosystem-wide solution to our custom usage of
`NEXT-RELEASE` in deprecation attributes - use

   `#[decprecated(since = "TBD", note = "use bar instead")]`

Lets use it.
2023-12-01 13:26:12 +11:00
Tobin C. Harding d9cc724187
Bump MSRV to Rust version 1.56.1
Rust version 1.56.0 introduced edition 2021. Shortly afterwards, on
October 21 2021 Rust version 1.56.1 was released.

Debian stable is currently shipping `rustc 1.63.0`.

Our stated MSRV policy is: In Debian stable and at least 2 years old.

Therefore our MSRV policy is met by Rust version 1.56.1 and we can strat
to bump our MSRV org wide.

Start by bumping the `rust-bitcoin` and `hashes` MSRV to Rust 1.56.1,
includes:

- Update docs.
- Update CI and remove pinning.
- Update the build files and remove now stale cfg attributes rust_v_1_x
  for values less than the new MSRV.
- Use new `IntoIterator` for arrays so we no longer need to allocate a
  vector to iterate.

Links:

- https://blog.rust-lang.org/2021/11/01/Rust-1.56.1.html
- https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html
- https://packages.debian.org/stable/rust/rustc
2023-11-23 06:20:02 +11:00
Tobin C. Harding 75c490c60f
hashes: Remove default features from schemars dep
We are trying to get rid of the `serde_derive` dependency from our
dependency graph.

Stop using default features for the `schemars` dependency which includes
`schemars_derive` which depends on `serder_derive`.

Manually implement `schemars::JsonSchema` instead of deriving it.
2023-11-20 15:18:33 +11:00
Matt Corallo add371d263 Remove `core2` dependency entirely 2023-11-09 16:46:44 +00:00
Roman Zeyde 5d43ad7607 Fix a small typo in 'contrib/test.sh' 2023-10-25 22:22:08 +03:00
Tobin C. Harding 6731e85dc1
bitcoin: Bump version to 0.31.0-rc1
In preparation for the first rc release; bump the version number.
2023-10-13 08:34:46 +11:00
Vincenzo Palazzo 6b5d06f23e
ci: fix the byteorder to 1.4.3 for edition 2018
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-10-07 12:01:57 +02:00
Tobin C. Harding 685e5101ce
Add wasm dev-deps using CI script
We only test WASM in CI using a stable toolchain however because we have
a target specific dev-dependencies section the wasm deps get pulled in
during MSRV builds - this breaks the MSRV build.

Instead of including WASM dev-dependencies in the manifest we can
dynamically modify the manifest when running the WASM tests. We do this
already to add the `crate-type` section so this is not really that
surprising to see in the CI script.

Doing so allows us to stop pinning the transitive `syn` dependency also
which is included in the dependency graph because of `wasm-bingen-test`.
2023-10-05 11:16:24 +11:00
Tobin C. Harding 34890827ae
Pin syn to 2.0.32
We have a dependency on `syn` deep in the dependency graph that is
breaking MSRV, just pin the damn thing to 2.0.32
2023-09-19 05:37:35 +10:00
Tobin C. Harding adcc01c0bd
CI: Fix pinning
More crates broke our MSRV by using edition 2021 without doing a major
release, pin them in the CI script.

diff --git a/contrib/test.sh b/contrib/test.sh
index 74f8ffb3..79932ad5 100755
--- a/contrib/test.sh
+++ b/contrib/test.sh
@@ -13,6 +13,12 @@ if cargo --version | grep ${MSRV}; then
     cargo update -p quote --precise 1.0.30
     cargo update -p proc-macro2 --precise 1.0.63
     cargo update -p serde_test --precise 1.0.175
+    # Have to pin this so we can pin `schemars_derive`
+    cargo update -p schemars --precise 0.8.12
+    # schemars_derive 0.8.13 uses edition 2021
+    cargo update -p schemars_derive --precise 0.8.12
+    # memcrh 2.6.0 uses edition 2021
+    cargo update -p memchr --precise 2.5.0

     cargo update -p bitcoin:0.30.1 --precise 0.30.0
2023-08-29 12:33:19 +10:00
Tobin C. Harding 8b84227aec
Add a script for updating lock files
Every time one of the dependencies is explicitly changed we have to
update the minimal/recent lock files. Add a script to do so.
2023-08-24 11:03:06 +10:00
yancy 02890d3fba Use spaces instead of tabs 2023-08-12 17:34:08 +02:00
yancy 894aa130b6 Add CI test for pinned versions using MSRV 2023-08-10 22:01:06 +02:00
Andrew Poelstra ca06d64455
rename bitcoin-private to bitcoin-internals
Since we now have control over the name on crates.io.
2023-05-26 19:49:52 +00:00
Martin Habovstiak c4c64c0dc5
Test with minimal dependency versions
It could happen that we unknowingly depend on a new version of a crate
without updating `Cargo.toml`. This could cause resolution issues for
downstream users. It's also unclear for outsiders to see which
dependencies we tested the crate with.

This change commits two lock files: `minimal` and `recent`. `minimal`
contains minimal depdendency versions, while `recent` contains
dependency versions at the time of making the change.

Further, this adds CI jobs to test with both lock files, CI job for
`internals` crate, removes old `serde` pinning and prints a warning if
`recent` is no longer up to date. (We may have to override it somehow if
any crate breaks MSRV.)

The documentation is also updated accordingly.

Co-developed-by: Tobin C. Harding <me@tobin.cc>

Closes #1230
2023-05-03 08:06:46 +10:00
Andrew Poelstra 9cfc0fcd81
fuzz: add contrib/test.sh so we at least 'cargo test' it in CI 2023-04-27 00:24:53 +00:00
Steven Roose 38d11ce3da
ci: Make release CI search for NEXT.RELEASE instead 2023-04-19 16:07:03 +01:00
Steven Roose b3b57518a0
ci: Check for remaining NEXT_RELEASE in the release script
The intention here is that we can use the deprecation tag
`#[deprecated(since = "NEXT_RELEASE")]` and fill in the version number
at release time.
2023-04-10 21:16:59 +01:00
Tobin C. Harding e223cbe6df
CI: Only run release job for release PRs
Currently we run the release jobs for all PRs, this leads to red CI runs
any time we have unreleased changes in one crate used by another i.e.,
basically days after a release comes out.

Add a `release.sh` script that has more smarts to try and figure out if
the patch series currently ontop of tip of mater contains changes that
imply its a release PR. To do so we check for changes to the version
field in the manifest of each crate.
2023-04-04 12:49:59 +10:00
Tobin C. Harding f4e7def72f
internals: Add CI test script
We do not currently run the `internals` crate tests in CI. Bad
rust-bitcoin developers, no biscuit.
2023-01-13 07:59:38 +11:00
Tobin C. Harding b9643bf3e9 Import bitcoin_hashes crate into hashes
We would like to bring the `bitcoin_hashes` crate into the
`rust-bitcoin` repository.

Import `bitcoin_hashes` into `rust-bitocin/hashes`, doing so looses all
the commit history from the original crate but if we archive the
original repository then the history will be preserved. We maintain the
same version number obviously and in the changelog we note the change of
repository.

Commit hash that was tip of `bitcoin_hashes` at time of import:

 commit 54c16249e06cc6b7870c7fc07d90f489d82647c7

Includes making `embedded` and `fuzzing` per-crate i.e., move them into
`bitcoin` as hashes includes these also.

NOTE: Does _not_ enable fuzzing for `hashes` in CI.

Notes on CI:

Attempts to merge in the github actions from the hashes crate however reduces
coverage by not running hashes tests for beta toolchain. Some additional
work could be done to improve the CI to increase efficiency without
reducing coverage. Leaving for another day.
2022-11-08 08:58:09 +11:00
Tobin C. Harding 022730bd8d Add a workspace to the top level directory.
Create a directory `bitcoin` and move into it the following as is with
no code changes:

- src
- Cargo.toml
- contrib
- test_data
- examples

Then do:

- Add a workspace to the repository root directory.
- Add the newly created `bitcoin` crate to the workspace.
- Exclude `fuzz` and `embedded` crates from the workspace.
- Add a contrib/test.sh script that runs contrib/test.sh in each
  sub-crate
- Fix the bitcoin/contrib/test.sh script
2022-09-13 08:44:57 +10:00
Tobin C. Harding 37cd6503f1 ci: Remove TOOLCHAIN env var
Cargo already has an env var for controlling the toolchain, we should
use it instead of our current custom `TOOLCHAIn`.

While we are at it fix the missing `$` from variables (found by
`shellcheck`).

Use RUSTUP_TOOLCHAIN to allow control of the toolchain.
2022-09-05 10:48:47 +10:00
Tobin C. Harding 8eb6c23eaf ci: Remove inner quotes from shell variable
shellcheck emits:

 SC2027: The surrounding quotes actually unquote this. Remove or escape them.

Remove inner quotes from shell variable so the feature is correctly printed.
2022-09-05 10:48:47 +10:00
Tobin C. Harding 58ede47ef1 ci: Use set -ex instead of /bin/sh -ex
Setting `-ex` in the shebang makes it a little hard to see since folks
are used to glancing up and looking for `set -ex`. Both styles achieve
the same result, so this does not change the logic of the script.
2022-09-05 10:48:47 +10:00
Martin Habovstiak 7a28a56ac4 Pin `serde` to 1.0.142
1.0.143 bumps MSRV higher than what we support.
2022-08-09 15:59:27 +02:00
Tobin C. Harding 74f3a5aeda Run clippy from the test script
Currently we run clippy in CI using a github action. The invocation has
a couple of shortcomings

1. it does not lint the tests (this requires `--all-targets`)
2. it does not lint the examples

I could not find a way to lint the examples without explicitly linting
each example by name.

Move the clippy control to `test.sh` and add an env var `DO_LINT` to
control it. Remove the explicit CI job and run the linter during the
`Test` job using the stable toolchain.
2022-07-26 08:48:15 +10:00
Tobin C. Harding cda097dda8 Add ci check for duplicate dependencies
Add a call to `cargo tree --duplicates` in the ci script to ensure that
we do not have any duplicated dependencies.

Kudos to Martin for the idea.
2022-07-22 09:25:21 +10:00
Tobin C. Harding cd2369b4f9 Run ecdsa-psbt example in test script
We just added a PSBT example file, run it from CI for all test runs.
2022-07-19 11:02:20 +10:00
Tobin C. Harding f3b2120ec9 Create configuration conditional bench
Currently we are unable to build with all features enabled with a
non-nightly toolchain, this is because of the use of

    `#![cfg_attr(all(test, feature = "unstable"), feature(test))]`

which causes the following error when building:

 error[E0554]: `#![feature]` may not be used on the stable release
 channel

The "unstable" feature is used to guard bench mark modules, this is
widely suggested online but there is a better way.

When running the bench marks use the following incantation:

    `RUSTFLAGS='--cfg=bench' cargo bench`

This creates a configuration conditional "bench" that can be used to
guard the bench mark modules.

    #[cfg(bench)]
    mod benches {
        ...
    }
2022-07-14 10:21:01 +10:00
Tobin C. Harding f60c92ca58 Add informative error message to DO_BENCH
If CI script is run with `DO_BENCH=true` and `TOOLCHAIN` set to a
non-nightly toolchain the build will fail with a less than meaningful
error. To assist runners of the script output an informative error
message if an attempt is made at using the wrong toolchain.
2022-07-14 09:53:31 +10:00
Tobin C. Harding c6d5a12b60 Add cargo/rustc sanity calls
Add trivial calls to `cargo` and `rustc` as sanity checks before
starting the script proper.
2022-07-14 09:47:27 +10:00
Tobin C. Harding 281af7c1b9 Move broken-intra-doc-link lint config to command line
The docs lint `broken-intra-doc-links` has been changed but the new name
is not available in our MSRV, this means we get a build warning. We only
build docs with the nightly toolchain so we can move this lint control
to the docs build command in `test.sh` instead of doing it crate wide.

With this patch applied devs risk not noticing docs link issues until
they hit them on CI _if_ they do not build with the test script or
explicitly pass in `-- -D rustdoc::broken-intra-doc-links`, which no one
is going to do. Hence we add a line to the readme with a shell alias
that can be used to check docs, taken directly from `test.sh`.
2022-06-21 09:21:19 +10:00