gitlab-ci: Don't allow x86_64-linux-deb9-llvm to fail
[ghc.git] / .gitlab-ci.yml
1 variables:
2   GIT_SSL_NO_VERIFY: "1"
3
4 before_script:
5   - python3 .gitlab/fix-submodules.py
6   - git submodule sync --recursive
7   - git submodule update --init --recursive
8   - git checkout .gitmodules
9
10 stages:
11   - lint
12   - build
13   - full-build
14   - cleanup # See Note [Cleanup on Windows]
15
16 ############################################################
17 # Runner Tags
18 ############################################################
19 #
20 # * x86_64-linux: Any Docker-capable x86_64 Linux machine
21 # * aarch64-linux: Any Docker-capable AArch64 Linux machine
22 # * x86_64-windows: A x86_64 Windows machine
23 # * lint: Any Docker-capable x86_64 Linux machine; distinct from
24 #         x86_64-linux to ensure low-latency availability.
25 #
26
27
28 ############################################################
29 # Linting
30 ############################################################
31
32 ghc-linters:
33   stage: lint
34   image: ghcci/linters:0.1
35   script:
36     - |
37       if [ -n "$CI_MERGE_REQUEST_ID" ]; then
38         base="$(git merge-base $CI_MERGE_REQUEST_BRANCH_NAME HEAD)"
39         validate-commit-msg .git $(git rev-list $base..$CI_COMMIT_SHA)
40         submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA)
41         validate-whitespace .git $(git rev-list $base..$CI_COMMIT_SHA)
42         .gitlab/linters/check-makefiles.py $base $CI_COMMIT_SHA
43         .gitlab/linters/check-cpp.py $base $CI_COMMIT_SHA
44       fi
45   dependencies: []
46   tags:
47     - lint
48
49 ############################################################
50 # Validation via Pipelines (hadrian)
51 ############################################################
52
53 .validate-hadrian:
54   allow_failure: true
55   script:
56     - git clean -xdf && git submodule foreach git clean -xdf
57     - bash .circleci/prepare-system.sh
58     - if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
59     - ./boot
60     - ./configure $CONFIGURE_ARGS
61     - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh`
62   cache:
63     key: hadrian
64     paths:
65       - cabal-cache
66
67 validate-x86_64-linux-deb8-hadrian:
68   extends: .validate-hadrian
69   stage: build
70   image: ghcci/x86_64-linux-deb8:0.1
71   before_script:
72     # workaround for docker permissions
73     - sudo chown ghc:ghc -R .
74     - python3 .gitlab/fix-submodules.py
75     - git submodule sync --recursive
76     - git submodule update --init --recursive
77     - git checkout .gitmodules
78   tags:
79     - x86_64-linux
80
81 ############################################################
82 # Validation via Pipelines (make)
83 ############################################################
84
85 .validate:
86   variables:
87     TEST_TYPE: test
88   before_script:
89     - git clean -xdf && git submodule foreach git clean -xdf
90   script:
91     - ./boot
92     - ./configure $CONFIGURE_ARGS
93     - |
94       THREADS=`mk/detect-cpu-count.sh`
95       make V=0 -j$THREADS WERROR=-Werror 
96     - |
97       make binary-dist TAR_COMP_OPTS="-1"
98       mv ghc-*.tar.xz ghc.tar.xz
99     - |
100       THREADS=`mk/detect-cpu-count.sh`
101       make $TEST_TYPE THREADS=$THREADS JUNIT_FILE=../../junit.xml
102   dependencies: []
103   artifacts:
104     reports:
105       junit: junit.xml
106     expire_in: 2 week
107     paths:
108       - ghc.tar.xz
109       - junit.xml
110
111 validate-x86_64-darwin:
112   extends: .validate
113   stage: full-build
114   tags:
115     - x86_64-darwin
116   variables:
117     GHC_VERSION: 8.6.3
118     MACOSX_DEPLOYMENT_TARGET: "10.7"
119     # Only Sierra and onwards supports clock_gettime. See #12858
120     ac_cv_func_clock_gettime: "no"
121     LANG: "en_US.UTF-8"
122     CONFIGURE_ARGS: --with-intree-gmp
123   before_script:
124     - git clean -xdf && git submodule foreach git clean -xdf
125     - python3 .gitlab/fix-submodules.py
126     - git submodule sync --recursive
127     - git submodule update --init --recursive
128     - git checkout .gitmodules
129
130     - bash .gitlab/darwin-init.sh
131     - PATH="`pwd`/toolchain/bin:$PATH"
132   after_script:
133     - cp -Rf $HOME/.cabal cabal-cache
134   artifacts:
135     when: always
136     expire_in: 2 week
137   cache:
138     key: darwin
139     paths:
140       - cabal-cache
141       - toolchain
142
143 .validate-linux:
144   extends: .validate
145   tags:
146     - x86_64-linux
147   before_script:
148     - git clean -xdf && git submodule foreach git clean -xdf
149     - python3 .gitlab/fix-submodules.py
150     - git submodule sync --recursive
151     - git submodule update --init --recursive
152     - git checkout .gitmodules
153
154     - bash .circleci/prepare-system.sh
155     # workaround for docker permissions
156     - sudo chown ghc:ghc -R .
157   after_script:
158     - cp -Rf $HOME/.cabal cabal-cache
159   cache:
160     key: linux
161     paths:
162       - cabal-cache
163       - toolchain
164
165 validate-aarch64-linux-deb9:
166   extends: .validate-linux
167   stage: full-build
168   image: ghcci/aarch64-linux-deb9:0.1
169   allow_failure: true
170   artifacts:
171     when: always
172     expire_in: 2 week
173   cache:
174     key: linux-aarch64-deb9
175   tags:
176     - aarch64-linux
177
178 nightly-aarch64-linux-deb9:
179   extends: validate-aarch64-linux-deb9
180   stage: full-build
181   artifacts:
182     expire_in: 2 year
183   variables:
184     TEST_TYPE: slowtest
185   only:
186     variables:
187       - $NIGHTLY
188
189 validate-i386-linux-deb9:
190   extends: .validate-linux
191   stage: full-build
192   image: ghcci/i386-linux-deb9:0.1
193   allow_failure: true
194   artifacts:
195     when: always
196     expire_in: 2 week
197   cache:
198     key: linux-i386-deb9
199
200 nightly-i386-linux-deb9:
201   extends: .validate-linux
202   stage: full-build
203   image: ghcci/i386-linux-deb9:0.1
204   allow_failure: true
205   variables:
206     TEST_TYPE: slowtest
207   artifacts:
208     when: always
209     expire_in: 2 week
210   only:
211     variables:
212       - $NIGHTLY
213   cache:
214     key: linux-i386-deb9
215
216 validate-x86_64-linux-deb9:
217   extends: .validate-linux
218   stage: build
219   image: ghcci/x86_64-linux-deb9:0.2
220   artifacts:
221     when: always
222     expire_in: 2 week
223   cache:
224     key: linux-x86_64-deb9
225
226 nightly-x86_64-linux-deb9:
227   extends: validate-x86_64-linux-deb9
228   stage: build
229   artifacts:
230     expire_in: 2 year
231   variables:
232     TEST_TYPE: slowtest
233   only:
234     variables:
235       - $NIGHTLY
236
237 validate-x86_64-linux-deb9-llvm:
238   extends: .validate-linux
239   stage: full-build
240   image: ghcci/x86_64-linux-deb9:0.2
241   variables:
242     BUILD_FLAVOUR: perf-llvm
243   cache:
244     key: linux-x86_64-deb9
245
246 validate-x86_64-linux-deb8:
247   extends: .validate-linux
248   stage: full-build
249   image: ghcci/x86_64-linux-deb8:0.1
250   cache:
251     key: linux-x86_64-deb8
252   artifacts:
253     when: always
254     expire_in: 2 week
255
256 validate-x86_64-linux-fedora27:
257   extends: .validate-linux
258   stage: full-build
259   image: ghcci/x86_64-linux-fedora27:0.1
260   cache:
261     key: linux-x86_64-fedora27
262   artifacts:
263     when: always
264     expire_in: 2 week
265
266 validate-x86_64-linux-deb9-integer-simple:
267   extends: .validate-linux
268   stage: full-build
269   variables:
270     INTEGER_LIBRARY: integer-simple
271   image: ghcci/x86_64-linux-deb9:0.2
272   cache:
273     key: linux-x86_64-deb9
274
275 nightly-x86_64-linux-deb9-integer-simple:
276   extends: validate-x86_64-linux-deb9-integer-simple
277   stage: full-build
278   artifacts:
279     expire_in: 2 year
280   variables:
281     TEST_TYPE: slowtest
282   only:
283     variables:
284       - $NIGHTLY
285
286 validate-x86_64-linux-deb9-unreg:
287   extends: .validate-linux
288   stage: full-build
289   variables:
290     CONFIGURE_ARGS: --enable-unregisterised
291   image: ghcci/x86_64-linux-deb9:0.2
292   cache:
293     key: linux-x86_64-deb9
294
295 ############################################################
296 # Validation via Pipelines (Windows)
297 ############################################################
298
299 .validate-windows:
300   before_script:
301     - git clean -xdf
302     - git submodule foreach git clean -xdf
303
304     # Use a local temporary directory to ensure that concurrent builds don't
305     # interfere with one another
306     - |
307       mkdir tmp
308       set TMP=%cd%\tmp
309       set TEMP=%cd%\tmp
310
311     - set PATH=C:\msys64\usr\bin;%PATH%
312     - python .gitlab/fix-submodules.py
313     - git submodule sync --recursive
314     - git submodule update --init --recursive
315     - git checkout .gitmodules
316     - bash .gitlab/win32-init.sh
317   after_script:
318     - rd /s /q tmp
319     - robocopy /np /nfl /ndl /e "%APPDATA%\cabal" cabal-cache
320     - bash -c 'make clean || true'
321   dependencies: []
322   cache:
323     paths:
324       - cabal-cache
325       - ghc-8.6.2
326       - ghc-tarballs
327
328 validate-x86_64-windows-hadrian:
329   extends: .validate-windows
330   stage: full-build
331   variables:
332     GHC_VERSION: "8.6.2"
333     LANG: "en_US.UTF-8"
334   script:
335     - |
336       set MSYSTEM=MINGW64
337       python boot
338       bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex'
339       mkdir -p _build
340       cp -R inplace/mingw _build/mingw
341     - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --flavour=Quick"
342     # FIXME: Bindist disabled due to #16073
343     #- bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh binary-dist"
344     # FIXME: Testsuite disabled due to #16156.
345     #- bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
346   cache:
347     key: x86_64-windows
348   tags:
349     - x86_64-windows
350
351 validate-x86_64-windows:
352   extends: .validate-windows
353   stage: full-build
354   # due to #16084
355   allow_failure: true
356   variables:
357     GHC_VERSION: "8.6.2"
358     LANG: "en_US.UTF-8"
359   script:
360     - |
361       set MSYSTEM=MINGW64
362       python boot
363       bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex'
364     - bash -c "echo include mk/flavours/quick.mk > mk/build.mk"
365     - bash -c "PATH=`pwd`/toolchain/bin:$PATH make -j`mk/detect-cpu-count.sh`"
366     - |
367       bash -c "make binary-dist TAR_COMP_OPTS=-1"
368       mv ghc-*.tar.xz ghc.tar.xz
369     - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
370   cache:
371     key: x86_64-windows
372   tags:
373     - x86_64-windows
374   artifacts:
375     when: always
376     reports:
377       junit: junit.xml
378     paths:
379       - ghc.tar.xz
380       - junit.xml
381
382 # Note [Cleaning up after shell executor]
383 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
384 #
385 # As noted in [1], gitlab-runner's shell executor doesn't clean up its working
386 # directory after builds. Unfortunately, we are forced to use the shell executor
387 # on Windows. To avoid running out of disk space we add a stage at the end of
388 # the build to remove the \GitLabRunner\builds directory. Since we only run a
389 # single build at a time on Windows this should be safe.
390 #
391 # [1] https://gitlab.com/gitlab-org/gitlab-runner/issues/3856
392
393 # See Note [Cleanup after shell executor]
394 cleanup-windows:
395   stage: cleanup
396   tags:
397     - x86_64-windows
398   when: always
399   dependencies: []
400   before_script:
401     - echo "Time to clean up"
402   script:
403     - echo "Let's go"
404   after_script:
405     - set "BUILD_DIR=%CI_PROJECT_DIR%"
406     - set "BUILD_DIR=%BUILD_DIR:/=\%"
407     - echo "Cleaning %BUILD_DIR%"
408     - cd \GitLabRunner
409     # This is way more complicated than it should be:
410     # See https://stackoverflow.com/questions/1965787
411     - del %BUILD_DIR%\* /F /Q
412     - for /d %%p in (%BUILD_DIR%\*) do rd /Q /S "%%p"
413     - exit /b 0
414
415 # See Note [Cleanup after shell executor]
416 cleanup-darwin:
417   stage: cleanup
418   tags:
419     - x86_64-darwin
420   when: always
421   before_script:
422     - echo "Time to clean up"
423   script:
424     - echo "Let's go"
425   after_script:
426     - BUILD_DIR=$CI_PROJECT_DIR
427     - echo "Cleaning $BUILD_DIR"
428     - cd $HOME
429     - rm -Rf $BUILD_DIR/*
430     - exit 0
431