Skip to content

Commit

Permalink
Start using mdbook-linkcheck2 (rust-lang#2103)
Browse files Browse the repository at this point in the history
  • Loading branch information
marxin authored Dec 28, 2024
1 parent 5f32a38 commit 0d9aca4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: 0.4.21
MDBOOK_LINKCHECK_VERSION: 0.7.6
MDBOOK_LINKCHECK2_VERSION: 0.8.1
MDBOOK_MERMAID_VERSION: 0.12.6
MDBOOK_TOC_VERSION: 0.11.2
DEPLOY_DIR: book/html
Expand All @@ -33,7 +33,7 @@ jobs:
with:
path: |
~/.cargo/bin
key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}--${{ env.MDBOOK_MERMAID_VERSION }}
key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK2_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}--${{ env.MDBOOK_MERMAID_VERSION }}

- name: Cache linkcheck
uses: actions/cache@v4
Expand All @@ -52,7 +52,7 @@ jobs:
if: steps.mdbook-cache.outputs.cache-hit != 'true'
run: |
cargo install mdbook --version ${{ env.MDBOOK_VERSION }}
cargo install mdbook-linkcheck --version ${{ env.MDBOOK_LINKCHECK_VERSION }}
cargo install mdbook-linkcheck2 --version ${{ env.MDBOOK_LINKCHECK2_VERSION }}
cargo install mdbook-toc --version ${{ env.MDBOOK_TOC_VERSION }}
cargo install mdbook-mermaid --version ${{ env.MDBOOK_MERMAID_VERSION }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ rustdocs][rustdocs].
To build a local static HTML site, install [`mdbook`](https://github.com/rust-lang/mdBook) with:

```
> cargo install mdbook mdbook-linkcheck mdbook-toc mdbook-mermaid
> cargo install mdbook mdbook-linkcheck2 mdbook-toc mdbook-mermaid
```

and execute the following command in the root of the repository:
Expand All @@ -56,7 +56,7 @@ The build files are found in the `book/html` directory.

### Link Validations

We use `mdbook-linkcheck` to validate URLs included in our documentation.
We use `mdbook-linkcheck2` to validate URLs included in our documentation.
`linkcheck` will be run automatically when you build with the instructions in the section above.

### Table of Contents
Expand Down
12 changes: 3 additions & 9 deletions ci/linkcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ if [ "$GITHUB_EVENT_NAME" = "schedule" ] ; then # running in scheduled job

echo "Doing full link check."
elif [ "$GITHUB_EVENT_NAME" = "pull_request" ] ; then # running in PR CI build
echo "*** WARNING: linkcheck temporarily disabled due to bugs ***"
exit 0

if [ -z "$BASE_SHA" ]; then
echo "error: unexpected state: BASE_SHA must be non-empty in CI"
exit 1
Expand All @@ -28,20 +25,17 @@ elif [ "$GITHUB_EVENT_NAME" = "pull_request" ] ; then # running in PR CI build

echo "Checking files changed since $BASE_SHA: $CHANGED_FILES"
else # running locally
echo "*** WARNING: linkcheck temporarily disabled due to bugs ***"
exit 0

COMMIT_RANGE=master...
CHANGED_FILES=$(git diff --name-only $COMMIT_RANGE | sed 's#^src/##' | tr '\n' ' ')
FLAGS="-f $CHANGED_FILES"

echo "Checking files changed in $COMMIT_RANGE: $CHANGED_FILES"
fi

echo "exec mdbook-linkcheck $FLAGS"
echo "exec mdbook-linkcheck2 $FLAGS"
if [ "$USE_TOKEN" = 1 ]; then
config=$(set_github_token)
exec mdbook-linkcheck $FLAGS <<<"$config"
exec mdbook-linkcheck2 $FLAGS <<<"$config"
else
exec mdbook-linkcheck $FLAGS
exec mdbook-linkcheck2 $FLAGS
fi

0 comments on commit 0d9aca4

Please sign in to comment.