Skip to content

Commit

Permalink
Check for broken links in CI test job
Browse files Browse the repository at this point in the history
  • Loading branch information
natikgadzhi committed Aug 26, 2023
1 parent b4e39af commit 4ca0c0e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ source 'https://rubygems.org'
gem 'jekyll', '~> 4.2.1'
gem 'jekyll-redirect-from'

# html-proofer checks for broken links.
# used in docker-compose.yml test job
gem 'html-proofer'

gem "webrick", "~> 1.7"
9 changes: 5 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ services:

test:
<<: *common
command: /bin/bash -cl "
bundle check
&& bundle exec jekyll doctor --source /srv/jekyll --destination /output
&& bundle exec jekyll build --source /srv/jekyll --destination /output"
command: /bin/bash -cl "/code/scripts/test.sh"
volumes:
- .:/srv/jekyll:cached
- ./.output:/output:z
- .:/code:z

website:
<<: *common
Expand Down
14 changes: 14 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set -eu
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$here/.."

bundle check
bundle exec jekyll doctor --source /srv/jekyll --destination /output
bundle exec jekyll build --source /srv/jekyll --destination /output

# This line runs broken link checks: https://github.com/gjtorikian/html-proofer
bundle exec htmlproofer \
--ignore-status-codes "429" \
--only_4xx \
--ignore-urls twitter.com \
/output

0 comments on commit 4ca0c0e

Please sign in to comment.