CircleCI: Try validating LLVM as well
[ghc.git] / .circleci / config.yml
1 version: 2
2
3 aliases:
4   - &defaults
5     working_directory: ~/ghc
6
7   # Make sure we have proper openssh before checkout: CircleCI git
8   # does not check the repository out properly without it and also
9   # takes 20 times longer than it should be.
10   - &precheckout
11     run:
12       name: Install OpenSSH client
13       command: |
14         apt-get update -qq
15         apt-get install -qy openssh-client
16   - &prepare
17     run:
18       name: prepare-system
19       command: .circleci/prepare-system.sh
20   - &submodules
21     run:
22       name: submodules
23       command: .circleci/fetch-submodules.sh
24   - &buildenv
25     THREADS: 3
26     SKIP_PERF_TESTS: YES
27     VERBOSE: 2
28   - &boot
29     run:
30       name: Boot
31       command: |
32         ./boot
33
34         cat <<EOF >> mk/build.mk
35         BuildFlavour=$BUILD_FLAVOUR
36         ifneq "\$(BuildFlavour)" ""
37         include mk/flavours/\$(BuildFlavour).mk
38         endif
39         EOF
40   - &configure_unix
41     run:
42       name: Configure
43       command: ./configure
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$THREADS"
56   - &test
57     run:
58       name: Test
59       command: make test
60   - &slowtest
61     run:
62       name: Full Test
63       command: make slowtest
64   - &bindist
65     run:
66       name: Create bindist
67       command: make binary-dist
68       # Building bindist takes ~15 minutes without output, account for
69       # that.
70       no_output_timeout: "30m"
71   - &collectartifacts
72     run:
73       name: Collect artifacts
74       # We need this because CircleCI expects a path without
75       # wildcards but bindist archive name is not static
76       command: |
77         mkdir -p /tmp/artifacts
78         pwd
79         find .
80         cp ghc*.tar.xz /tmp/artifacts
81   - &storeartifacts
82     store-artifacts:
83       path: /tmp/artifacts
84
85 jobs:
86   "validate-x86_64-linux":
87     resource_class: xlarge
88     docker:
89       - image: haskell:8.2
90     environment:
91       <<: *buildenv
92     steps:
93       - *precheckout
94       - checkout
95       - *prepare
96       - *submodules
97       - *boot
98       - *configure_unix
99       - *make
100       - *test
101       - *bindist
102       - *collectartifacts
103       - *storeartifacts
104
105   "validate-x86_64-freebsd":
106     resource_class: xlarge
107     docker:
108       - image: tweag/toolchain-x86_64-freebsd
109     environment:
110       TARGET: FreeBSD
111       <<: *buildenv
112     steps:
113       - *precheckout
114       - checkout
115       - *prepare
116       - *submodules
117       - *boot
118       - *configure_bsd
119       - *make
120       - *test
121       - *bindist
122       - *collectartifacts
123       - *storeartifacts
124
125   "validate-x86_64-darwin":
126     macos:
127       xcode: "9.0"
128     environment:
129       <<: *buildenv
130     steps:
131       - checkout
132       - *prepare
133       - *submodules
134       - *boot
135       - *configure_unix
136       - *make
137       - *test
138       - *bindist
139       # Disabled due to CircleCI brokenness
140       #- *collectartifacts
141       #- *storeartifacts
142
143   "validate-x86_64-linux-unreg":
144     resource_class: xlarge
145     docker:
146       - image: haskell:8.2
147     environment:
148       <<: *buildenv
149     steps:
150       - *precheckout
151       - checkout
152       - *prepare
153       - *submodules
154       - *boot
155       - *configure_unreg
156       - *make
157       - *test
158
159   "validate-x86_64-linux-llvm":
160     resource_class: xlarge
161     docker:
162       - image: haskell:8.2
163     environment:
164       <<: *buildenv
165       BUILD_FLAVOUR: perf-llvm
166     steps:
167       - run:
168           name: Install LLVM
169           command: |
170             apt-get update
171             apt-get install -y curl xz-utils
172             curl http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-x86_64-linux-gnu-debian8.tar.xz | tar -xJC ..
173             # See https://discuss.circleci.com/t/how-to-add-a-path-to-path-in-circle-2-0/11554/3
174             echo "export PATH=`pwd`/../clang+llvm-5.0.0-x86_64-linux-gnu-debian8/bin:\$PATH" >> $BASH_ENV
175       - run:
176           name: Verify that llc works
177           command: llc
178       - *precheckout
179       - checkout
180       - *prepare
181       - *submodules
182       - *boot
183       - *configure_unix
184       - *make
185       - *slowtest
186
187 workflows:
188   version: 2
189   validate:
190     jobs:
191     - validate-x86_64-linux
192     # FreeBSD disabled: https://github.com/haskell/unix/issues/102
193     # - validate-x86_64-freebsd
194     - validate-x86_64-darwin
195     - validate-x86_64-linux-llvm
196
197   nightly:
198     triggers:
199       - schedule:
200           cron: "0 0 * * *"
201           filters:
202             branches:
203               only:
204                 - master
205     jobs:
206     - validate-x86_64-linux-unreg
207     - validate-x86_64-linux-llvm
208
209 notify:
210   webhooks:
211     - url: https://phabricator.haskell.org/harbormaster/hook/circleci/