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