#! /usr/bin/env bash

set -e # halt script on error

# Builds and checks the website for broken links.

cd ./site

gem install bundler
gem install html-proofer
gem install jekyll -v 4
bundle install
bundle exec jekyll build
htmlproofer ./_site \
    --empty-alt-ignore \
    --assume-extension \
    --allow-missing-href \
    --allow-hash-href \
    --http-status-ignore 429 \
    --typhoeus-config '{"headers": {"User-Agent": "Mozilla/5.0 (Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0"}}' \
    --url-ignore "/www.haproxy.org/,/tools.ietf.org/,/www.envoyproxy.io/,/envoyproxy.io/" # gives false positive timeouts
