Skip to content

Instantly share code, notes, and snippets.

@dbp
Last active June 29, 2017 09:53
Show Gist options
  • Save dbp/bef96402ea07001dfed2 to your computer and use it in GitHub Desktop.
Save dbp/bef96402ea07001dfed2 to your computer and use it in GitHub Desktop.
Haskell project with Stack on CircleCI
dependencies:
cache_directories:
- "~/.stack"
pre:
- wget https://github.com/commercialhaskell/stack/releases/download/v0.1.2.0/stack-0.1.2.0-x86_64-linux.gz -O /tmp/stack.gz
- gunzip /tmp/stack.gz && chmod +x /tmp/stack
- sudo mv /tmp/stack /usr/bin/stack
override:
- stack setup
- stack build
test:
override:
- stack test
@beerendlauwers
Copy link

This tends to die with projects with large dependencies. I used these commands to limit the memory usage:

- stack setup +RTS -M1024m -K1024m 
- stack build --only-dependencies -j1

@rtpg
Copy link

rtpg commented Mar 22, 2016

hmm I was having a bit of an issue with this where Circle doesn't pick up the stack-installed GHC in the stack build command (stack setup sets up GHC 7.10.3, but stack build complains about GHC 7.10.2)

@rtpg
Copy link

rtpg commented Mar 22, 2016

http://qiita.com/fujimura/items/b619e0a4ca2028b0eb03 <-- this circle.yml file got me into a working state (installing stack from apt-get insead of a potentially older version of stack)

@frincon
Copy link

frincon commented Jun 29, 2017

I think is better to use this way:

dependencies:
  cache_directories:
    - "~/.stack"
  pre:
    - wget https://github.com/commercialhaskell/stack/releases/download/v1.2.0/stack-1.2.0-linux-x86_64.tar.gz -O /tmp/stack.tar.gz
    - mkdir /tmp/stack/
    - tar -xvzf /tmp/stack.tar.gz -C /tmp/stack/
    - sudo mv /tmp/stack/stack-1.2.0-linux-x86_64/stack /usr/bin/stack
  override:
    - stack setup --no-terminal
    - stack build --no-system-ghc --only-configure --no-terminal

compile:
  override:
    - stack build --no-terminal

test:
  override:
    - stack test --no-terminal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment