21 Dec 2015
Using Stack for build of Haskell code on Travis CI has number of benefits. For those unfamiliar with it, Travis is a cloud-base continuous integration system, which will build and test your code automatically. It integrates with Github and is free for open-source projects (but also has paid plans for private projects). Stack's use of cached packages built from Stackage snapshots means builds will be much shorter than without, and reduces the guesswork of whether a build failure was introduced by your own code or something that changed on Hackage. It's also easy to use multiple environment configurations to test against multiple snapshots, including the latest nightly, as a way to ensure that your code builds against a known-to-work set of the latest packages.
Stack works very nicely on Travis, but until recently the documentation for how to set it up languished in semi-obscurity on the Stack wiki. Hereby, we are lifting it out of obscurity. Rather than repeat ourselves, go look at:
- The Travis with caching section of the user's guide, which should be sufficient for most use cases.
- The Travis CI document, which has more information and a slightly different approach.