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,7 +36,6 @@ rustflags = [
"-Wclippy::unnecessary_cast", "-Wclippy::unnecessary_cast",
# Incomplete code # Incomplete code
"-Wmissing_docs",
"-Wclippy::dbg_macro", "-Wclippy::dbg_macro",
"-Wclippy::todo", "-Wclippy::todo",
@ -49,13 +48,19 @@ rustflags = [
# Code styles we want to accept # Code styles we want to accept
"-Aclippy::try_err", "-Aclippy::try_err",
# Links in public docs can point to private items.
"-Arustdoc::private_intra_doc_links",
# Panics # Panics
"-Wclippy::fallible_impl_from", "-Wclippy::fallible_impl_from",
"-Wclippy::unwrap_in_result", "-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: # TODOs:
# `cargo fix` might help do these fixes, # `cargo fix` might help do these fixes,
# or add a config.toml to sub-directories which should allow these lints, # or add a config.toml to sub-directories which should allow these lints,

View File

@ -143,6 +143,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: changed-files needs: changed-files
if: ${{ needs.changed-files.outputs.rust == 'true' }} 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: steps:
- uses: actions/checkout@v3.1.0 - uses: actions/checkout@v3.1.0