Skip to content

fix(ci): regenerate gitignored CSS before unit-test Hugo build - #2922

Merged
jung-thomas merged 1 commit into
DEVfrom
fix/unit-tests-css-gen
Oct 25, 2026
Merged

jung-thomas merged 1 commit into
DEVfrom
fix/unit-tests-css-gen

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Problem

Unit tests are red in CI. 7 test files fail, all downstream of test/unit/hugo-homepage-partials.test.ts, which spawns a real Hugo build that exits 1 with:

head.html:27:64 at <minify>: wrong type for value; expected resources.ResourceTransformer; got resource.Resource

Root cause

hugo/layouts/partials/head.html:27 runs resources.Get "css/fundamental-styles-icon.css" | minify | fingerprint. Commit ac6b7e39f ("stop committing generated CSS so deploy & rebuild agree on fingerprint") moved sap-fundamental.css and fundamental-styles-icon.css to gitignored build outputs — absent on a fresh checkout.

rebuild-content.yml / rebuild-content-qa.yml were updated to regenerate them before their Hugo build, but unit-tests.yml was not. So resources.Get misses the asset, minify receives a non-transformable resource.Resource, and the build fails.

Fix

Add a build:icon-subset + build:css step before npm test, mirroring the existing rebuild workflows.

Verification

  • Main checkout, assets deleted → hugo --source hugo/ exits 1, 4 ResourceTransformer errors (reproduces the bug).
  • After build:icon-subset + build:css → Hugo exits 0, 0 errors.
  • vitest run test/unit/hugo-homepage-partials.test.ts → 4 passed.

test/unit/hugo-homepage-partials.test.ts spawns a real Hugo build.
head.html:27 does `resources.Get "css/fundamental-styles-icon.css" |
minify | fingerprint`. Since ac6b7e3 stopped committing the generated
CSS (sap-fundamental.css, fundamental-styles-icon.css are now gitignored
build outputs), these assets are absent on a fresh checkout. unit-tests.yml
never regenerated them, so resources.Get missed the asset, minify got a
non-transformable resource.Resource, and the Hugo build exited 1 — failing
7 test files.

rebuild-content.yml already regenerates these before its Hugo build; this
mirrors that step (build:icon-subset + build:css) before npm test.

Verified: without the assets Hugo exits 1 (4 minify errors); after the two
gen steps Hugo exits 0 and hugo-homepage-partials.test.ts passes 4/4.
@jung-thomas
jung-thomas merged commit 676f613 into DEV Oct 25, 2026
4 checks passed
@jung-thomas
jung-thomas deleted the fix/unit-tests-css-gen branch October 25, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant