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