Using AppVeyor for Haskell+Windows CI

August 31, 2016

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:

Run stack --no-terminal test to build your package and run the test suites

You'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).