Skip to content

Commit

Permalink
Improve test coverage for docs build
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tcharding committed Dec 31, 2022
1 parent aadce3e commit fb23a94
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion bitcoin/contrib/test.sh
Expand Up @@ -80,10 +80,17 @@ 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_DOCS" = true ]; then
if [ "$DO_DOCSRS" = true ]; then
# We use rustdoc so that we can check for broken links.
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly rustdoc --all-features -- -D rustdoc::broken-intra-doc-links -D warnings
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
cargo +stable doc --all-features
fi

# Fuzz if told to
if [ "$DO_FUZZ" = true ]
then
Expand Down
9 changes: 8 additions & 1 deletion hashes/contrib/test.sh
Expand Up @@ -55,8 +55,15 @@ 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
# We use rustdoc so that we can check for broken links.
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly rustdoc --all-features -- -D rustdoc::broken-intra-doc-links -D warnings
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"
cargo +stable doc --all-features
fi

# Webassembly stuff
Expand Down

0 comments on commit fb23a94

Please sign in to comment.