Fix missing stylesheet link; deploy-time asset smoke checks
This commit is contained in:
parent
fd55ac8837
commit
17f2070e7b
2 changed files with 18 additions and 0 deletions
|
|
@ -67,6 +67,7 @@ def layout(title, desc, body, path='/', extra_head=''):
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:type" content="website">
|
||||||
<meta property="og:url" content="{SITE_URL}{esc(path)}">
|
<meta property="og:url" content="{SITE_URL}{esc(path)}">
|
||||||
<meta name="twitter:card" content="summary">
|
<meta name="twitter:card" content="summary">
|
||||||
|
<link rel="stylesheet" href="/static/style.css">
|
||||||
<style>:root{{--brand:#e4572e;--brand2:#f5a623;--ink:#2b2118;--cream:#fff8ec;--card:#ffffff}}</style>
|
<style>:root{{--brand:#e4572e;--brand2:#f5a623;--ink:#2b2118;--cream:#fff8ec;--card:#ffffff}}</style>
|
||||||
{extra_head}
|
{extra_head}
|
||||||
</head>
|
</head>
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,21 @@ for host in bestdadjokes.lol www.bestdadjokes.lol myadhd.dev; do
|
||||||
code=$(curl -sk -o /dev/null -w '%{http_code}' --resolve "$host:443:127.0.0.1" "https://$host/" --max-time 10)
|
code=$(curl -sk -o /dev/null -w '%{http_code}' --resolve "$host:443:127.0.0.1" "https://$host/" --max-time 10)
|
||||||
echo " https://$host -> $code (origin)"
|
echo " https://$host -> $code (origin)"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "==> asset smoke checks"
|
||||||
|
fail=0
|
||||||
|
hp=$(curl -sk --resolve bestdadjokes.lol:443:127.0.0.1 https://bestdadjokes.lol/ --max-time 10)
|
||||||
|
echo "$hp" | grep -q 'rel="stylesheet"' || { echo " FAIL: stylesheet not linked in homepage"; fail=1; }
|
||||||
|
for asset in /static/style.css /static/main.js /static/jokes-data.js /static/favicon.svg; do
|
||||||
|
out=$(curl -sk -o /dev/null -w '%{http_code} %{content_type}' --resolve bestdadjokes.lol:443:127.0.0.1 "https://bestdadjokes.lol$asset" --max-time 10)
|
||||||
|
echo " $asset -> $out"
|
||||||
|
case "$out" in 200*) ;; *) fail=1 ;; esac
|
||||||
|
done
|
||||||
|
# every referenced local asset must exist (catches missing files)
|
||||||
|
echo "$hp" | grep -oE '(src|href)="/[^"]+"' | sed -E 's/(src|href)="([^"]+)"/\2/' | sort -u | while read -r ref; do
|
||||||
|
case "$ref" in //*) continue ;; esac
|
||||||
|
code=$(curl -sk -o /dev/null -w '%{http_code}' --resolve bestdadjokes.lol:443:127.0.0.1 "https://bestdadjokes.lol$ref" --max-time 10)
|
||||||
|
[ "$code" = "200" ] || echo " WARN: referenced asset $ref -> $code"
|
||||||
|
done
|
||||||
|
[ "$fail" = "0" ] || { echo "==> DEPLOY FAILED ASSET CHECKS"; exit 1; }
|
||||||
echo "==> deploy complete"
|
echo "==> deploy complete"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue