Skip to content

Instantly share code, notes, and snippets.

@fizruk
Created March 26, 2018 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fizruk/2d69614bd4082588b02a46b853a0fae0 to your computer and use it in GitHub Desktop.
Save fizruk/2d69614bd4082588b02a46b853a0fae0 to your computer and use it in GitHub Desktop.
Circle CI 2.0 config for a Haskell Stack project (for LTS 11.0).
version: 2
jobs:
build:
docker:
- image: fpco/stack-build:lts-11.0
steps:
- checkout
- restore_cache:
keys:
- stack-dependencies-{{ arch }}-{{ checksum "stack.yaml" }}-{{ checksum "package.yaml" }}
- stack-dependencies-{{ arch }}-{{ checksum "stack.yaml" }}
- run:
command: stack build --test --bench --only-dependencies -j1
- save_cache:
key: stack-dependencies-{{ arch }}-{{ checksum "stack.yaml" }}-{{ checksum "package.yaml" }}
paths:
- ~/.stack
- run:
command: stack build --test --no-run-tests --bench --no-run-benchmarks
- save_cache:
key: stack-work-{{ arch }}-{{ .Revision }}
paths:
- .stack-work
test:
docker:
- image: fpco/stack-build:lts-11.0
steps:
- checkout
- restore_cache:
keys:
- stack-dependencies-{{ arch }}-{{ checksum "stack.yaml" }}-{{ checksum "package.yaml" }}
- stack-dependencies-{{ arch }}-{{ checksum "stack.yaml" }}
- restore_cache:
key: stack-work-{{ arch }}-{{ .Revision }}
- run:
command: stack test
haddock:
docker:
- image: fpco/stack-build:lts-11.0
steps:
- checkout
- restore_cache:
keys:
- stack-dependencies-{{ arch }}-{{ checksum "stack.yaml" }}-{{ checksum "package.yaml" }}
- stack-dependencies-{{ arch }}-{{ checksum "stack.yaml" }}
- restore_cache:
key: stack-work-{{ arch }}-{{ .Revision }}
- run:
command: stack haddock --no-haddock-deps
- run:
name: Move haddock files to a temporary directory
command: |
mkdir -p /tmp/haddock
mv $(stack path --local-install-root)/doc /tmp/haddock
- store_artifacts:
path: /tmp/haddock
workflows:
version: 2
build-test:
jobs:
- build
- test:
requires:
- build
- haddock:
requires:
- build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment