change(ci): Fail CI if there are doc warnings (#5683)

* Fail CI if there are doc warnings

* Try a different syntax

* Use an env var

* Fix spacing, add reference

* Allow intra-doc links

* Note that rustdoc settings need to stay in sync
This commit is contained in:
teor 2022-11-23 10:26:03 +10:00 committed by GitHub
parent ae86678034
commit 32b790be7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 5 deletions

View File

@ -36,10 +36,9 @@ rustflags = [
"-Wclippy::unnecessary_cast",
# Incomplete code
"-Wmissing_docs",
"-Wclippy::dbg_macro",
"-Wclippy::todo",
# Manual debugging output.
# Use tracing::trace!() or tracing::debug!() instead.
"-Wclippy::print_stdout",
@ -49,12 +48,18 @@ rustflags = [
# Code styles we want to accept
"-Aclippy::try_err",
# Links in public docs can point to private items.
"-Arustdoc::private_intra_doc_links",
# Panics
"-Wclippy::fallible_impl_from",
"-Wclippy::unwrap_in_result",
# Documentation
"-Wmissing_docs",
# These rustdoc -A and -W settings must be the same as the RUSTDOCFLAGS in:
# https://github.com/ZcashFoundation/zebra/blob/main/.github/workflows/lint.yml#L152
# Links in public docs can point to private items.
"-Arustdoc::private_intra_doc_links",
# TODOs:
# `cargo fix` might help do these fixes,

View File

@ -143,6 +143,13 @@ jobs:
runs-on: ubuntu-latest
needs: changed-files
if: ${{ needs.changed-files.outputs.rust == 'true' }}
# cargo doc doesn't support '-- -D warnings', so we have to add it here
# https://github.com/rust-lang/cargo/issues/8424#issuecomment-774662296
#
# These -A and -W settings must be the same as the rustdoc settings in:
# https://github.com/ZcashFoundation/zebra/blob/main/.cargo/config.toml#L53
env:
RUSTDOCFLAGS: -D warnings -A rustdoc::private_intra_doc_links
steps:
- uses: actions/checkout@v3.1.0