Skip to content

Commit

Permalink
[ci] use cargo deadlinks to check for dead links
Browse files Browse the repository at this point in the history
Since `cargo deadlinks` is just a link-checking wrapper around
`cargo doc`, we can simply replace our `doc` invocation with
`deadlinks` to get the benefits of both.
  • Loading branch information
jswrenn committed Mar 5, 2024
1 parent 52705df commit fffaaef
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,15 @@ jobs:
# --document-hidden-items is unstable; if a future release breaks or removes it,
# we can just update CI to no longer pass that flag.
run: |
cargo install -q cargo-deadlinks --version 0.8.1
# Include arguments passed during docs.rs deployments to make sure those
# work properly.
METADATA_DOCS_RS_RUSTDOC_ARGS="$(cargo metadata --format-version 1 | \
jq -r ".packages[] | select(.name == \"zerocopy\").metadata.docs.rs.\"rustdoc-args\".[]" | tr '\n' ' ')"
# We invoke `cargo deadlinks` instead of `cargo doc`; `cargo deadlinks`
# is a link-checking wrapper around `cargo doc`.
export RUSTDOCFLAGS="${{ matrix.toolchain == 'nightly' && '-Z unstable-options --document-hidden-items' || '' }} $RUSTDOCFLAGS $METADATA_DOCS_RS_RUSTDOC_ARGS"
./cargo.sh +${{ matrix.toolchain }} doc --document-private-items --package ${{ matrix.crate }} ${{ matrix.features }}
./cargo.sh +${{ matrix.toolchain }} deadlinks --check-intra-doc-links -- --document-private-items --package ${{ matrix.crate }} ${{ matrix.features }}
# Check semver compatibility with the most recently-published version on
# crates.io. We do this in the matrix rather than in its own job so that it
Expand Down Expand Up @@ -412,11 +415,12 @@ jobs:
# in parallel.
#
# [1] https://stackoverflow.com/a/42139535/836390
cargo check --workspace --tests &> /dev/null &
cargo metadata &> /dev/null &
cargo install cargo-readme --version 3.2.0 &> /dev/null &
cargo install --locked kani-verifier &> /dev/null &
cargo kani setup &> /dev/null &
cargo check --workspace --tests &> /dev/null &
cargo metadata &> /dev/null &
cargo install cargo-readme --version 3.2.0 &> /dev/null &
cargo install cargo-deadlinks --version 0.8.1 &> /dev/null &
cargo install --locked kani-verifier &> /dev/null &
cargo kani setup &> /dev/null &
wait
Expand Down

0 comments on commit fffaaef

Please sign in to comment.