Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ before_install:
install:
- source ~/.cargo/env || true
- cargo install mdbook --version '^0.4.3'
- cargo install mdbook-linkcheck --version '^0.7.0'
- cargo install mdbook-linkcheck --git https://github.com/Michael-F-Bryan/mdbook-linkcheck --rev 14441d77646d58cea8ffc32fde9ea33b2bedb1a2
script:
- git checkout -b ci
- git rebase origin/master
Expand Down
1 change: 1 addition & 0 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enable = true
level = 0

[output.linkcheck]
command = "../../ci/linkcheck.sh"
follow-web-links = true
exclude = [ "crates\\.io", "gcc\\.godbolt\\.org", "youtube\\.com", "youtu\\.be", "dl\\.acm\\.org", "cs\\.bgu\\.ac\\.il", "www\\.amazon\\.com", "www\\.rustaceans\\.org" ]
cache-timeout = 86400
Expand Down
29 changes: 29 additions & 0 deletions ci/linkcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -ev
set -o pipefail

# https://docs.travis-ci.com/user/environment-variables/#default-environment-variables
if [ "$TRAVIS_EVENT_TYPE" = "cron" ] ; then # running in cron job
FLAGS=""

echo "Doing full link check."
elif [ "$CI" = "true" ] ; then # running in PR CI build
if [ -z "$TRAVIS_COMMIT_RANGE" ]; then
echo "error: unexpected state: TRAVIS_COMMIT_RANGE must be non-empty in CI"
exit 1
fi

CHANGED_FILES=$(git diff --name-only $TRAVIS_COMMIT_RANGE | tr '\n' ' ')
FLAGS="-f $CHANGED_FILES"

echo "Checking files changed in $TRAVIS_COMMIT_RANGE: $CHANGED_FILES"
else # running locally
COMMIT_RANGE=master...
CHANGED_FILES=$(git diff --name-only $COMMIT_RANGE | tr '\n' ' ')
FLAGS="-f $CHANGED_FILES"

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

exec mdbook-linkcheck $FLAGS -- $TRAVIS_BUILD_DIR