Improve test coverage for docs build

Currently the docs build commands in `hashes` and `bitcoin` differ, they
should be the same.

Add a command `cargo doc` to improve coverage e.g., recently we botched
the feature guarding but since CI only runs `cargo rustdoc` with custom
compiler conditional set we didn't catch it.

Run docs in CI using nightly and stable toolchains as required.
This commit is contained in:
Tobin C. Harding 2022-12-24 09:50:41 +11:00
parent b4c14a4b7c
commit 41f2dcf6ae
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
3 changed files with 16 additions and 3 deletions

View File

@ -20,6 +20,7 @@ jobs:
DO_LINT: true
AS_DEPENDENCY: false
DO_NO_STD: true
DO_DOCS: true
DO_FEATURE_MATRIX: true
DO_SCHEMARS_TESTS: true # Currently only used in hashes crate.
run: ./contrib/test.sh
@ -55,7 +56,7 @@ jobs:
DO_BENCH: true
AS_DEPENDENCY: false
DO_NO_STD: true
DO_DOCS: true
DO_DOCSRS: true
run: ./contrib/test.sh
MSRV:

View File

@ -80,8 +80,14 @@ cargo run --example ecdsa-psbt --features=bitcoinconsensus
cargo run --example taproot-psbt --features=rand-std,bitcoinconsensus
# 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 with a stable toolchain, in unison with the DO_DOCSRS command
# above this checks that we feature guarded docs imports correctly.
if [ "$DO_DOCS" = true ]; then
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly rustdoc --all-features -- -D rustdoc::broken-intra-doc-links -D warnings
RUSTDOCFLAGS="-D warnings" cargo +stable doc --all-features
fi
# Fuzz if told to

View File

@ -57,8 +57,14 @@ if [ "$DO_SCHEMARS_TESTS" = true ]; then
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
fi
# Build the docs with a stable toolchain, in unison with the DO_DOCSRS command
# above this checks that we feature guarded docs imports correctly.
if [ "$DO_DOCS" = true ]; then
RUSTDOCFLAGS="--cfg docsrs" cargo doc --features="$FEATURES"
RUSTDOCFLAGS="-D warnings" cargo +stable doc --all-features
fi
# Webassembly stuff