Travis

Build a Haskell Project

For Language versions and other build-environment specific information visit our reference pages:

This guide covers configuring Haskell projects on Travis CI. If you’re new to Travis CI. Please read our Onboarding and General Build configuration guides first.

Specify Haskell compiler versions #

The Haskell environment on Travis CI has recent versions of GHC (Glasgow Haskell Compiler) pre-installed. For a detailed list of pre-installed versions, please consult “Build system information” in the build log.

You can specify one or more GHC versions using major.minor notation. Patch level versions (7.6.2 for example) may change any time:

language: haskell
ghc:
  - "7.10"
  - "7.8"
  - "7.6"
  - "8.4.1"

Dependency Management #

By default, Travis CI uses cabal to manage your project’s dependencies:

cabal install --only-dependencies --enable-tests

Specify cabal-install version #

You can specify the version of cabal used:

language: haskell
cabal: "2.4"
ghc:
  - "8.6.4"

Multiple Packages in Subdirectories #

If you have multiple packages in subdirectories (each containing a .cabal file, you can specify those directories in an environment variable:

language: haskell
ghc:
  - "7.10"
  - "7.8"
  - "7.6"
env:
  - PACKAGEDIR="some-package"
  - PACKAGEDIR="some-other-package"
before_install: cd ${PACKAGEDIR}

The build matrix is then constructed such that each package is compiled with each version of GHC.

Hackage Deployment #

Travis can automatically upload your package to Hackage. See Hackage Deployment.

Build Config Reference #

You can find more information on the build config format for Haskell in our Travis CI Build Config Reference.

Build with Stack #

Check out Travis CI on Stack if you want to use Stack to build your project.