Skip to content

Instantly share code, notes, and snippets.

@abahgat
Last active February 29, 2020 08:03
Show Gist options
  • Save abahgat/e7fc5b3023692610c4760fedcd8e3b43 to your computer and use it in GitHub Desktop.
Save abahgat/e7fc5b3023692610c4760fedcd8e3b43 to your computer and use it in GitHub Desktop.
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