diff --git a/.travis.yml b/.travis.yml index 66aaa9309ec..75fc9f614da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,12 +7,16 @@ os: linux # optional, this is default dist: jammy # or bionic | xenial | trusty | precise with xenial as default - Recommended here: https://docs.travis-ci.com/user/reference/overview/#deprecated-virtualization-environments git: - depth: 20000 # We're cloning this many commits as it is roughly covering the last 4 years of commits, thus letting us show the last changed date on the documentation pages. + depth: 10000 # We're cloning this many commits as it is roughly covering the last 4 years of commits, thus letting us show the last changed date on the documentation pages. quiet: true # prevent commit numbers appearing in the log and being flagged as potential security leaks. submodules: false # turn off submodules env: global: + - HUGO_RESOURCE_DIR="/tmp/hugo_cache" + - HUGO_NUMWORKERMULTIPLIER=1 + - HUGO_ENABLEMISSINGTRANSLATIONPLACEHOLDERS=true + - HUGO_PARALLELISM="75%" # Global variables can go here, for example HUGO_VERSION if we were using Netlify to publish. # add group: previous to see if this fixes the stalled npm build - 2025-04-14 @@ -42,10 +46,13 @@ cache: # See https://docs.travis-ci.com/user/caching/ directories: - node_modules - + - /tmp/hugo_cache # Cache Hugo resources to speed up builds - see https://gohugo.io/getting-started/installing/#hugo-resource-cache before_install: ############### # Hugo, Docsy and dependencies are installed via npm + - mkdir -p /tmp/hugo_cache + - chmod -R 777 /tmp/hugo_cache + - echo "Cache directory permissions:" && ls -ld /tmp/hugo_cache # Ensure cache dir exists - travis_retry npm install # use npm rather than yarn - HUGO doesn't have that many dependencies # # Currently will use custom version of htmltest stored in /htmltest/htmltest @@ -56,12 +63,13 @@ before_install: install: ######## # ------------------------ - - mkdir public # This because the process of syncing to public is probably deadlocked behind waiting for the public folder to be made, and is never signalled that the folder is created, which ends up stalling the build on Travis CI. + - mkdir public + - ./node_modules/.bin/hugo config --environment $TRAVIS_BRANCH # ------------------------ - - ./node_modules/.bin/hugo config --environment $TRAVIS_BRANCH # report the config we are using # Output header in bold white on green - printf '\033[37;42;1m' > $TRAVIS_BUILD_DIR/hugo.log - echo "HUGO was run for environment $TRAVIS_BRANCH" >> $TRAVIS_BUILD_DIR/hugo.log + - echo "Cache contents before build:" && ls -la /tmp/hugo_cache # Fixed indentation - printf '\033[0;22m' >> $TRAVIS_BUILD_DIR/hugo.log # Set pipefail so that if Hugo fails the whole job fails - set -o pipefail @@ -69,7 +77,7 @@ install: # Append output to hugo.log file to print at the end of the travis job # (see https://stackoverflow.com/questions/418896/how-to-redirect-output-to-a-file-and-stdout) - - ./node_modules/.bin/hugo --environment $TRAVIS_BRANCH 2>&1 | tee -a $TRAVIS_BUILD_DIR/hugo.log + - ./node_modules/.bin/hugo --environment $TRAVIS_BRANCH --gc --cleanDestinationDir --ignoreCache 2>&1 | tee -a $TRAVIS_BUILD_DIR/hugo.log # normal htmltest takes too much memory - using a modified version which strips