Fix #16116 by removing badAssocRhs
[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   tags:
46     - lint
47
48 ############################################################
49 # Validation via Pipelines (hadrian)
50 ############################################################
51
52 .validate-hadrian:
53   allow_failure: true
54   script:
55     - git clean -xdf && git submodule foreach git clean -xdf
56     - bash .circleci/prepare-system.sh
57     - if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
58     - ./boot
59     - ./configure $CONFIGURE_ARGS
60     - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh`
61   cache:
62     key: hadrian
63     paths:
64       - cabal-cache
65
66 validate-x86_64-linux-deb8-hadrian:
67   extends: .validate-hadrian
68   stage: build
69   image: ghcci/x86_64-linux-deb8:0.1
70   before_script:
71     # workaround for docker permissions
72     - sudo chown ghc:ghc -R .
73     - python3 .gitlab/fix-submodules.py
74     - git submodule sync --recursive
75     - git submodule update --init --recursive
76     - git checkout .gitmodules
77   tags:
78     - x86_64-linux
79
80 ############################################################
81 # Validation via Pipelines (make)
82 ############################################################
83
84 .validate:
85   variables:
86     TEST_TYPE: test
87   before_script:
88     - git clean -xdf && git submodule foreach git clean -xdf
89   script:
90     - ./boot
91     - ./configure $CONFIGURE_ARGS
92     - |
93       THREADS=`mk/detect-cpu-count.sh`
94       make V=0 -j$THREADS
95     - |
96       make binary-dist TAR_COMP_OPTS="-1"
97       mv ghc-*.tar.xz ghc.tar.xz
98     - |
99       THREADS=`mk/detect-cpu-count.sh`
100       make $TEST_TYPE THREADS=$THREADS JUNIT_FILE=../../junit.xml
101   artifacts:
102     reports:
103       junit: junit.xml
104     expire_in: 2 week
105     paths:
106       - ghc.tar.xz
107       - junit.xml
108
109 validate-x86_64-darwin:
110   extends: .validate
111   stage: full-build
112   allow_failure: true
113   tags:
114     - x86_64-darwin
115   variables:
116     GHC_VERSION: 8.6.3
117     MACOSX_DEPLOYMENT_TARGET: "10.7"
118     # Only Sierra and onwards supports clock_gettime. See #12858
119     ac_cv_func_clock_gettime: "no"
120     LANG: "en_US.UTF-8"
121   before_script:
122     - git clean -xdf && git submodule foreach git clean -xdf
123     - python3 .gitlab/fix-submodules.py
124     - git submodule sync --recursive
125     - git submodule update --init --recursive
126     - git checkout .gitmodules
127
128     - bash .gitlab/darwin-init.sh
129     - PATH="`pwd`/toolchain/bin:$PATH"
130     - echo "libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-intree-gmp" >> mk/build.mk
131   after_script:
132     - cp -Rf $HOME/.cabal cabal-cache
133   artifacts:
134     when: always
135     expire_in: 2 week
136   cache:
137     key: darwin
138     paths:
139       - cabal-cache
140       - toolchain
141
142 .validate-linux:
143   extends: .validate
144   tags:
145     - x86_64-linux
146   before_script:
147     - git clean -xdf && git submodule foreach git clean -xdf
148     - python3 .gitlab/fix-submodules.py
149     - git submodule sync --recursive
150     - git submodule update --init --recursive
151     - git checkout .gitmodules
152
153     - bash .circleci/prepare-system.sh
154     # workaround for docker permissions
155     - sudo chown ghc:ghc -R .
156   after_script:
157     - cp -Rf $HOME/.cabal cabal-cache
158   cache:
159     key: linux
160     paths:
161       - cabal-cache
162       - toolchain
163
164 validate-aarch64-linux-deb9:
165   extends: .validate-linux
166   stage: full-build
167   image: ghcci/aarch64-linux-deb9:0.1
168   allow_failure: true
169   artifacts:
170     when: always
171     expire_in: 2 week
172   cache:
173     key: linux-aarch64-deb9
174   tags:
175     - aarch64-linux
176
177 nightly-aarch64-linux-deb9:
178   extends: validate-aarch64-linux-deb9
179   stage: full-build
180   artifacts:
181     expire_in: 2 year
182   variables:
183     TEST_TYPE: slowtest
184   only:
185     variables:
186       - $NIGHTLY
187
188 validate-i386-linux-deb9:
189   extends: .validate-linux
190   stage: full-build
191   image: ghcci/i386-linux-deb9:0.1
192   allow_failure: true
193   artifacts:
194     when: always
195     expire_in: 2 week
196   cache:
197     key: linux-i386-deb9
198
199 nightly-i386-linux-deb9:
200   extends: .validate-linux
201   stage: full-build
202   image: ghcci/i386-linux-deb9:0.1
203   allow_failure: true
204   variables:
205     TEST_TYPE: slowtest
206   artifacts:
207     when: always
208     expire_in: 2 week
209   only:
210     variables:
211       - $NIGHTLY
212   cache:
213     key: linux-i386-deb9
214
215 validate-x86_64-linux-deb9:
216   extends: .validate-linux
217   stage: build
218   image: ghcci/x86_64-linux-deb9:0.2
219   artifacts:
220     when: always
221     expire_in: 2 week
222   cache:
223     key: linux-x86_64-deb9
224
225 nightly-x86_64-linux-deb9:
226   extends: validate-x86_64-linux-deb9
227   stage: build
228   artifacts:
229     expire_in: 2 year
230   variables:
231     TEST_TYPE: slowtest
232   only:
233     variables:
234       - $NIGHTLY
235
236 validate-x86_64-linux-deb9-llvm:
237   extends: .validate-linux
238   stage: full-build
239   allow_failure: true
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   cache:
322     paths:
323       - cabal-cache
324       - ghc-8.6.2
325       - ghc-tarballs
326
327 validate-x86_64-windows-hadrian:
328   extends: .validate-windows
329   stage: full-build
330   # due to #16073
331   allow_failure: true
332   variables:
333     GHC_VERSION: "8.6.2"
334     LANG: "en_US.UTF-8"
335   script:
336     - |
337       set MSYSTEM=MINGW64
338       python boot
339       bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex'
340       mkdir -p _build
341       cp -R inplace/mingw _build/mingw
342     # FIXME: --no-lint due to #15950
343     - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --flavour=Quick --no-lint"
344     - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh binary-dist"
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     - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
367   cache:
368     key: x86_64-windows
369   tags:
370     - x86_64-windows
371
372 # Note [Cleanup on Windows]
373 # ~~~~~~~~~~~~~~~~~~~~~~~~~
374 #
375 # As noted in [1], gitlab-runner's shell executor doesn't clean up its working
376 # directory after builds. Unfortunately, we are forced to use the shell executor
377 # on Windows. To avoid running out of disk space we add a stage at the end of
378 # the build to remove the \GitLabRunner\builds directory. Since we only run a
379 # single build at a time on Windows this should be safe.
380 #
381 # [1] https://gitlab.com/gitlab-org/gitlab-runner/issues/3856
382
383 # See Note [Cleanup on Windows]
384 cleanup-windows:
385   stage: cleanup
386   tags:
387     - x86_64-windows
388   when: always
389   before_script:
390     - echo "Time to clean up"
391   script:
392     - echo "Let's go"
393   after_script:
394     - set "BUILD_DIR=%CI_PROJECT_DIR%"
395     - set "BUILD_DIR=%BUILD_DIR:/=\%"
396     - echo "Cleaning %BUILD_DIR%"
397     - cd \GitLabRunner
398     - rmdir /S /Q %BUILD_DIR%/*
399     - exit /b 0
400
401 ############################################################
402 # Validation via CircleCI
403 ############################################################
404
405 .circleci:
406   stage: build
407   image: ghcci/x86_64-linux-deb8:0.1
408   artifacts:
409     when: always
410     expire_in: 2 week
411     reports:
412       junit: junit.xml
413     paths:
414       - ghc.tar.xz
415       - junit.xml
416   tags:
417     - circleci
418
419 # All validation jobs keep the bindists and test results are artifacts,
420 # when we get far enough to generate them.
421 #
422 # This requires updating the maximum artifacts size limit in Gitlab to
423 # something like 200MB.
424
425 .circleci-validate-x86_64-darwin:
426   extends: .circleci
427   stage: full-build
428   allow_failure: true
429   script: ".gitlab/circle-ci-job.sh validate-x86_64-darwin"