Skip to content

Commit 2022b0c

Browse files
committed
[ci] use cargo deadlinks to check for dead links
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.
1 parent 52705df commit 2022b0c

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,17 @@ jobs:
277277
export RUSTDOCFLAGS="${{ matrix.toolchain == 'nightly' && '-Z unstable-options --document-hidden-items' || '' }} $RUSTDOCFLAGS $METADATA_DOCS_RS_RUSTDOC_ARGS"
278278
./cargo.sh +${{ matrix.toolchain }} doc --document-private-items --package ${{ matrix.crate }} ${{ matrix.features }}
279279
280+
- name: Check dead links
281+
run: |
282+
cargo install -q cargo-deadlinks --version 0.8.1
283+
METADATA_DOCS_RS_RUSTDOC_ARGS="$(cargo metadata --format-version 1 | \
284+
jq -r ".packages[] | select(.name == \"zerocopy\").metadata.docs.rs.\"rustdoc-args\".[]" | tr '\n' ' ')"
285+
# Nearly identical to the above `cargo doc` invocation, but invoking
286+
# `cargo deadlinks` instead.
287+
export RUSTDOCFLAGS="$RUSTDOCFLAGS $METADATA_DOCS_RS_RUSTDOC_ARGS"
288+
./cargo.sh +${{ matrix.toolchain }} deadlinks --check-intra-doc-links -- --no-deps --document-private-items --package ${{ matrix.crate }} ${{ matrix.features }}
289+
if: matrix.toolchain == 'nightly'
290+
280291
# Check semver compatibility with the most recently-published version on
281292
# crates.io. We do this in the matrix rather than in its own job so that it
282293
# gets run on different targets. Some of our API is target-specific (e.g.,
@@ -412,11 +423,12 @@ jobs:
412423
# in parallel.
413424
#
414425
# [1] https://stackoverflow.com/a/42139535/836390
415-
cargo check --workspace --tests &> /dev/null &
416-
cargo metadata &> /dev/null &
417-
cargo install cargo-readme --version 3.2.0 &> /dev/null &
418-
cargo install --locked kani-verifier &> /dev/null &
419-
cargo kani setup &> /dev/null &
426+
cargo check --workspace --tests &> /dev/null &
427+
cargo metadata &> /dev/null &
428+
cargo install cargo-readme --version 3.2.0 &> /dev/null &
429+
cargo install cargo-deadlinks --version 0.8.1 &> /dev/null &
430+
cargo install --locked kani-verifier &> /dev/null &
431+
cargo kani setup &> /dev/null &
420432
421433
wait
422434

0 commit comments

Comments
 (0)