I also blog frequently on the Yesod Web Framework blog, as well as the FP Complete blog.
See a typo? Have a suggestion? Edit this page on Github
I don't think I ever documented this before, so just a quick post to get this out there. Many of us working on open source Haskell libraries already use Travis CI for doing continuous integration builds of our software. Some time ago they added support for OS X, making it possible to cover Linux and OS X with multiple configurations on their systems. For any project with a stack.yaml file, this can be easily achieved using the Stack recommended Travis configuration.
Unfortunately, this leaves Windows testing out, which is unfortunate, because Windows is likely to be the most common build to fail. Fortunately, AppVeyor provides a similar experience to Travis, but for Windows. In order to get set up, just:
appveyor.yml
to your projectHere's a simple file I've used on a few projects with succeess:
build: off
before_test:
# http://help.appveyor.com/discussions/problems/6312-curl-command-not-found
- set PATH=C:\Program Files\Git\mingw64\bin;%PATH%
- curl -sS -ostack.zip -L --insecure http://www.stackage.org/stack/windows-i386
- 7z x stack.zip stack.exe
clone_folder: "c:\\stack"
environment:
global:
STACK_ROOT: "c:\\sr"
test_script:
- stack setup > nul
# The ugly echo "" hack is to avoid complaints about 0 being an invalid file
# descriptor
- echo "" | stack --no-terminal test
All this does is:
STACK_ROOT
to deal with Windows long path issuesstack setup
to get a toolchainstack --no-terminal test
to build your package and run the test suitesYou're free to modify this in any way you want, e.g., add in --bench
to build
benchmarks, add --pedantic
to fail on warnings, etc. If you have more system
library dependencies, you'll need to consult the AppVeyor docs to see how to
install them. And in our use cases for Stack, we found that using the AppVeyor
caching functionality made builds unreliable (due to the large size of the
cache). You may want to experiment with turning it back on, since this setup is
slow (it downloads and installs a full GHC toolchain and builds all library
dependencies each time).