Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Add initial github actions #3

Merged
merged 13 commits into from
Nov 15, 2023
76 changes: 76 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
on:
push:
branches:
- master
- 'test-ci/**'
pull_request:

name: Continuous integration

jobs:
Stable:
name: Test - stable toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Checkout Toolchain
# https://github.com/dtolnay/rust-toolchain
uses: dtolnay/rust-toolchain@stable
- name: Running test script
env:
DO_LINT: true
DO_NO_STD: true
DO_DOCS: true
run: ./contrib/test.sh

Beta:
name: Test - beta toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@beta
- name: Running test script
env:
DO_NO_STD: true
run: ./contrib/test.sh

Nightly:
name: Test - nightly toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@nightly
- name: Running test script
env:
DO_FMT: false
DO_NO_STD: true
DO_DOCSRS: true
run: ./contrib/test.sh

MSRV:
name: Test - 1.56.1 toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.56.1"
- name: Running test script
env:
DO_NO_STD: true
run: ./contrib/test.sh
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ rustdoc-args = ["--cfg", "docsrs"]
[features]
default = ["std"]
std = ["bitcoin/std"]
no-std = ["bitcoin/no-std"]
no-std = ["bitcoin/no-std", "core2"]
serde = ["actual-serde", "bitcoin/serde"]
base64 = ["bitcoin/base64"]

[dependencies]
bitcoin = { version = "0.31.0", default-features = false, features = ["std"] }
bitcoin = { version = "0.31.0", default-features = false, features = [] }

# Do NOT use this as a feature! Use the `serde` feature instead.
actual-serde = { package = "serde", version = "1.0.103", default-features = false, features = [ "derive", "alloc" ], optional = true }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For now we more or less just follow the contribution guidelines of

### Minimum Supported Rust Version (MSRV)

This library should always compile with any combination of features on **Rust 1.63.0**.
This library should always compile with any combination of features on **Rust 1.56.1**.

To build with the MSRV you will likely need to pin a bunch of dependencies, see `./contrib/test.sh`
for the current list.
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
msrv = "1.63.0"
msrv = "1.56.1"
54 changes: 15 additions & 39 deletions contrib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
set -ex

FEATURES="serde base64"
MSRV="1\.63\.0"

cargo --version
rustc --version
Expand All @@ -14,19 +13,6 @@ if cargo --version | grep nightly >/dev/null; then
NIGHTLY=true
fi

# Pin dependencies require to build with MSRV.
if cargo --version | grep ${MSRV}; then
cargo update -p serde_json --precise 1.0.99
cargo update -p serde --precise 1.0.156
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
# memchr 2.6.0 uses edition 2021
cargo update -p memchr --precise 2.5.0
# byteorder 1.5.0 uses edition 2021
cargo update -p byteorder --precise 1.4.3
fi

# Make all cargo invocations verbose.
export CARGO_TERM_VERBOSE=true

Expand All @@ -36,51 +22,41 @@ cargo test

if [ "$DO_LINT" = true ]
then
cargo clippy --locked --all-features --all-targets -- -D warnings
cargo clippy --all-features --all-targets -- -D warnings
fi

echo "********* Testing std *************"
# Test without any features other than std first
cargo test --locked --verbose --no-default-features --features="std"
# Test without any features other than std first (same as default)
cargo build --no-default-features --features="std"
cargo test --no-default-features --features="std"

echo "********* Testing default *************"
# Then test with the default features
cargo test --verbose
# Test each feature with default enabled ("std").
for feature in ${FEATURES}
do
cargo build --features="$feature"
cargo test --features="$feature"
done

if [ "$DO_NO_STD" = true ]
then
echo "********* Testing no-std build *************"
# Build no_std, to make sure that cfg(test) doesn't hide any issues
cargo build --locked --verbose --features="no-std" --no-default-features
cargo build --no-default-features --features="no-std"

# Build std + no_std, to make sure they are not incompatible
cargo build --locked --verbose --features="no-std"
cargo build --features="no-std"

# Test no_std
cargo test --locked --verbose --features="no-std" --no-default-features
cargo test --no-default-features --features="no-std"

# Build all features
cargo build --locked --verbose --features="no-std $FEATURES" --no-default-features
cargo build --no-default-features --features="no-std $FEATURES"

# Build specific features
for feature in ${FEATURES}
do
cargo build --locked --verbose --features="no-std $feature" --no-default-features
cargo build --no-default-features --features="no-std $feature"
done
fi

# Test each feature with default enabled ("std").
for feature in ${FEATURES}
do
echo "********* Testing $feature *************"
cargo test --locked --verbose --features="$feature"
done

# Build the docs if told to (this only works with the nightly toolchain)
if [ "$DO_DOCSRS" = true ]; then
RUSTDOCFLAGS="--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" cargo +nightly doc --all-features
fi

# Build the docs if told to (this only works with the nightly toolchain)
if [ "$DO_DOCSRS" = true ]; then
RUSTDOCFLAGS="--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" cargo +nightly doc --all-features
Expand Down
2 changes: 2 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ pub enum PsbtHash {
Hash160,
Hash256,
}

/// Ways that a Partially Signed Transaction might fail.
// TODO: This general error needs splitting up into specific error types.
#[derive(Debug)]
#[non_exhaustive]
pub enum Error {
Expand Down
Loading