Skip to content

Commit 4116f28

Browse files
committed
fix: update htmltest sanity check for new deploy
1 parent 4f6c704 commit 4116f28

File tree

5 files changed

+37
-32
lines changed

5 files changed

+37
-32
lines changed

.agent/working-memory/session.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@
1515
- Deploy method: `actions/upload-pages-artifact` + `actions/deploy-pages` (OIDC, no branch write)
1616
- **No `main` branch is used for deployment.** The old `peaceiris/actions-gh-pages` approach that pushed to `main` has been replaced. The `main` branch is obsolete.
1717
- Required repo setting: Settings → Pages → Source must be **GitHub Actions** (not "Deploy from a branch").
18+
19+
## CI troubleshooting (updated 2026-03-29)
20+
21+
- Hugo module/cache paths inside the container must resolve to absolute directories for the current CI image/version.
22+
- For Docker Compose workflows, use separate variables for host and container cache paths:
23+
- host path for GitHub Actions cache: `./.hugo_cache`
24+
- container path for Hugo `--cacheDir`: `/src/.hugo_cache`
25+
- Running the container as `--user "$(id -u):$(id -g)"` avoids root-owned workspace files, but it also means default cache locations like `/cache/modules` may be unwritable.

.github/workflows/gh-pages.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ jobs:
2525
build:
2626
runs-on: ubuntu-latest
2727
env:
28-
HUGO_CACHEDIR: ./.hugo_cache
28+
HUGO_CACHE_HOST_DIR: ./.hugo_cache
29+
HUGO_CACHE_CONTAINER_DIR: /src/.hugo_cache
2930
steps:
3031
- name: Checkout
3132
uses: actions/checkout@v4
@@ -43,7 +44,7 @@ jobs:
4344
- name: Restore build cache
4445
uses: actions/cache/restore@v4
4546
with:
46-
path: ${{ env.HUGO_CACHEDIR }}
47+
path: ${{ env.HUGO_CACHE_HOST_DIR }}
4748
key: hugo-${{ runner.os }}-${{ github.run_id }}
4849
restore-keys: |
4950
hugo-${{ runner.os }}-
@@ -54,17 +55,20 @@ jobs:
5455
run: |
5556
docker compose build --pull hugo
5657
docker compose run --rm --no-deps \
58+
--entrypoint sh \
5759
--user "$(id -u):$(id -g)" \
60+
-e HOME=/tmp \
61+
-e npm_config_cache=/tmp/.npm \
5862
-e HUGO_ENV=production \
59-
-e HUGO_CACHEDIR="${HUGO_CACHEDIR}" \
63+
-e HUGO_CACHEDIR="${HUGO_CACHE_CONTAINER_DIR}" \
6064
-e BASE_URL="${BASE_URL}" \
61-
hugo sh -lc 'git config --global --add safe.directory /src && git config --global core.quotepath false && hugo build --gc --minify --baseURL "${BASE_URL%/}/" --cacheDir "${HUGO_CACHEDIR}"'
65+
hugo -lc 'git config --global --add safe.directory /src && git config --global core.quotepath false && hugo build --gc --minify --baseURL "${BASE_URL%/}/" --cacheDir "${HUGO_CACHEDIR}"'
6266
6367
- name: Save build cache
6468
if: always()
6569
uses: actions/cache/save@v4
6670
with:
67-
path: ${{ env.HUGO_CACHEDIR }}
71+
path: ${{ env.HUGO_CACHE_HOST_DIR }}
6872
key: hugo-${{ runner.os }}-${{ github.run_id }}
6973

7074
- name: Upload artifact

.github/workflows/run-htmltest.yml

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,43 @@ on:
44
branches: [ "develop" ]
55
pull_request:
66
branches: [ "develop" ]
7+
workflow_dispatch:
78

89
jobs:
910
htmltest:
1011
runs-on: ubuntu-latest
12+
env:
13+
HUGO_CACHE_HOST_DIR: ./.hugo_cache
14+
HUGO_CACHE_CONTAINER_DIR: /src/.hugo_cache
1115
steps:
1216
- uses: actions/checkout@v4
13-
14-
- name: Read .env hugo version
15-
id: hugo-version
16-
run: |
17-
. ./.env
18-
echo "::set-output name=HUGO_VERSION::${HUGO_VERSION}"
19-
echo "::set-output name=DOCSY_VERSION::${DOCSY_VERSION}"
20-
21-
- name: Add hugo nodejs dependencies
22-
uses: actions/setup-node@v4
2317
with:
24-
node-version: "18"
25-
cache: 'npm'
18+
fetch-depth: 0
2619

27-
- name: Setup Hugo
28-
uses: peaceiris/actions-hugo@v3
29-
with:
30-
# sync versions with docker-compose .env ala
31-
# https://github.com/marketplace/actions/hugo-setup#%EF%B8%8F-read-hugo-version-from-file
32-
hugo-version: "${{ steps.hugo-version.outputs.HUGO_VERSION }}"
33-
extended: true
34-
35-
- name: Build Hugo site
20+
- name: Build Hugo site in Docker Compose
3621
env:
3722
HUGO_ENV: "production"
3823
run: |
39-
npm install
40-
hugo --minify --gc -d $GITHUB_WORKSPACE/dist
24+
docker compose build --pull hugo
25+
docker compose run --rm --no-deps \
26+
--entrypoint sh \
27+
--user "$(id -u):$(id -g)" \
28+
-e HOME=/tmp \
29+
-e npm_config_cache=/tmp/.npm \
30+
-e HUGO_CACHEDIR="${HUGO_CACHE_CONTAINER_DIR}" \
31+
-e HUGO_ENV="${HUGO_ENV}" \
32+
hugo -lc 'git config --global --add safe.directory /src && git config --global core.quotepath false && hugo build --gc --minify --cacheDir "${HUGO_CACHEDIR}" -d /src/dist'
33+
4134
- name: run htmltest
4235
continue-on-error: true
4336
uses: wjdp/htmltest-action@master
4437
with:
4538
config: .htmltest.yml
39+
4640
- name: archive htmltest results
41+
if: always()
4742
uses: actions/upload-artifact@v4
4843
with:
4944
name: htmltest-report
50-
path: tmp/.htmltest/htmltest.log
45+
path: tmp/.htmltest/
5146
retention-days: 5

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ USER root
1010
RUN git config --global --add safe.directory /src
1111

1212
# Install Node.js and npm for PostCSS (required by Docsy)
13-
RUN apk add --no-cache nodejs npm
13+
RUN apk add --no-cache nodejs npm go
1414

1515
# Install front-end tooling.
1616
# Layer is invalidated only when package.json or package-lock.json changes.

hugo.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ module:
4848
# mount ISSUE_TEMPLATE to content/issue_templates to re-use the templates in the site
4949
- source: "content/en"
5050
target: "content"
51-
lang: "en"
5251
- source: ".github/ISSUE_TEMPLATE"
5352
target: "content/issue_templates"
54-
lang: "en"
5553

5654
# Configure how URLs look like per section.
5755
permalinks:

0 commit comments

Comments
 (0)