Skip to content

Commit 4ca0c0e

Browse files
committed
Check for broken links in CI test job
1 parent b4e39af commit 4ca0c0e

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

Gemfile

+4
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@ source 'https://rubygems.org'
44
gem 'jekyll', '~> 4.2.1'
55
gem 'jekyll-redirect-from'
66

7+
# html-proofer checks for broken links.
8+
# used in docker-compose.yml test job
9+
gem 'html-proofer'
10+
711
gem "webrick", "~> 1.7"

docker-compose.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ services:
4040

4141
test:
4242
<<: *common
43-
command: /bin/bash -cl "
44-
bundle check
45-
&& bundle exec jekyll doctor --source /srv/jekyll --destination /output
46-
&& bundle exec jekyll build --source /srv/jekyll --destination /output"
43+
command: /bin/bash -cl "/code/scripts/test.sh"
44+
volumes:
45+
- .:/srv/jekyll:cached
46+
- ./.output:/output:z
47+
- .:/code:z
4748

4849
website:
4950
<<: *common

scripts/test.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
set -eu
2+
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3+
cd "$here/.."
4+
5+
bundle check
6+
bundle exec jekyll doctor --source /srv/jekyll --destination /output
7+
bundle exec jekyll build --source /srv/jekyll --destination /output
8+
9+
# This line runs broken link checks: https://github.com/gjtorikian/html-proofer
10+
bundle exec htmlproofer \
11+
--ignore-status-codes "429" \
12+
--only_4xx \
13+
--ignore-urls twitter.com \
14+
/output

0 commit comments

Comments
 (0)