Skip to content

Instantly share code, notes, and snippets.

@abahgat
Last active February 29, 2020 08:03
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
A circle CI configuration to build a site with Hugo, test with html-proofer and then take screenshot tests via Percy.
version: 2
jobs:
hugo/build:
docker:
- image: cibuilds/hugo:0.55.6
steps:
- checkout
- run:
name: Checkout Submodules if Needed
command: |
if [ -f ".gitmodules" ]; then
git submodule sync
git submodule update --init --recursive
fi
- run:
name: Build with Hugo
command: HUGO_ENV=production hugo --gc --minify -v -s . -d public -D -F
- run:
name: Test generated website with HTML Proofer.
command: htmlproofer ./public --allow-hash-href --check-html --empty-alt-ignore
--disable-external
- persist_to_workspace:
root: .
paths:
- public
snapshot:
docker:
- image: buildkite/puppeteer:v1.15.0
steps:
- attach_workspace:
at: .
- run:
name: Install Percy
command: npm install percy
- run:
name: Capture Snapshots
command: PERCY_TOKEN=$PERCY_TOKEN npx percy snapshot ./public -i 'categories/!(coding|coding/**)/*.html','tags/!(amsterdam|amsterdam/**)/*.html','blog/page/!(1|2)/*.html'
workflows:
main:
jobs:
- hugo/build
- snapshot:
requires:
- hugo/build
version: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment