gitlab-ci: Split build into two halves
[ghc.git] / .gitlab-ci.yml
1 variables:
2   GIT_SSL_NO_VERIFY: "1"
3   GIT_SUBMODULE_STRATEGY: "recursive"
4   LANG: "en_US.UTF-8"
5
6 stages:
7   - lint
8   - build
9   - full-build
10
11 ############################################################
12 # Linting
13 ############################################################
14
15 ghc-linters:
16   stage: lint
17   image: ghcci/linters:0.1
18   script:
19     - |
20       if [ -n "$CI_MERGE_REQUEST_ID" ]; then
21         base="$(git merge-base $CI_MERGE_REQUEST_BRANCH_NAME HEAD)"
22         validate-commit-msg .git $(git rev-list $base..$CI_COMMIT_SHA)
23         submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA)
24         validate-whitespace .git $(git rev-list $base..$CI_COMMIT_SHA)
25         .gitlab/linters/check-makefiles.py $base $CI_COMMIT_SHA
26         .gitlab/linters/check-cpp.py $base $CI_COMMIT_SHA
27       fi
28
29 ############################################################
30 # Validation via Pipelines (hadrian)
31 ############################################################
32
33 .validate-hadrian:
34   allow_failure: true
35   script:
36     - bash .circleci/prepare-system.sh
37     - if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
38     - ./boot
39     - ./configure $CONFIGURE_ARGS
40     - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh`
41   cache:
42     key: hadrian
43     paths:
44       - cabal-cache
45
46 validate-x86_64-linux-deb8-hadrian:
47   extends: .validate-hadrian
48   stage: build
49   image: ghcci/x86_64-linux-deb8:0.1
50   before_script:
51     # workaround for docker permissions
52     - sudo chown ghc:ghc -R .
53   tags:
54     - x86_64-linux
55
56 ############################################################
57 # Validation via Pipelines (make)
58 ############################################################
59
60 .validate:
61   variables:
62     TEST_TYPE: test
63   script:
64     - make clean || true
65     - ./boot
66     - ./configure $CONFIGURE_ARGS
67     - |
68       THREADS=`mk/detect-cpu-count.sh`
69       make V=0 -j$THREADS
70     - |
71       make binary-dist TAR_COMP_OPTS="-1"
72       mv ghc-*.tar.xz ghc.tar.xz
73     - |
74       THREADS=`mk/detect-cpu-count.sh`
75       make $TEST_TYPE THREADS=$THREADS JUNIT_FILE=../../junit.xml
76   artifacts:
77     reports:
78       junit: junit.xml
79     expire_in: 2 week
80     paths:
81       - ghc.tar.xz
82       - junit.xml
83
84 validate-x86_64-darwin:
85   extends: .validate
86   stage: full-build
87   allow_failure: true
88   tags:
89     - x86_64-darwin
90   variables:
91     GHC_VERSION: 8.6.3
92     MACOSX_DEPLOYMENT_TARGET: "10.7"
93     # Only Sierra and onwards supports clock_gettime. See #12858
94     ac_cv_func_clock_gettime: "no"
95     LANG: "en_US.UTF-8"
96   before_script:
97     - bash .gitlab/darwin-init.sh
98     - PATH="`pwd`/toolchain/bin:$PATH"
99       # Disable sphinx PDF output as MacTeX apparently doesn't provide xelatex
100     - echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
101     - echo "libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-intree-gmp" >> mk/build.mk
102   after_script:
103     - cp -Rf $HOME/.cabal cabal-cache
104   artifacts:
105     when: always
106     expire_in: 2 week
107   cache:
108     key: darwin
109     paths:
110       - cabal-cache
111       - toolchain
112
113 .validate-linux:
114   extends: .validate
115   tags:
116     - x86_64-linux
117   before_script:
118     - bash .circleci/prepare-system.sh
119     # workaround for docker permissions
120     - sudo chown ghc:ghc -R .
121   after_script:
122     - cp -Rf $HOME/.cabal cabal-cache
123   cache:
124     key: linux
125     paths:
126       - cabal-cache
127       - toolchain
128
129 validate-aarch64-linux-deb9:
130   extends: .validate-linux
131   stage: full-build
132   image: ghcci/aarch64-linux-deb9:0.1
133   allow_failure: true
134   artifacts:
135     when: always
136     expire_in: 2 week
137   cache:
138     key: linux-aarch64-deb9
139   tags:
140     - aarch64-linux
141
142 nightly-aarch64-linux-deb9:
143   extends: validate-aarch64-linux-deb9
144   stage: full-build
145   artifacts:
146     expire_in: 2 year
147   variables:
148     TEST_TYPE: slowtest
149   only:
150     variables:
151       - $NIGHTLY
152
153 validate-x86_64-linux-deb9:
154   extends: .validate-linux
155   stage: build
156   image: ghcci/x86_64-linux-deb9:0.2
157   artifacts:
158     when: always
159     expire_in: 2 week
160   cache:
161     key: linux-x86_64-deb9
162
163 nightly-x86_64-linux-deb9:
164   extends: validate-x86_64-linux-deb9
165   stage: build
166   artifacts:
167     expire_in: 2 year
168   variables:
169     TEST_TYPE: slowtest
170   only:
171     variables:
172       - $NIGHTLY
173
174 validate-x86_64-linux-deb9-llvm:
175   extends: .validate-linux
176   stage: full-build
177   allow_failure: true
178   image: ghcci/x86_64-linux-deb9:0.2
179   variables:
180     BUILD_FLAVOUR: perf-llvm
181   cache:
182     key: linux-x86_64-deb9
183
184 validate-x86_64-linux-deb8:
185   extends: .validate-linux
186   stage: full-build
187   image: ghcci/x86_64-linux-deb8:0.1
188   cache:
189     key: linux-x86_64-deb8
190   artifacts:
191     when: always
192     expire_in: 2 week
193
194 validate-x86_64-linux-fedora27:
195   extends: .validate-linux
196   stage: full-build
197   image: ghcci/x86_64-linux-fedora27:0.1
198   cache:
199     key: linux-x86_64-fedora27
200   artifacts:
201     when: always
202     expire_in: 2 week
203
204 validate-x86_64-linux-deb9-integer-simple:
205   extends: .validate-linux
206   stage: full-build
207   allow_failure: true
208   variables:
209     INTEGER_LIBRARY: integer-simple
210   image: ghcci/x86_64-linux-deb9:0.2
211   cache:
212     key: linux-x86_64-deb9
213
214 nightly-x86_64-linux-deb9-integer-simple:
215   extends: validate-x86_64-linux-deb9-integer-simple
216   stage: full-build
217   artifacts:
218     expire_in: 2 year
219   variables:
220     TEST_TYPE: slowtest
221   only:
222     variables:
223       - $NIGHTLY
224
225 validate-x86_64-linux-deb9-unreg:
226   extends: .validate-linux
227   stage: full-build
228   variables:
229     CONFIGURE_ARGS: --enable-unregisterised
230   image: ghcci/x86_64-linux-deb9:0.2
231   cache:
232     key: linux-x86_64-deb9
233
234 ############################################################
235 # Validation via Pipelines (Windows)
236 ############################################################
237
238 validate-x86_64-windows-hadrian:
239   stage: full-build
240   variables:
241     GHC_VERSION: "8.6.2"
242   script:
243     - PATH=C:\msys64\usr\bin;%PATH%
244     - bash .gitlab/win32-init.sh
245     - |
246       set MSYSTEM=MINGW64
247       python boot
248       bash -c './configure --with-ghc=`pwd`/toolchain/bin/ghc --enable-tarballs-autodownload HappyCmd=`pwd`/toolchain/bin/happy AlexCmd=`pwd`/toolchain/bin/alex'
249       mkdir -p _build
250       cp -R inplace/mingw _build/mingw
251     # FIXME: --no-lint due to #15950
252     - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --flavour=Quick --no-lint"
253     - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh binary-dist"
254     - mv ghc-*.tar.xz ghc.tar.xz
255     - bash -c 'make V=0 -j`mk/detect-cpu-count.sh` HADDOCK_DOCS=NO test THREADS=$THREADS JUNIT_FILE=../../junit.xml'
256     - cp -Rf $APPDATA/cabal cabal-cache
257   cache:
258     key: windows-hadrian
259     paths:
260       - cabal-cache
261       - ghc-8.6.2
262       - ghc-tarballs
263   tags:
264     - x86_64-windows
265
266 validate-x86_64-windows:
267   stage: full-build
268   variables:
269     GHC_VERSION: "8.6.2"
270   script:
271     - PATH=C:\msys64\usr\bin;%PATH%
272     - bash .gitlab/win32-init.sh
273     - |
274       set MSYSTEM=MINGW64
275       python boot
276       bash -c './configure --with-ghc=`pwd`/toolchain/bin/ghc --enable-tarballs-autodownload HappyCmd=`pwd`/toolchain/bin/happy AlexCmd=`pwd`/toolchain/bin/alex'
277     - bash -c "PATH=`pwd`/toolchain/bin:$PATH make -j`mk/detect-cpu-count.sh`"
278     - mv ghc-*.tar.xz ghc.tar.xz
279     - bash -c 'make V=0 -j`mk/detect-cpu-count.sh` HADDOCK_DOCS=NO test THREADS=$THREADS JUNIT_FILE=../../junit.xml'
280     - cp -Rf $APPDATA/cabal cabal-cache
281   cache:
282     key: windows
283     paths:
284       - cabal-cache
285       - ghc-8.6.2
286       - ghc-tarballs
287   tags:
288     - x86_64-windows
289
290 ############################################################
291 # Validation via CircleCI
292 ############################################################
293
294 .circleci:
295   stage: build
296   image: ghcci/x86_64-linux-deb8:0.1
297   artifacts:
298     when: always
299     expire_in: 2 week
300     reports:
301       junit: junit.xml
302     paths:
303       - ghc.tar.xz
304       - junit.xml
305   tags:
306     - circleci
307
308 # All validation jobs keep the bindists and test results are artifacts,
309 # when we get far enough to generate them.
310 #
311 # This requires updating the maximum artifacts size limit in Gitlab to
312 # something like 200MB.
313
314 circleci-validate-x86_64-linux-deb8:
315   extends: .circleci
316   script: ".gitlab/circle-ci-job.sh validate-x86_64-linux-deb8"
317
318 circleci-validate-i386-linux-deb8:
319   extends: .circleci
320   script: ".gitlab/circle-ci-job.sh validate-i386-linux-deb8"
321
322 # circleci-validate-x86_64-freebsd:
323 #   extends: .circleci
324 #   script: ".gitlab/circle-ci-job.sh validate-x86_64-freebsd"
325
326 circleci-validate-x86_64-darwin:
327   extends: .circleci
328   script: ".gitlab/circle-ci-job.sh validate-x86_64-darwin"