Commit Graph

34 Commits

Author SHA1 Message Date
yancy 894aa130b6 Add CI test for pinned versions using MSRV 2023-08-10 22:01:06 +02: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
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
Martin Habovstiak 2e7effc604 Feature `use-serde` renamed to `serde`
Features activating external crates are supposed to have same name as
those crates. However we depend on same feature in other crates so we
need a separate feature. After MSRV bump it is possible to rename the
crates and features so we can now fix this inconsistency.

Sadly, derive can't see that the crate was renamed so all derives must
be told to use the other one.
2022-05-26 10:10:47 +02:00
Tobin C. Harding 8f45723bc6 test.sh: Remove 1.29 pinning
We no longer need to test Rust 1.29, remove the pinning from the test
script.
2022-04-22 07:41:46 +10:00
Tobin Harding 0d36455d74 Build the docs with test.sh
We currently build the docs as a separate CI job, we can however just do
it as part of the `Tests` job using the nightly toolchain.

Conditionally build the docs based on a `DO_DOCS` env var.

Note, uses `--cfg docsrs` so can only be built run with nightly toolchain.
2022-03-09 08:18:48 +11:00
Tobin Harding 8163497ab3 Use correct indentation
Some code has only two spaces of indentation, we favour 4 in bash
scripts.
2022-03-09 08:18:48 +11:00
KaFai Choi bb70820fed
improve example: take hex-encoded seed instead of WIF in bip32 example 2022-01-10 06:59:49 +07:00
Devrandom 4826d0c6cc no_std support
Based on the original work by Justin Moon.

*MSRV unchanged from 1.29.0.*

When `std` is off, `no-std` must be on, and we use the [`alloc`](https://doc.rust-lang.org/alloc/) and core2 crates. The `alloc` crate requires the user define a global allocator.

* Import from `core` and `alloc` instead of `std`
* `alloc` only used if `no-std` is on
* Create `std` feature
* Create `no-std` feature which adds a core2 dependency to polyfill `std::io` features. This is an experimental feature and should be
used with caution.
* CI runs tests `no-std`
* MSRV for `no-std` is 1.51 or so
2021-07-15 09:04:49 +02:00
Andrew Poelstra ef116ffbed Add byteorder pinning for 1.29.0 compatibility
They broke their MSRV in a minor release.

Co-authored-by: Sebastian Geisler <sebastian@blockstream.io>
2021-01-09 16:43:18 +00:00
Sebastian Geisler a1e96c398f Migrate CI to GitHub actions 2021-01-01 22:34:51 +01:00
Andrew Poelstra ed9856f800 ci: pin serde and serde-derive for Rust 1.29.0 2020-12-30 16:32:52 +01:00
Steven Roose f7422fb8d1
Add MessageSignature type for dealing with signed messages 2020-10-11 22:44:00 +02:00
Andrew Poelstra 6138084c5b bump version to 0.25, MSRV to 1.29 2020-09-10 20:06:10 +00:00
Andrew Poelstra 1c46b32d2b update Travis and README for manual rustc 1.22.0 steps 2020-09-10 19:03:01 +00:00
Thomas Eizinger 24bb6590d6
Expose secp256k1 'rand' feature flag
By exposing this, we can use the 'rand' dependency of secp256k1
in a project that only depends on rust-bitcoin without having to
add a separate dependency in order to activate the feature flag.
2019-11-21 12:05:46 +11:00
Elichai Turkel 89f73ea686
Add a test for testing as a dependency 2019-08-19 13:29:50 -04:00
Carl Dong 3207ac5ea7
Generate codecov.io reports 2019-07-26 15:48:52 -04:00
Steven Roose 30201f3924
Remove Decimal and replace strason with serde_json 2019-06-13 18:29:16 +01:00
Carl Dong 50fef2d851 Extract travis testing into locally-runnable script 2019-02-04 10:39:37 -05:00