diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000..83dc312b8a3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,164 @@ +language: node_js +node_js: + - 24.15 # latest LTS version ('node' will give latest version, 'lts/*' will give LTS version ) +arch: amd64 # optional, this is default, routes to a full VM +# arch: arm64 # this is the recommended LXD container - faster spin up but some limitations Not used as it seems very unstable. +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. + quiet: true # prevent commit numbers appearing in the log and being flagged as potential security leaks. + submodules: false # turn off submodules + +env: + global: +# 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 +# remove again 2025-05-08 as builds started breaking again. +# group: previous + +branches: +# build only development and production + only: + - production + - development + +# Start of Travis Job Lifecycle: https://docs.travis-ci.com/user/job-lifecycle/ + +# addons: +######### Skipped +# +# snaps: # Installs hugo if dist: xenial or bionic see https://gohugo.io/getting-started/installing/#snap-package and https://docs.travis-ci.com/user/installing-dependencies/#installing-snap-packages-with-the-snaps-addon +# =================================================================================================== +# TOO RISKY TO USE SNAP - IF WRONG VERSION IS UPLOADED THEN DIFFICULT TO GO BACK TO DIFFERENT VERSION +# =================================================================================================== +# - name: hugo +# channel: extended/stable # needs extended to compile SCSS etc. Issue if snap is not updated correctly + +cache: +# Cache node_modules to avoid re-downloading on every build +# See https://docs.travis-ci.com/user/caching/ + directories: + - node_modules + +before_install: +############### + # Hugo, Docsy and dependencies are installed via npm + - 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 + # This version makes the html.Parse much smaller + # For htmltest installation instructions, see https://github.com/wjdp/htmltest/blob/master/README.md + # - travis_retry curl https://htmltest.wjdp.uk | bash # install htmltest into $TRAVIS_BUILD_DIR/bin/htmltest + +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. + # ------------------------ + - ./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 + - printf '\033[0;22m' >> $TRAVIS_BUILD_DIR/hugo.log + # Set pipefail so that if Hugo fails the whole job fails + - set -o pipefail + # put the flags in different config files controlled by environment matching $TRAVIS_BRANCH + # 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) + + # bash -o pipefail ensures Hugo's non-zero exit code is not masked by tee inside the subprocess + - travis_wait 15 bash -o pipefail -c './node_modules/.bin/hugo --environment $TRAVIS_BRANCH 2>&1 | tee -a $TRAVIS_BUILD_DIR/hugo.log' + + # normal htmltest takes too much memory - using a modified version which strips