From f885af9e835b064c71a49cf36cbc707856dd3e1b Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Fri, 15 May 2026 20:18:26 +0700 Subject: [PATCH] fix(ci): unbreak smoke + htmltest steps post v0.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three independent CI failures from run 25916500415: 1. Smoke test [linkToSection aria-label] fail on Hugo 0.146 leg. The assertion pinned to $post selected via `find ... | head -1`, which on 0.146 picked `doc-sach-quan-sat/index.html` — a post with zero h2/h3/h4 headings, so zero heading-anchor markup. Rewrite the check to scan all built post HTML (same pattern already in use for render-link rel). Now reports 13 matches on the demo build. 2. htmltest URLSwap silently never matched. The prior `^/tsuki/: /` config (added in d30f50f) used a regex anchor that doesn't match htmltest's substring evaluation against minified `href=/tsuki/...` attributes. Switch to the unanchored `"/tsuki/": /` form. CI has been failing on this since v0.2.0 despite the "fix" commit; this is the real fix. 3. head.html referenced `/favicon.ico` and `/favicon.svg` but neither asset existed in exampleSite/static/. Add a minimal SVG favicon, drop the legacy .ico reference (modern browsers fall back to a site-rooted /favicon.ico by convention; sites needing one can override head.html). Switch the SVG link to `relURL` so the `/tsuki/` baseURL prefix is honoured under GitHub Pages subpath deploy. Local validation: all 32 smoke checks green; favicon resolves to `/tsuki/favicon.svg` and ships in the build artifact. --- themes/tsuki/.htmltest.yml | 7 ++++++- themes/tsuki/exampleSite/static/favicon.svg | 1 + themes/tsuki/layouts/_partials/head.html | 5 ++--- themes/tsuki/scripts/smoke-tests.sh | 11 ++++++++++- 4 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 themes/tsuki/exampleSite/static/favicon.svg diff --git a/themes/tsuki/.htmltest.yml b/themes/tsuki/.htmltest.yml index 33b0149..b1b325c 100644 --- a/themes/tsuki/.htmltest.yml +++ b/themes/tsuki/.htmltest.yml @@ -5,8 +5,13 @@ IgnoreInternalEmptyHash: true IgnoreEmptyHref: false EnforceHTML5: true # Strip the /tsuki/ baseURL prefix so links resolve against exampleSite/public/. +# htmltest's URLSwap is a regex substring match (not anchored), so the leading +# "^" used previously silently failed against the minified `href=/tsuki/...` +# outputs in built HTML — every link reported missing. Quoted plain-prefix form +# matches whatever position /tsuki/ appears in the href, which for our build is +# always at the start of relative URLs. URLSwap: - ^/tsuki/: / + "/tsuki/": / IgnoreURLs: - "^https://giscus.app" - "^https://github.com/" diff --git a/themes/tsuki/exampleSite/static/favicon.svg b/themes/tsuki/exampleSite/static/favicon.svg new file mode 100644 index 0000000..af447f3 --- /dev/null +++ b/themes/tsuki/exampleSite/static/favicon.svg @@ -0,0 +1 @@ + diff --git a/themes/tsuki/layouts/_partials/head.html b/themes/tsuki/layouts/_partials/head.html index 7bac76e..1c5fe16 100644 --- a/themes/tsuki/layouts/_partials/head.html +++ b/themes/tsuki/layouts/_partials/head.html @@ -49,9 +49,8 @@ {{- end }} {{- end }} -{{/* Favicon */}} - - +{{/* Favicon — SVG only; sites can override head.html to add an .ico fallback */}} + {{/* Speculation Rules — Chromium prefetch hints; gated, off by default */}} {{- $prefetch := site.Params.prefetch -}} diff --git a/themes/tsuki/scripts/smoke-tests.sh b/themes/tsuki/scripts/smoke-tests.sh index 49a616e..86919b4 100755 --- a/themes/tsuki/scripts/smoke-tests.sh +++ b/themes/tsuki/scripts/smoke-tests.sh @@ -70,7 +70,16 @@ assert "BreadcrumbList JSON-LD" '"@type":"BreadcrumbList"' "$p assert "no breadcrumbs on home" 'class=breadcrumbs' "$home" 0 assert "prev/next nav" 'class=prev-next' "$post" assert "rel=prev on post" 'rel=prev' "$post" -assert "linkToSection aria-label" 'class=heading-anchor [^>]*aria-label' "$post" +# Heading-anchor i18n aria-label must appear somewhere in the build. Pinning to one +# post is fragile because `$post` is picked by `find | head -1` and short posts +# without h2/h3/h4 emit no heading-anchor markup. +anchor_count=$({ grep -roE 'class=heading-anchor [^>]*aria-label' "$public_dir" --include='index.html' || true; } | wc -l) +if [ "$anchor_count" -lt 1 ]; then + echo "::error::FAIL [linkToSection aria-label] expected ≥1 heading-anchor + aria-label across build, got 0" + fail=1 +else + echo " ok [linkToSection aria-label] ${anchor_count} match(es) across $public_dir" +fi assert "no speculationrules by default" 'speculationrules' "$home" 0 # llm.txt artifact