├── .gitignore ├── LICENSE ├── README.md ├── Setup.hs ├── circle.yml ├── haskell-circle-example.cabal ├── src └── Main.hs └── stack.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | .stack-work 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials provided 14 | with the distribution. 15 | 16 | * Neither the name of nor the names of other 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### High-Quality Haskell CI 2 | 3 | [![Circle CI](https://circleci.com/gh/begriffs/haskell-circle-example.svg?style=svg)](https://circleci.com/gh/begriffs/haskell-circle-example) 4 | 5 | Best practices for Haskell continuous integration on CircleCI. This 6 | repo is a place to collaborate and refine techniques to enforce 7 | clean code. 8 | 9 | #### Features 10 | 11 | * Uses Stack 12 | * Draconian warning level 13 | * HLints all files 14 | * Checks for outdated constraints with packdeps 15 | * Checks cabal file for possible Hackage problems 16 | * Generates documentation coverage report 17 | * Tests sdist packaging 18 | 19 | #### TODO 20 | 21 | There are more cool things we can do. See the 22 | [issues](https://github.com/begriffs/haskell-circle-example/issues) where 23 | I've recorded some ideas. 24 | -------------------------------------------------------------------------------- /Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | dependencies: 2 | cache_directories: 3 | - "~/.stack" 4 | - ".stack-work" 5 | pre: 6 | - curl -L https://github.com/commercialhaskell/stack/releases/download/v1.0.4/stack-1.0.4-linux-x86_64.tar.gz | tar zx -C /tmp 7 | - sudo mv /tmp/stack-1.0.4-linux-x86_64/stack /usr/bin 8 | override: 9 | - stack setup 10 | - rm -fr $(stack path --dist-dir) $(stack path --local-install-root) 11 | - stack install hlint packdeps cabal-install 12 | - stack build --fast 13 | - stack build --fast --pedantic --haddock --test --no-run-tests --no-haddock-deps 14 | 15 | test: 16 | override: 17 | - stack test 18 | - git ls-files | grep '\.l\?hs$' | xargs stack exec -- hlint -X QuasiQuotes "$@" 19 | - stack exec -- cabal update 20 | - stack exec --no-ghc-package-path -- cabal install --only-d --dry-run --reorder-goals 21 | - stack exec -- packdeps *.cabal || true 22 | - stack exec -- cabal check 23 | - stack sdist 24 | -------------------------------------------------------------------------------- /haskell-circle-example.cabal: -------------------------------------------------------------------------------- 1 | name: haskell-circle-example 2 | version: 0.1.0.0 3 | synopsis: Circle CI config for squeaky clean code 4 | description: All the most hellish settings 5 | homepage: http://github.com/begriffs/haskell-circle-example#readme 6 | license: MIT 7 | license-file: LICENSE 8 | author: Joe Nelson 9 | maintainer: cred+github@begriffs.com 10 | copyright: 2016 Joe Nelson 11 | category: Web 12 | build-type: Simple 13 | cabal-version: >=1.10 14 | source-repository head 15 | type: git 16 | location: git://github.com/begriffs/haskell-circle-example.git 17 | 18 | executable haskell-circle-example 19 | hs-source-dirs: src 20 | main-is: Main.hs 21 | default-language: Haskell2010 22 | build-depends: base >= 4.7 && < 5 23 | -------------------------------------------------------------------------------- /src/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | main :: IO () 4 | main = putStrLn "hello world" 5 | -------------------------------------------------------------------------------- /stack.yaml: -------------------------------------------------------------------------------- 1 | resolver: lts-5.0 2 | 3 | ghc-options: 4 | haskell-circle-example: -Werror -Wall -fwarn-monomorphism-restriction -fwarn-missing-exported-sigs -fwarn-identities 5 | 6 | packages: 7 | - '.' 8 | --------------------------------------------------------------------------------