From 3786680cc770dff9bba9c4cf404f5d8214e9717a Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Tue, 8 Mar 2022 15:23:51 +1100 Subject: [PATCH 1/3] Use correct script name The test script is incorrectly named in our contributor docs. Fix it up with the correct name. --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eca42753..36758802 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -128,7 +128,7 @@ PR authors may also find it useful to run the following script locally in order to check that each of the commits within the PR satisfies the requirements above, before submitting the PR to review: ```shell script -BITCOIN_MSRV=1.29.0 ./contrib/ci.sh +BITCOIN_MSRV=1.29.0 ./contrib/test.sh ``` Please replace the value in `BITCOIN_MSRV=1.29.0` with the current MSRV from [README.md]. From 8163497ab30f8cdc6171417ad7bec223915723f9 Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Tue, 8 Mar 2022 15:30:09 +1100 Subject: [PATCH 2/3] Use correct indentation Some code has only two spaces of indentation, we favour 4 in bash scripts. --- contrib/test.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/contrib/test.sh b/contrib/test.sh index b6da35fc..922e3ea7 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -37,27 +37,27 @@ cargo test --verbose 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 --verbose --features="no-std" --no-default-features + echo "********* Testing no-std build *************" + # Build no_std, to make sure that cfg(test) doesn't hide any issues + cargo build --verbose --features="no-std" --no-default-features - # Build std + no_std, to make sure they are not incompatible - cargo build --verbose --features="no-std" + # Build std + no_std, to make sure they are not incompatible + cargo build --verbose --features="no-std" - # Test no_std - cargo test --verbose --features="no-std" --no-default-features + # Test no_std + cargo test --verbose --features="no-std" --no-default-features - # Build all features - cargo build --verbose --features="no-std $FEATURES" --no-default-features + # Build all features + cargo build --verbose --features="no-std $FEATURES" --no-default-features - # Build specific features - for feature in ${FEATURES} - do - cargo build --verbose --features="no-std $feature" - done + # Build specific features + for feature in ${FEATURES} + do + cargo build --verbose --features="no-std $feature" + done - cargo run --example bip32 7934c09359b234e076b9fa5a1abfd38e3dc2a9939745b7cc3c22a48d831d14bd - cargo run --no-default-features --features no-std --example bip32 7934c09359b234e076b9fa5a1abfd38e3dc2a9939745b7cc3c22a48d831d14bd + cargo run --example bip32 7934c09359b234e076b9fa5a1abfd38e3dc2a9939745b7cc3c22a48d831d14bd + cargo run --no-default-features --features no-std --example bip32 7934c09359b234e076b9fa5a1abfd38e3dc2a9939745b7cc3c22a48d831d14bd fi # Test each feature From 0d36455d74848d657c9872308445bac22fb3f6d7 Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Tue, 8 Mar 2022 15:36:54 +1100 Subject: [PATCH 3/3] 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. --- .github/workflows/rust.yml | 15 +-------------- contrib/test.sh | 5 +++++ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 66c1a690..d1e6b0cf 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -24,6 +24,7 @@ jobs: DO_BENCH: true AS_DEPENDENCY: true DO_NO_STD: true + DO_DOCS: true - rust: 1.29.0 env: AS_DEPENDENCY: true @@ -82,20 +83,6 @@ jobs: - name: run cross test run: cross test --target s390x-unknown-linux-gnu - Docs: - name: Docs - runs-on: ubuntu-latest - steps: - - name: Checkout Crate - uses: actions/checkout@v2 - - name: Checkout Toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - name: Create Doc - run: cargo doc Embedded: runs-on: ubuntu-latest steps: diff --git a/contrib/test.sh b/contrib/test.sh index 922e3ea7..41503bc9 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -67,6 +67,11 @@ do cargo test --verbose --features="$feature" done +# Build the docs if told to (this only works with the nightly toolchain) +if [ "$DO_DOCS" = true ]; then + RUSTDOCFLAGS="--cfg docsrs" cargo doc --all --features="$FEATURES" +fi + # Fuzz if told to if [ "$DO_FUZZ" = true ] then