6dcb2187703911d5500833beaad9f0137d681baa
[ghc.git] / .circleci / config.yml
1 # Questions about this file?
2 # See https://ghc.haskell.org/trac/ghc/wiki/ContinuousIntegration/Usage.
3
4 version: 2
5
6 aliases:
7   - &defaults
8     working_directory: ~/ghc
9   - &prepare
10     run:
11       name: prepare-system
12       command: .circleci/prepare-system.sh
13   - &submodules
14     run:
15       name: submodules
16       command: .circleci/fetch-submodules.sh
17   - &buildenv
18     THREADS: 9
19     SKIP_PERF_TESTS: YES
20     VERBOSE: 2
21   - &boot
22     run:
23       name: Boot
24       command: |
25         ./boot
26
27         cat <<EOF >> mk/build.mk
28         BuildFlavour=$BUILD_FLAVOUR
29         ifneq "\$(BuildFlavour)" ""
30         include mk/flavours/\$(BuildFlavour).mk
31         endif
32         EOF
33   - &configure_unix
34     run:
35       name: Configure
36       command: ./configure 
37   - &configure_unix_32
38     run:
39       name: Configure
40       command: |
41         setarch i386 ./configure --with-ghc=/opt/ghc-i386/8.4.2/bin/ghc
42   - &configure_bsd
43     run:
44       name: Configure
45       command: ./configure --target=x86_64-unknown-freebsd10
46   - &configure_unreg
47     run:
48       name: Configure
49       command: ./configure --enable-unregisterised
50   - &make
51     run:
52       name: Build
53       command: "make -j$THREADS V=0"
54   - &build_hadrian
55     run:
56       name: Build GHC using Hadrian
57       command: |
58         cabal update
59         hadrian/build.sh -j$THREADS
60   - &test
61     run:
62       name: Test
63       command: |
64         mkdir -p test-results
65         make test SKIP_PERF_TESTS=YES JUNIT_FILE=../../test-results/junit.xml
66   - &store_test_results
67     store_test_results:
68       path: test-results
69   - &slowtest
70     run:
71       name: Full Test
72       command: make slowtest SKIP_PERF_TESTS=YES
73   - &bindist
74     run:
75       name: Create bindist
76       # Reduce compression effort to 3
77       command: make binary-dist TAR_COMP_OPTS="-2"
78       # Building bindist takes ~15 minutes without output, account for
79       # that.
80       no_output_timeout: "30m"
81   - &storeartifacts
82     run:
83       name: Store artifacts
84       command: |
85         curl https://ghc-artifacts.s3.amazonaws.com/tools/ghc-artifact-collector-$GHC_COLLECTOR_FLAVOR --output ghc-artifact-collector
86         chmod +x ghc-artifact-collector
87         ./ghc-artifact-collector ghc*.tar.xz
88   - &trigger_on_tags
89     filters:
90       tags:
91         only: /^ghc-.*/
92
93 jobs:
94   "validate-x86_64-linux":
95     resource_class: xlarge
96     docker:
97       - image: ghcci/x86_64-linux:0.0.4
98     environment:
99       <<: *buildenv
100       GHC_COLLECTOR_FLAVOR: x86_64-linux
101     steps:
102       - checkout
103       - *prepare
104       - *submodules
105       - *boot
106       - *configure_unix
107       - *make
108       - *bindist
109       - *storeartifacts
110       - *test
111       - *store_test_results
112
113   "validate-x86_64-freebsd":
114     resource_class: xlarge
115     docker:
116       - image: ghcci/x86_64-freebsd
117     environment:
118       TARGET: FreeBSD
119       <<: *buildenv
120       GHC_COLLECTOR_FLAVOR: x86_64-freebsd
121     steps:
122       - checkout
123       - *prepare
124       - *submodules
125       - *boot
126       - *configure_bsd
127       - *make
128       - *bindist
129       - *storeartifacts
130       - *test
131       - *store_test_results
132
133   "validate-x86_64-darwin":
134     macos:
135       xcode: "9.0"
136     environment:
137       # Disable sphinx PDF output as MacTeX apparently doesn't provide xelatex
138       BUILD_SPHINX_PDF: "NO"
139       MACOSX_DEPLOYMENT_TARGET: "10.7"
140       # Only Sierra and onwards supports clock_gettime. See #12858
141       ac_cv_func_clock_gettime: "no"
142       GHC_COLLECTOR_FLAVOR: x86_64-darwin
143       <<: *buildenv
144     steps:
145       - checkout
146       - *prepare
147       - *submodules
148       - *boot
149       - *configure_unix
150       - *make
151       - *bindist
152       - *storeartifacts
153       - *test
154       - *store_test_results
155
156   "validate-hadrian-x86_64-linux":
157     resource_class: xlarge
158     docker:
159       - image: ghcci/x86_64-linux:0.0.4
160     environment:
161       <<: *buildenv
162     steps:
163       - checkout
164       - *prepare
165       - *submodules
166       - *boot
167       - *configure_unix
168       - *build_hadrian
169
170   "validate-x86_64-linux-unreg":
171     resource_class: xlarge
172     docker:
173       - image: ghcci/x86_64-linux:0.0.4
174     environment:
175       <<: *buildenv
176     steps:
177       - checkout
178       - *prepare
179       - *submodules
180       - *boot
181       - *configure_unreg
182       - *make
183       - *test
184       - *store_test_results
185
186   "validate-x86_64-linux-llvm":
187     resource_class: xlarge
188     docker:
189       - image: ghcci/x86_64-linux:0.0.4
190     environment:
191       <<: *buildenv
192       BUILD_FLAVOUR: perf-llvm
193     steps:
194       - run:
195           name: Install LLVM
196           command: |
197             curl http://releases.llvm.org/6.0.0/clang+llvm-6.0.0-x86_64-linux-gnu-debian8.tar.xz | tar -xJC ..
198             echo "export PATH=`pwd`/../clang+llvm-6.0.0-x86_64-linux-gnu-debian8/bin:\$PATH" >> $BASH_ENV
199       - run:
200           name: Verify that llc works
201           command: llc
202       - checkout
203       - *prepare
204       - *submodules
205       - *boot
206       - *configure_unix
207       - *make
208       - *slowtest
209
210   # Nightly build with -DDEBUG using devel2 flavour
211   "validate-x86_64-linux-debug":
212     resource_class: xlarge
213     docker:
214       - image: ghcci/x86_64-linux:0.0.4
215     environment:
216       BUILD_FLAVOUR: devel2
217       <<: *buildenv
218     steps:
219       - checkout
220       - *prepare
221       - *submodules
222       - *boot
223       - *configure_unix
224       - *make
225       - *test
226       - *store_test_results
227
228   "validate-i386-linux":
229     resource_class: xlarge
230     docker:
231       - image: ghcci/i386-linux:0.0.5
232     environment:
233       <<: *buildenv
234       GHC_COLLECTOR_FLAVOR: i386-linux
235     steps:
236       - checkout
237       - *prepare
238       - *submodules
239       - *boot
240       - *configure_unix_32
241       - *make
242       - *bindist
243       - *storeartifacts
244       - *test
245       - *store_test_results
246
247   "validate-x86_64-fedora":
248     resource_class: xlarge
249     docker:
250       - image: ghcci/x86_64-linux-fedora:0.0.15
251     environment:
252       <<: *buildenv
253       GHC_COLLECTOR_FLAVOR: x86_64-fedora
254     steps:
255       - checkout
256       - *prepare
257       - *submodules
258       - *boot
259       - *configure_unix
260       - *make
261       - *bindist
262       - *storeartifacts
263       - *test
264       - *store_test_results
265
266   "slow-validate-x86_64-linux":
267     resource_class: xlarge
268     docker:
269       - image: ghcci/x86_64-linux:0.0.4
270     environment:
271       <<: *buildenv
272       GHC_COLLECTOR_FLAVOR: x86_64-linux
273     steps:
274       - checkout
275       - *prepare
276       - *submodules
277       - *boot
278       - *configure_unix
279       - *make
280       - *slowtest
281
282 workflows:
283   version: 2
284   validate:
285     jobs:
286     - validate-x86_64-linux:
287         *trigger_on_tags
288     # FreeBSD disabled: https://github.com/haskell/unix/issues/102
289     # - validate-x86_64-freebsd
290     - validate-x86_64-darwin:
291         *trigger_on_tags
292     - validate-x86_64-linux-llvm
293     - validate-i386-linux:
294         *trigger_on_tags
295     - validate-hadrian-x86_64-linux
296     - validate-x86_64-fedora:
297         *trigger_on_tags
298
299   nightly:
300     triggers:
301       - schedule:
302           cron: "0 0 * * *"
303           filters:
304             branches:
305               only:
306                 - master
307     jobs:
308     - validate-x86_64-linux-unreg
309     - validate-x86_64-linux-llvm
310     - validate-x86_64-linux-debug
311     - slow-validate-x86_64-linux
312
313 notify:
314   webhooks:
315     - url: https://phabricator.haskell.org/harbormaster/hook/circleci/