Hi folks,
Ever since updating to Hugo over the last weeks (v112) I think, my Github build is randomly failing. Does anyone have a clue of what I might be doing wrong?
Comparing the logs (working vs not working), I see this line is missing when the build fails
Write redirect to main language en: //localhost:1313/en/
The command I execute in a custom Github Action is listed below. I run hugo serve
because I need hugo to be up and running so I can execute Muffet (broken link checker).
hugo server --config hugo.toml --configDir config \
--disableKinds=taxonomy,term,rss,sitemap,robotsTXT --disableBrowserError \
--disableLiveReload --noBuildLock --noChmod --noTimes --watch=false --enableGitInfo=false \
-e development
This is what a broken build looks like (on ubuntu), you will see only one page and one alias is being generated.
Start building sites …
hugo v0.113.0+extended linux/amd64 BuildDate=unknown
INFO 2023/06/12 10:47:46 syncing static files to /
INFO 2023/06/12 10:47:46 process in 67 ms
INFO 2023/06/12 10:47:46 assemble in 79 ms
INFO 2023/06/12 10:47:46 render in 2 ms
INFO 2023/06/12 10:47:46 postProcess in 0 ms
| EN | FR
-------------------+------+-------
Pages | 1 | 0
Paginator pages | 0 | 0
Non-page files | 0 | 0
Static files | 1299 | 1299
Processed images | 0 | 0
Aliases | 0 | 0
Sitemaps | 1 | 0
Cleaned | 0 | 0
Built in 1527 ms
Watching for changes in /home/runner/work/docs/docs/{assets,content,i18n,layouts,package.json,static}
Watching for config changes in /home/runner/work/docs/docs/config/_default
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at //localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
This is what a clean build looks like (on my mac)
Start building sites …
hugo v0.113.0+extended darwin/arm64 BuildDate=unknown
INFO 2023/06/12 11:29:22 syncing static files to /
INFO 2023/06/12 11:29:22 process in 84 ms
INFO 2023/06/12 11:29:22 assemble in 133 ms
DEBUG 2023/06/12 11:29:28 Write redirect to main language en: //localhost:1313/en/
INFO 2023/06/12 11:29:28 render in 6531 ms
INFO 2023/06/12 11:29:28 postProcess in 0 ms
| EN | FR
-------------------+------+-------
Pages | 1281 | 0
Paginator pages | 0 | 0
Non-page files | 222 | 0
Static files | 1301 | 1301
Processed images | 2 | 0
Aliases | 1028 | 0
Sitemaps | 2 | 0
Cleaned | 0 | 0
Built in 6796 ms
Watching for changes in /Users/xxx/dev/docs-temp-2/{assets,content,i18n,layouts,package.json,static}
Watching for config changes in /xxxx/docs-temp-2/config/_default
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at //localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
This is what my relevant GH Jobs definition looks like.
jobs:
broken-link-check:
runs-on: ubuntu-22.04
name: Check for broken links
steps:
- name: Install Hugo and Muffet
run: |
mkdir -p ~/bin
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install hugo --force --quiet
brew install muffet --force --quiet
shell: bash
- uses: actions/checkout@v3
name: Checkout Repository
with:
fetch-depth: 1
- uses: actions/setup-node@v3
name: Get NPM (from Cache if available)
with:
node-version: 16
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- uses: actions/cache@v3
name: Hugo modules cache
with:
path: /tmp/hugo_cache
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
- run: |
npm ci
npm ls
name: NPM ci (Docsy pre-requisite)
- name: Start Hugo Server
timeout-minutes: 3
run: |
touch ${RUNNER_TEMP}/build.output
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo ":hourglass: Waiting for Hugo Server to build and start" >> "$GITHUB_STEP_SUMMARY"
hugo server --config hugo.toml --configDir config --disableKinds=taxonomy,term,rss,sitemap,robotsTXT --disableBrowserError --disableLiveReload --noBuildLock --noChmod --noTimes --watch=false --enableGitInfo=false -e development >>${RUNNER_TEMP}/build.output 2>&1 &
sleep 1
( tail -f -n0 ${RUNNER_TEMP}/build.output & ) | grep -q "Built in"
sleep 1
echo ":white_check_mark: Hugo has finished building the docs website." >> "$GITHUB_STEP_SUMMARY"
shell: bash