Merge rust-bitcoin/rust-bitcoin#858: Build the docs with test.sh

0d36455d74 Build the docs with test.sh (Tobin Harding)
8163497ab3 Use correct indentation (Tobin Harding)
3786680cc7 Use correct script name (Tobin Harding)

Pull request description:

  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.

  - Patch 1: Fixes the incorrect file naming `ci.sh` -> `test.sh` in `CONTRIBUTING.md`.
  - Patch 2 - 4: Do trivial cleanup of `test.sh`.
  - Patch 5: Does the fix described above.

  Resolves: #850

ACKs for top commit:
  Kixunil:
    ACK 0d36455d74
  apoelstra:
    ACK 0d36455d74
  dr-orlovsky:
    ACK 0d36455d74

Tree-SHA512: c33c8df687c2115477eae9888b80d4e744d7b68b598694cf17220dd11098f33ba23c0b33e6f7d291572187942c472d1bc9cbb5217d3d83d41906a97c0b3417e5
This commit is contained in:
Dr. Maxim Orlovsky 2022-03-12 12:44:30 +02:00
commit a8c9ea6b91
No known key found for this signature in database
GPG Key ID: AF91255DEA466640
3 changed files with 23 additions and 31 deletions

View File

@ -24,6 +24,7 @@ jobs:
DO_BENCH: true DO_BENCH: true
AS_DEPENDENCY: true AS_DEPENDENCY: true
DO_NO_STD: true DO_NO_STD: true
DO_DOCS: true
- rust: 1.29.0 - rust: 1.29.0
env: env:
AS_DEPENDENCY: true AS_DEPENDENCY: true
@ -82,20 +83,6 @@ jobs:
- name: run cross test - name: run cross test
run: cross test --target s390x-unknown-linux-gnu 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: Embedded:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

View File

@ -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 to check that each of the commits within the PR satisfies the requirements
above, before submitting the PR to review: above, before submitting the PR to review:
```shell script ```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 Please replace the value in `BITCOIN_MSRV=1.29.0` with the current MSRV from
[README.md]. [README.md].

View File

@ -37,27 +37,27 @@ cargo test --verbose
if [ "$DO_NO_STD" = true ] if [ "$DO_NO_STD" = true ]
then then
echo "********* Testing no-std build *************" echo "********* Testing no-std build *************"
# Build no_std, to make sure that cfg(test) doesn't hide any issues # Build no_std, to make sure that cfg(test) doesn't hide any issues
cargo build --verbose --features="no-std" --no-default-features cargo build --verbose --features="no-std" --no-default-features
# Build std + no_std, to make sure they are not incompatible # Build std + no_std, to make sure they are not incompatible
cargo build --verbose --features="no-std" cargo build --verbose --features="no-std"
# Test no_std # Test no_std
cargo test --verbose --features="no-std" --no-default-features cargo test --verbose --features="no-std" --no-default-features
# Build all features # Build all features
cargo build --verbose --features="no-std $FEATURES" --no-default-features cargo build --verbose --features="no-std $FEATURES" --no-default-features
# Build specific features # Build specific features
for feature in ${FEATURES} for feature in ${FEATURES}
do do
cargo build --verbose --features="no-std $feature" cargo build --verbose --features="no-std $feature"
done done
cargo run --example bip32 7934c09359b234e076b9fa5a1abfd38e3dc2a9939745b7cc3c22a48d831d14bd cargo run --example bip32 7934c09359b234e076b9fa5a1abfd38e3dc2a9939745b7cc3c22a48d831d14bd
cargo run --no-default-features --features no-std --example bip32 7934c09359b234e076b9fa5a1abfd38e3dc2a9939745b7cc3c22a48d831d14bd cargo run --no-default-features --features no-std --example bip32 7934c09359b234e076b9fa5a1abfd38e3dc2a9939745b7cc3c22a48d831d14bd
fi fi
# Test each feature # Test each feature
@ -67,6 +67,11 @@ do
cargo test --verbose --features="$feature" cargo test --verbose --features="$feature"
done 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 # Fuzz if told to
if [ "$DO_FUZZ" = true ] if [ "$DO_FUZZ" = true ]
then then