blob: 4c9cc902214719676131d057e20fa6a8cd5531e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
version: "2.1"
env: &env
environment:
LC_ALL: "C.UTF-8"
docker:
- image: fpco/stack-build:lts
#-----------------------------------------------------------------------------
# Common utility stuff, not to be modified usually
#-----------------------------------------------------------------------------
preinstall: &preinstall
run: |
echo 'export PATH=/opt/cabal/bin:/opt/ghc/bin:$PATH' >> $BASH_ENV
source $BASH_ENV
apt-get update
restore: &restore
# Needs to happen after installing ca-certificates
restore_cache:
key: v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}
save: &save
save_cache:
key: v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}
paths:
- ~/.cabal
- ~/.ghc
- ~/.local
- ~/.stack
commands:
cabal_build:
parameters:
ghcversion:
type: string
steps:
- checkout
- *preinstall
- *restore
- run:
name: install cabal
command: apt-get install -y cabal-install-2.4
- run:
name: install ghc
command: |
apt-get install -y ghc-<< parameters.ghcversion >>
- run:
name: build and test project
command: |
set -e
cabal v2-update
TMPDIR=`mktemp -d -t circleci.XXXXXXX`
cabal v2-sdist --output-dir=${TMPDIR}
cd ${TMPDIR}
tar xvzf *.tar.gz
cd *
cabal v2-build -w ghc-<< parameters.ghcversion >> -j2 --disable-optimization --dependencies-only --enable-tests --enable-benchmarks
cabal v2-build -w ghc-<< parameters.ghcversion >> -j2 --disable-optimization --enable-tests --enable-benchmarks 2>build.log
cat build.log
# fail if we had warnings in local build
# this is to work around the fact that cabal v2 doesn't allow
# us to use -Werror for just local build:
# https://github.com/haskell/cabal/issues/4247
! grep -q "[Ww]arning:" build.log
cabal v2-test -w ghc-<< parameters.ghcversion >> -j2 --disable-optimization --enable-tests
cabal v2-haddock -w ghc-<< parameters.ghcversion >>
cabal check
- *save
#-----------------------------------------------------------------------------
# Build matrix
#-----------------------------------------------------------------------------
jobs:
cabal-ghc-8_6_4:
<<: *env
steps:
- cabal_build:
ghcversion: 8.6.4
cabal-ghc-8_4_4:
<<: *env
steps:
- cabal_build:
ghcversion: 8.4.4
cabal-ghc-8_2_2:
<<: *env
steps:
- cabal_build:
ghcversion: 8.2.2
cabal-ghc-8_0_2:
<<: *env
steps:
- cabal_build:
ghcversion: 8.0.2
stack-ghc-8_6:
<<: *env
steps:
- checkout
- *preinstall
- *restore
- run: |
set -e
apt-get install -y ghc-8.6.3
stack update
stack test --system-ghc --fast --ghc-options="-Werror" .
- *save
workflows:
version: "2.1"
build:
jobs:
- cabal-ghc-8_6_4
- cabal-ghc-8_4_4
- cabal-ghc-8_2_2
- cabal-ghc-8_0_2
- stack-ghc-8_6
|