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
Improve test coverage for docs build #1505
Conversation
bitcoin/contrib/test.sh
Outdated
# 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 | ||
# This, in unison with the command above, checks that we feature guarded docs imports correctly. | ||
cargo +nightly doc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're doing this we should still have all features and deny warnings, just docsrs
disabled. And probably test it on stable instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and face palm for --all-features
and deny warnings. For test on stable, seems reasonably, will require more thinking though since DO_DOCS
is only run on nightly, perhaps we need to agree on what is expected from each toolchain since this is similar to the discussion on features only working on some toolchains (#1498 (comment))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just adding +stable
should work? It's a bit ugly hack, yes. Or just split it up into DO_DOCSRS
and DO_DOCS
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm missing something the stable
toolchain won't be installed on the VM when we use DO_DOCS
. I used your DO_DOCSRS
idea, adding a DO_DOCS
for stable builds.
hashes/contrib/test.sh
Outdated
# 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 | ||
# This, in unison with the command above, checks that we feature guarded docs imports correctly. | ||
cargo +nightly doc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
553d139
to
69571bd
Compare
@apoelstra if this merges it will likely mean you have to modify your test scripts if you are testing docs builds locally before merging. |
69571bd
to
43e3d2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 43e3d2b
Didn't notice cargo +stable doc
vs cargo doc +stable
43e3d2b
to
8a6e52a
Compare
My bad, fixed. |
3892d2f
to
44e56f9
Compare
There are conflicts now. |
44e56f9
to
fb23a94
Compare
Rebase only, no other changes. |
Thanks for the heads up! I'm not currently testing docs but I should start. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK fb23a94
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this contain changes to CI?
fb23a94
to
2235e7e
Compare
Oops, thanks man. Now includes CI changes. |
19bf3ac
to
48df5ad
Compare
Now includes additional patch to fix docs build warnings. |
bitcoin/contrib/test.sh
Outdated
if [ "$DO_DOCS" = true ]; then | ||
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly rustdoc --all-features -- -D rustdoc::broken-intra-doc-links -D warnings || exit 1 | ||
cargo +stable doc --all-features |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this have -D warnings
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-D warnings
is a cargo rustdoc
option not a cargo doc
option (I learned while doing this PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can still put it into RUSTDOCFLAGS
. cargo doc
literally runs rustdoc
inside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL, that's awesome I didn't realise. I changed both invocations to use cargo doc
to make it uniform. While testing I noticed we do not have a contrib/test.sh
file for internals
, will add.
48df5ad
to
6dfacd1
Compare
Looks like #1545 must go in first. |
We already use `set -ex`, adding an explicit exit on command fail is redundant.
Cargo emits various warnings when building the docs: warning: this URL is not a hyperlink As suggested, add angle brackets to create automatic links.
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.
6dfacd1
to
41f2dcf
Compare
Rebase only, no other changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 6dfacd1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 41f2dcf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 41f2dcf
Currently the docs build commands in
hashes
andbitcoin
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 runscargo rustdoc
with custom compiler conditional set we didn't catch it.Done after seeing: #1504 and CI should fail on this PR until 1504 is in.