2022-06-16 02:43:01 +00:00
|
|
|
#!/usr/bin/env dash
|
|
|
|
|
|
|
|
set -e -u
|
|
|
|
|
|
|
|
# the name of this program
|
|
|
|
progname="$(basename "${0}")"
|
|
|
|
|
2022-06-20 21:27:54 +00:00
|
|
|
help_text="Usage: $progname [OPTIONS...] [BASEURL]
|
2022-06-16 02:43:01 +00:00
|
|
|
|
|
|
|
Validate the site's markup, CSS, and accessibility.
|
|
|
|
|
|
|
|
Uses xmllint to to check well-formedness and the Nu HTML Checker to
|
|
|
|
check (X)HTML5 and CSS validity on every markup file (inc. HTML, XHTML,
|
|
|
|
SVG). (xmllint is only relevant if you're using XML syntax).
|
|
|
|
|
|
|
|
Lints source CSS files with stylelint.
|
|
|
|
|
|
|
|
Uses both axe-core and the IBM Equal Access Checker to test
|
|
|
|
accessibility on every page in the sitemap.
|
|
|
|
|
|
|
|
Options:
|
|
|
|
-h Print this help and exit
|
2022-06-20 21:27:54 +00:00
|
|
|
-j Max parallel jobs. Default: 2
|
2022-06-16 02:43:01 +00:00
|
|
|
"
|
|
|
|
|
|
|
|
# TODO: add the following:
|
2022-06-18 05:09:32 +00:00
|
|
|
# - validate JSON schema (web app manifest, webfinger)
|
2022-06-16 02:43:01 +00:00
|
|
|
|
|
|
|
usage() {
|
|
|
|
printf '%s' "${help_text}"
|
|
|
|
}
|
|
|
|
|
|
|
|
# when the user passess bad args, send a msg to stderr and exit
|
|
|
|
# usage: bad_option <option> <reason>
|
|
|
|
bad_option() {
|
|
|
|
echo "${progname}: option ${1}: ${2}" >&2
|
|
|
|
usage >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2022-06-20 21:27:54 +00:00
|
|
|
jobs='2'
|
|
|
|
|
|
|
|
while getopts "hj" flags; do
|
2022-06-16 02:43:01 +00:00
|
|
|
case ${flags} in
|
|
|
|
h)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
2022-06-20 21:27:54 +00:00
|
|
|
j)
|
|
|
|
jobs="$1"
|
|
|
|
shift
|
|
|
|
;;
|
2022-06-16 02:43:01 +00:00
|
|
|
*)
|
|
|
|
bad_option "${flags}" 'invalid option'
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2022-06-18 05:09:32 +00:00
|
|
|
base_url="${1-http://localhost:8089}"
|
|
|
|
|
2022-06-18 03:36:35 +00:00
|
|
|
# HTML validation is already parallelized, so run that single-threaded.
|
2022-06-17 00:19:23 +00:00
|
|
|
make -j1 HUGO_FLAGS=-DF HUGO_BASEURL="$base_url" clean hugo xhtmlize validate-html
|
2022-08-06 05:49:18 +00:00
|
|
|
make -j "$jobs" -f Makefile.online HUGO_BASEURL="$base_url" all-extra URLS="$(curl -sSL "$base_url/sitemap.xml" | htmlq loc -t | rg -v '/search/$' | tr '\n' ' ')" &
|
|
|
|
make deploy-staging RSYNCFLAGS_EXTRA=-q
|
|
|
|
wait
|
2022-08-02 03:53:48 +00:00
|
|
|
make -f Makefile.online hint-online URLS="$(curl -sSL --compressed https://staging.seirdy.one/sitemap.xml | htmlq loc -t | rg -v '/(?:search|wcag-is-a-starting-point)/$' | sort | tr '\n' ' ')"
|
2022-07-18 03:01:54 +00:00
|
|
|
# TODO: run lighthouse on every page in the sitemap.
|
2022-06-16 02:43:01 +00:00
|
|
|
|
|
|
|
# vi:ft=sh
|