hadrian: Drop nix build script
[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     # 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
29         cat <<EOF >> mk/build.mk
30         BuildFlavour=$BUILD_FLAVOUR
31         ifneq "\$(BuildFlavour)" ""
32         include mk/flavours/\$(BuildFlavour).mk
33         endif
34         EOF
35   - &set_git_identity
36       run:
37         name: Set Git Identity
38         command: |
39           git config user.email "ghc-circleci@haskell.org"
40           git config user.name "GHC CircleCI"
41   - &configure_unix
42     run:
43       name: Configure
44       command: ./configure 
45   - &configure_unix_32
46     run:
47       name: Configure
48       command: |
49         setarch i386 ./configure --with-ghc=/opt/ghc-i386/8.4.2/bin/ghc
50   - &configure_bsd
51     run:
52       name: Configure
53       command: ./configure --target=x86_64-unknown-freebsd10
54   - &configure_unreg
55     run:
56       name: Configure
57       command: ./configure --enable-unregisterised
58   - &make
59     run:
60       name: Build
61       command: "make -j`mk/detect-cpu-count.sh` V=0"
62   - &build_hadrian
63     run:
64       name: Build GHC using Hadrian
65       command: |
66         cabal update
67         hadrian/build.sh -j`mk/detect-cpu-count.sh`
68   - &test
69     run:
70       name: Test
71       command: |
72         mkdir -p test-results
73         METRICS_FILE=$(mktemp)
74         echo "export METRICS_FILE=$METRICS_FILE" >> $BASH_ENV
75         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
76   - &store_test_results
77     store_test_results:
78       path: test-results
79   - &push_perf_note
80     run:
81       name: Push Performance Git Notes
82       command: .circleci/push-test-metrics.sh
83   - &store_test_artifacts
84     store_artifacts:
85       # we might want to add the whole output of the test phase
86       # too at some point
87       path: test-results/junit.xml
88   - &slowtest
89     run:
90       name: Full Test
91       command: |
92         mkdir -p test-results
93         make slowtest SKIP_PERF_TESTS=YES THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../test-results/junit.xml
94   - &bindist
95     run:
96       name: Create bindist
97       # Reduce compression effort to 3
98       command: make binary-dist TAR_COMP_OPTS="-2" && mv ghc*.tar.xz ghc.tar.xz
99       # Building bindist takes ~15 minutes without output, account for
100       # that.
101       no_output_timeout: "30m"
102   - &store_bindist
103     store_artifacts:
104       path: ghc.tar.xz
105   - &trigger_on_tags
106     filters:
107       tags:
108         only: /^ghc-.*/
109
110 jobs:
111   "validate-x86_64-linux":
112     resource_class: xlarge
113     docker:
114       - image: ghcci/x86_64-linux:0.0.8
115     environment:
116       <<: *buildenv
117       GHC_COLLECTOR_FLAVOR: x86_64-linux
118       TEST_ENV: x86_64-linux
119     steps:
120       - checkout
121       - *set_git_identity
122       - *prepare
123       - *submodules
124       - *boot
125       - *configure_unix
126       - *make
127       - *bindist
128       - *store_bindist
129       - *test
130       - *store_test_results
131       - *store_test_artifacts
132       - *push_perf_note
133
134   "validate-x86_64-freebsd":
135     resource_class: xlarge
136     docker:
137       - image: ghcci/x86_64-freebsd
138     environment:
139       TARGET: FreeBSD
140       <<: *buildenv
141       GHC_COLLECTOR_FLAVOR: x86_64-freebsd
142       TEST_ENV: x86_64-freebsd
143     steps:
144       - checkout
145       - *set_git_identity
146       - *prepare
147       - *submodules
148       - *boot
149       - *configure_bsd
150       - *make
151       - *bindist
152       - *store_bindist
153       - *test
154       - *store_test_results
155       - *store_test_artifacts
156       - *push_perf_note
157
158   "validate-x86_64-darwin":
159     macos:
160       xcode: "9.0"
161     environment:
162       # Disable sphinx PDF output as MacTeX apparently doesn't provide xelatex
163       BUILD_SPHINX_PDF: "NO"
164       MACOSX_DEPLOYMENT_TARGET: "10.7"
165       # Only Sierra and onwards supports clock_gettime. See #12858
166       ac_cv_func_clock_gettime: "no"
167       GHC_COLLECTOR_FLAVOR: x86_64-darwin
168       <<: *buildenv
169       TEST_ENV: x86_64-darwin
170     steps:
171       - checkout
172       - *set_git_identity
173       - *prepare
174       - *submodules
175       - *boot
176       - *configure_unix
177       - *make
178       - *bindist
179       - *store_bindist
180       - *test
181       - *store_test_results
182       - *store_test_artifacts
183       - *push_perf_note
184
185   "validate-hadrian-x86_64-linux":
186     resource_class: xlarge
187     docker:
188       - image: ghcci/x86_64-linux:0.0.8
189     environment:
190       <<: *buildenv
191     steps:
192       - checkout
193       - *set_git_identity
194       - *prepare
195       - *submodules
196       - *boot
197       - *configure_unix
198       - *build_hadrian
199
200   "validate-x86_64-linux-unreg":
201     resource_class: xlarge
202     docker:
203       - image: ghcci/x86_64-linux:0.0.8
204     environment:
205       <<: *buildenv
206       TEST_ENV: x86_64-linux-unreg
207     steps:
208       - checkout
209       - *set_git_identity
210       - *prepare
211       - *submodules
212       - *boot
213       - *configure_unreg
214       - *make
215       - *test
216       - *store_test_results
217       - *push_perf_note
218       - *store_test_artifacts
219
220   "validate-x86_64-linux-llvm":
221     resource_class: xlarge
222     docker:
223       - image: ghcci/x86_64-linux:0.0.8
224     environment:
225       <<: *buildenv
226       BUILD_FLAVOUR: perf-llvm
227       TEST_ENV: x86_64-linux-llvm
228     steps:
229       - run:
230           name: Install LLVM
231           command: |
232             curl http://releases.llvm.org/6.0.0/clang+llvm-6.0.0-x86_64-linux-gnu-debian8.tar.xz | tar -xJC ..
233             echo "export PATH=`pwd`/../clang+llvm-6.0.0-x86_64-linux-gnu-debian8/bin:\$PATH" >> $BASH_ENV
234       - run:
235           name: Verify that llc works
236           command: llc
237       - checkout
238       - *set_git_identity
239       - *prepare
240       - *submodules
241       - *boot
242       - *configure_unix
243       - *make
244       - *test
245       - *store_test_results
246       - *store_test_artifacts
247       - *push_perf_note
248
249   # Nightly build with -DDEBUG using devel2 flavour
250   "validate-x86_64-linux-debug":
251     resource_class: xlarge
252     docker:
253       - image: ghcci/x86_64-linux:0.0.8
254     environment:
255       BUILD_FLAVOUR: devel2
256       <<: *buildenv
257       TEST_ENV: x86_64-linux-debug
258       SKIP_PERF_TESTS: YES
259     steps:
260       - checkout
261       - *set_git_identity
262       - *prepare
263       - *submodules
264       - *boot
265       - *configure_unix
266       - *make
267       - *test
268       - *store_test_results
269       - *store_test_artifacts
270       - *push_perf_note
271
272   "validate-i386-linux":
273     resource_class: xlarge
274     docker:
275       - image: ghcci/i386-linux:0.0.7
276     environment:
277       <<: *buildenv
278       GHC_COLLECTOR_FLAVOR: i386-linux
279       TEST_ENV: i386-linux
280     steps:
281       - checkout
282       - *set_git_identity
283       - *prepare
284       - *submodules
285       - *boot
286       - *configure_unix_32
287       - *make
288       - *bindist
289       - *store_bindist
290       - *test
291       - *store_test_results
292       - *store_test_artifacts
293       - *push_perf_note
294
295   "validate-x86_64-fedora":
296     resource_class: xlarge
297     docker:
298       - image: ghcci/x86_64-linux-fedora:0.0.17
299     environment:
300       <<: *buildenv
301       GHC_COLLECTOR_FLAVOR: x86_64-fedora
302       TEST_ENV: x86_64-fedora
303     steps:
304       - checkout
305       - *set_git_identity
306       - *prepare
307       - *submodules
308       - *boot
309       - *configure_unix
310       - *make
311       - *bindist
312       - *store_bindist
313       - *test
314       - *store_test_results
315       - *store_test_artifacts
316       - *push_perf_note
317
318   "slow-validate-x86_64-linux":
319     resource_class: xlarge
320     docker:
321       - image: ghcci/x86_64-linux:0.0.8
322     environment:
323       <<: *buildenv
324       GHC_COLLECTOR_FLAVOR: x86_64-linux
325     steps:
326       - checkout
327       - *prepare
328       - *submodules
329       - *boot
330       - *configure_unix
331       - *make
332       - *slowtest
333       - *store_test_results
334       - *store_test_artifacts
335       - *push_perf_note
336
337 workflows:
338   version: 2
339   validate:
340     jobs:
341     - validate-x86_64-linux:
342         *trigger_on_tags
343     # FreeBSD disabled: https://github.com/haskell/unix/issues/102
344     # - validate-x86_64-freebsd
345     - validate-x86_64-darwin:
346         *trigger_on_tags
347     - validate-x86_64-linux-llvm
348     - validate-i386-linux:
349         *trigger_on_tags
350     - validate-hadrian-x86_64-linux
351     - validate-x86_64-fedora:
352         *trigger_on_tags
353
354   nightly:
355     triggers:
356       - schedule:
357           cron: "0 0 * * *"
358           filters:
359             branches:
360               only:
361                 - master
362     jobs:
363     - validate-x86_64-linux-unreg
364     - validate-x86_64-linux-llvm
365     - validate-x86_64-linux-debug
366     - slow-validate-x86_64-linux
367
368 notify:
369   webhooks:
370     - url: https://phabricator.haskell.org/harbormaster/hook/circleci/