Fix and enforce validation of header for .hie files
[ghc.git] / .circleci / config.yml
1 # Questions about this file?
2 # See https://gitlab.haskell.org/ghc/ghc/wikis/continuous-integration/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     # ideally we would simply set THREADS here instead of re-detecting it every
19     # time we need it below. Unfortunately, there is no way to set an environment
20     # variable with the result of a shell script.
21     SKIP_PERF_TESTS: NO
22     VERBOSE: 2
23   - &boot
24     run:
25       name: Boot
26       command: |
27         ./boot
28   - &set_git_identity
29       run:
30         name: Set Git Identity
31         command: |
32           git config user.email "ghc-circleci@haskell.org"
33           git config user.name "GHC CircleCI"
34   - &configure_unix
35     run:
36       name: Configure
37       command: ./configure 
38   - &configure_unix_32
39     run:
40       name: Configure
41       command: |
42         setarch i386 ./configure --with-ghc=/opt/ghc-i386/8.4.2/bin/ghc
43   - &configure_bsd
44     run:
45       name: Configure
46       command: ./configure --target=x86_64-unknown-freebsd10
47   - &configure_unreg
48     run:
49       name: Configure
50       command: ./configure --enable-unregisterised
51   - &make
52     run:
53       name: Build
54       command: "make -j`mk/detect-cpu-count.sh` V=0"
55   - &build_hadrian
56     run:
57       name: Build GHC using Hadrian
58       command: |
59         cabal update
60         hadrian/build.sh -j`mk/detect-cpu-count.sh`
61   - &test
62     run:
63       name: Test
64       command: |
65         mkdir -p test-results
66         METRICS_FILE=$(mktemp)
67         echo "export METRICS_FILE=$METRICS_FILE" >> $BASH_ENV
68         make test THREADS=`mk/detect-cpu-count.sh` SKIP_PERF_TESTS=$SKIP_PERF_TESTS TEST_ENV=$TEST_ENV JUNIT_FILE=../../test-results/junit.xml METRICS_FILE=$METRICS_FILE
69   - &store_test_results
70     store_test_results:
71       path: test-results
72   - &push_perf_note
73     run:
74       name: Push Performance Git Notes
75       command: .circleci/push-test-metrics.sh
76   - &store_test_artifacts
77     store_artifacts:
78       # we might want to add the whole output of the test phase
79       # too at some point
80       path: test-results/junit.xml
81   - &slowtest
82     run:
83       name: Full Test
84       command: |
85         mkdir -p test-results
86         make slowtest SKIP_PERF_TESTS=YES THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../test-results/junit.xml
87   - &bindist
88     run:
89       name: Create bindist
90       # Reduce compression effort to 3
91       command: make binary-dist TAR_COMP_OPTS="-2" && mv ghc*.tar.xz ghc.tar.xz
92       # Building bindist takes ~15 minutes without output, account for
93       # that.
94       no_output_timeout: "30m"
95   - &store_bindist
96     store_artifacts:
97       path: ghc.tar.xz
98   - &only_release_tags
99     tags:
100       only: /^ghc-.*/
101   - &ignore_gitlab_branches
102     branches:
103       ignore: /^gitlab\/.*/
104
105 jobs:
106   "validate-x86_64-freebsd":
107     docker:
108       - image: ghcci/x86_64-freebsd
109     environment:
110       TARGET: FreeBSD
111       <<: *buildenv
112       GHC_COLLECTOR_FLAVOR: x86_64-freebsd
113       TEST_ENV: x86_64-freebsd
114     steps:
115       - checkout
116       - *set_git_identity
117       - *prepare
118       - *submodules
119       - *boot
120       - *configure_bsd
121       - *make
122       - *bindist
123       - *store_bindist
124       - *test
125       - *store_test_results
126       - *store_test_artifacts
127       - *push_perf_note
128
129   "validate-x86_64-darwin":
130     macos:
131       xcode: "9.0"
132     environment:
133       # Disable sphinx PDF output as MacTeX apparently doesn't provide xelatex
134       BUILD_SPHINX_PDF: "NO"
135       MACOSX_DEPLOYMENT_TARGET: "10.7"
136       # Only Sierra and onwards supports clock_gettime. See #12858
137       ac_cv_func_clock_gettime: "no"
138       GHC_COLLECTOR_FLAVOR: x86_64-darwin
139       <<: *buildenv
140       TEST_ENV: x86_64-darwin
141     steps:
142       - checkout
143       - *set_git_identity
144       - *prepare
145       - *submodules
146       - *boot
147       - *configure_unix
148       - *make
149       - *bindist
150       - *store_bindist
151       - *test
152       - *store_test_results
153       - *store_test_artifacts
154       - *push_perf_note
155
156   "validate-x86_64-linux-deb8":
157     docker:
158       - image: ghcci/x86_64-linux-deb8:0.1
159     environment:
160       <<: *buildenv
161       GHC_COLLECTOR_FLAVOR: x86_64-linux
162       TEST_ENV: x86_64-linux-deb8
163     steps:
164       - checkout
165       - *set_git_identity
166       - *prepare
167       - *submodules
168       - *boot
169       - *configure_unix
170       - *make
171       - *bindist
172       - *store_bindist
173       - *test
174       - *store_test_results
175       - *store_test_artifacts
176       - *push_perf_note
177
178   "validate-x86_64-linux-deb9-integer-simple":
179     docker:
180       - image: ghcci/x86_64-linux-deb9:0.2
181     environment:
182       <<: *buildenv
183       INTEGER_LIBRARY: integer-simple
184       GHC_COLLECTOR_FLAVOR: x86_64-linux-deb9
185     steps:
186       - checkout
187       - *set_git_identity
188       - *prepare
189       - *submodules
190       - *boot
191       - *configure_unix
192       - *make
193       - *bindist
194       - *store_bindist
195       - *test
196       - *store_test_results
197       - *store_test_artifacts
198       - *push_perf_note
199
200   "validate-x86_64-linux-deb9":
201     docker:
202       - image: ghcci/x86_64-linux-deb9:0.1
203     environment:
204       <<: *buildenv
205       GHC_COLLECTOR_FLAVOR: x86_64-linux-deb9
206       TEST_ENV: x86_64-linux-deb9
207     steps:
208       - checkout
209       - *set_git_identity
210       - *prepare
211       - *submodules
212       - *boot
213       - *configure_unix
214       - *make
215       - *bindist
216       - *store_bindist
217       - *test
218       - *store_test_results
219       - *store_test_artifacts
220       - *push_perf_note
221
222   "validate-hadrian-x86_64-linux-deb8":
223     docker:
224       - image: ghcci/x86_64-linux-deb8:0.1
225     environment:
226       <<: *buildenv
227     steps:
228       - checkout
229       - *set_git_identity
230       - *prepare
231       - *submodules
232       - *boot
233       - *configure_unix
234       - *build_hadrian
235
236   "validate-x86_64-linux-deb8-unreg":
237     docker:
238       - image: ghcci/x86_64-linux-deb8:0.1
239     environment:
240       <<: *buildenv
241       TEST_ENV: x86_64-linux-deb8-unreg
242     steps:
243       - checkout
244       - *set_git_identity
245       - *prepare
246       - *submodules
247       - *boot
248       - *configure_unreg
249       - *make
250       - *test
251       - *store_test_results
252       - *push_perf_note
253       - *store_test_artifacts
254
255   "validate-x86_64-linux-deb9-llvm":
256     docker:
257       - image: ghcci/x86_64-linux-deb9:0.2
258     environment:
259       <<: *buildenv
260       BUILD_FLAVOUR: perf-llvm
261       TEST_ENV: x86_64-linux-deb9-llvm
262     steps:
263       - run:
264           name: Verify that llc works
265           command: llc
266       - checkout
267       - *set_git_identity
268       - *prepare
269       - *submodules
270       - *boot
271       - *configure_unix
272       - *make
273       - *test
274       - *store_test_results
275       - *store_test_artifacts
276       - *push_perf_note
277
278   # Nightly build with -DDEBUG using devel2 flavour
279   "validate-x86_64-linux-deb8-debug":
280     docker:
281       - image: ghcci/x86_64-linux-deb8:0.1
282     environment:
283       BUILD_FLAVOUR: devel2
284       <<: *buildenv
285       TEST_ENV: x86_64-linux-deb8-debug
286       SKIP_PERF_TESTS: YES
287     steps:
288       - checkout
289       - *set_git_identity
290       - *prepare
291       - *submodules
292       - *boot
293       - *configure_unix
294       - *make
295       - *test
296       - *store_test_results
297       - *store_test_artifacts
298       - *push_perf_note
299
300   "validate-i386-linux-deb9":
301     docker:
302       - image: ghcci/i386-linux-deb9:0.2
303     environment:
304       <<: *buildenv
305       GHC_COLLECTOR_FLAVOR: i386-linux-deb9
306       TEST_ENV: i386-linux-deb9
307     steps:
308       - checkout
309       - *set_git_identity
310       - *prepare
311       - *submodules
312       - *boot
313       - *configure_unix_32
314       - *make
315       - *bindist
316       - *store_bindist
317       - *test
318       - *store_test_results
319       - *store_test_artifacts
320       - *push_perf_note
321
322   "validate-i386-linux-deb8":
323     docker:
324       - image: ghcci/i386-linux-deb8:0.1
325     environment:
326       <<: *buildenv
327       GHC_COLLECTOR_FLAVOR: i386-linux
328       TEST_ENV: i386-linux-deb8
329     steps:
330       - checkout
331       - *set_git_identity
332       - *prepare
333       - *submodules
334       - *boot
335       - *configure_unix_32
336       - *make
337       - *bindist
338       - *store_bindist
339       - *test
340       - *store_test_results
341       - *store_test_artifacts
342       - *push_perf_note
343
344   "validate-x86_64-linux-centos7":
345     docker:
346       - image: ghcci/x86_64-linux-centos7:0.1
347     environment:
348       <<: *buildenv
349       GHC_COLLECTOR_FLAVOR: x86_64-centos7
350       LANG: en_US.UTF-8
351       TEST_ENV: x86_64-centos7
352       # Sphinx is too old
353       BUILD_SPHINX_PDF: NO
354     steps:
355       - checkout
356       - *set_git_identity
357       - *prepare
358       - *submodules
359       - *boot
360       - *configure_unix
361       - *make
362       - *bindist
363       - *store_bindist
364       - *test
365       - *store_test_results
366       - *store_test_artifacts
367       - *push_perf_note
368
369   "validate-x86_64-linux-fedora27":
370     docker:
371       - image: ghcci/x86_64-linux-fedora27:0.1
372     environment:
373       <<: *buildenv
374       GHC_COLLECTOR_FLAVOR: x86_64-fedora
375       TEST_ENV: x86_64-linux-fedora27
376     steps:
377       - checkout
378       - *set_git_identity
379       - *prepare
380       - *submodules
381       - *boot
382       - *configure_unix
383       - *make
384       - *bindist
385       - *store_bindist
386       - *test
387       - *store_test_results
388       - *store_test_artifacts
389       - *push_perf_note
390
391   "slow-validate-x86_64-linux-deb8":
392     docker:
393       - image: ghcci/x86_64-linux-deb8:0.1
394     environment:
395       <<: *buildenv
396       GHC_COLLECTOR_FLAVOR: x86_64-linux-deb8
397     steps:
398       - checkout
399       - *prepare
400       - *submodules
401       - *boot
402       - *configure_unix
403       - *make
404       - *slowtest
405       - *store_test_results
406       - *store_test_artifacts
407       - *push_perf_note
408
409 workflows:
410   version: 2
411   validate:
412     jobs:
413     - validate-x86_64-linux-deb8:
414         filters:
415           <<: [*only_release_tags, *ignore_gitlab_branches]
416     # FreeBSD disabled: https://github.com/haskell/unix/issues/102
417     # - validate-x86_64-freebsd
418     - validate-x86_64-darwin:
419         filters:
420           <<: [*only_release_tags, *ignore_gitlab_branches]
421     - validate-x86_64-linux-deb8-llvm:
422         filters:
423           <<: *ignore_gitlab_branches
424     - validate-i386-linux-deb8:
425         filters:
426           <<: [*only_release_tags, *ignore_gitlab_branches]
427     - validate-x86_64-linux-deb9:
428         filters:
429           <<: [*only_release_tags, *ignore_gitlab_branches]
430     - validate-i386-linux-deb9:
431         filters:
432           <<: [*only_release_tags, *ignore_gitlab_branches]
433     - validate-x86_64-linux-centos7:
434         filters:
435           <<: [*only_release_tags, *ignore_gitlab_branches]
436     - validate-hadrian-x86_64-linux-deb8:
437         filters:
438           <<: *ignore_gitlab_branches
439     - validate-x86_64-linux-fedora27:
440         filters:
441           <<: [*only_release_tags, *ignore_gitlab_branches]
442
443   nightly:
444     triggers:
445       - schedule:
446           cron: "0 0 * * *"
447           filters:
448             branches:
449               only:
450                 - master
451     jobs:
452     - validate-x86_64-linux-deb8-unreg
453     - validate-x86_64-linux-deb8-llvm
454     - validate-x86_64-linux-deb8-debug
455     - validate-x86_64-linux-deb9
456     - validate-x86_64-linux-deb9-integer-simple
457     - slow-validate-x86_64-linux-deb8
458
459 notify:
460   webhooks:
461     - url: https://phabricator.haskell.org/harbormaster/hook/circleci/