1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-10 00:12:09 +00:00

Internal: custom number of paralle site-check jobs

This commit is contained in:
Rohan Kumar 2022-06-20 14:27:54 -07:00
parent 9f681f9c0d
commit 1f4a6d7b24
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479

View file

@ -5,7 +5,7 @@ set -e -u
# the name of this program
progname="$(basename "${0}")"
help_text="Usage: $progname [BASEURL]
help_text="Usage: $progname [OPTIONS...] [BASEURL]
Validate the site's markup, CSS, and accessibility.
@ -20,6 +20,7 @@ accessibility on every page in the sitemap.
Options:
-h Print this help and exit
-j Max parallel jobs. Default: 2
"
# TODO: add the following:
@ -37,12 +38,18 @@ bad_option() {
exit 1
}
while getopts "hb" flags; do
jobs='2'
while getopts "hj" flags; do
case ${flags} in
h)
usage
exit 0
;;
j)
jobs="$1"
shift
;;
*)
bad_option "${flags}" 'invalid option'
exit 1
@ -54,6 +61,6 @@ base_url="${1-http://localhost:8089}"
# HTML validation is already parallelized, so run that single-threaded.
make -j1 HUGO_FLAGS=-DF HUGO_BASEURL="$base_url" clean hugo xhtmlize validate-html
make -j2 -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 -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' ' ')"
# vi:ft=sh