Fix CONLIKE typo
[ghc.git] / .gitlab-ci.yml
1 variables:
2   GIT_SSL_NO_VERIFY: "1"
3
4   # Commit of ghc/ci-images repository from which to pull Docker images
5   DOCKER_REV: e517150438cd9df9564fb91adc4b42e2667b2bc1
6
7   # Sequential version number capturing the versions of all tools fetched by
8   # .gitlab/win32-init.sh.
9   WINDOWS_TOOLCHAIN_VERSION: 1
10
11   # Disable shallow clones; they break our linting rules
12   GIT_DEPTH: 0
13
14 before_script:
15   - git submodule sync --recursive
16   - git submodule update --init --recursive
17   - git checkout .gitmodules
18   - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
19
20 stages:
21   - lint       # Source linting
22   - build      # A quick smoke-test to weed out broken commits
23   - full-build # Build all the things
24   - cleanup    # See Note [Cleanup after the shell executor]
25   - packaging  # Source distribution, etc.
26   - testing    # head.hackage correctness and compiler performance testing
27   - deploy     # push documentation
28
29 # N.B.Don't run on wip/ branches, instead on run on merge requests.
30 .only-default: &only-default
31   only:
32     - master
33     - /ghc-[0-9]+\.[0-9]+/
34     - merge_requests
35     - tags
36     - web
37
38 ############################################################
39 # Runner Tags
40 ############################################################
41 #
42 # * x86_64-linux: Any Docker-capable x86_64 Linux machine
43 # * aarch64-linux: Any Docker-capable AArch64 Linux machine
44 # * x86_64-windows: A x86_64 Windows machine
45 # * lint: Any Docker-capable x86_64 Linux machine; distinct from
46 #         x86_64-linux to ensure low-latency availability.
47 #
48
49
50 ############################################################
51 # Linting
52 ############################################################
53
54 ghc-linters:
55   stage: lint
56   image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
57   script:
58     - git fetch "$CI_MERGE_REQUEST_PROJECT_URL" $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
59     - base="$(git merge-base FETCH_HEAD $CI_COMMIT_SHA)"
60     - "echo Linting changes between $base..$CI_COMMIT_SHA"
61     #    - validate-commit-msg .git $(git rev-list $base..$CI_COMMIT_SHA)
62     - validate-whitespace .git $(git rev-list $base..$CI_COMMIT_SHA)
63     - .gitlab/linters/check-makefiles.py $base $CI_COMMIT_SHA
64     - .gitlab/linters/check-cpp.py $base $CI_COMMIT_SHA
65     - .gitlab/linters/check-version-number.sh
66   dependencies: []
67   tags:
68     - lint
69   only:
70     refs:
71       - merge_requests
72
73 # Run mypy Python typechecker on linter scripts.
74 lint-linters:
75   <<: *only-default
76   stage: lint
77   image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
78   script:
79     - mypy .gitlab/linters/*.py
80   dependencies: []
81   tags:
82     - lint
83
84 # Check that .T files all parse by listing broken tests.
85 lint-testsuite:
86   <<: *only-default
87   stage: lint
88   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
89   script:
90     - make -Ctestsuite list_broken TEST_HC=ghc
91   dependencies: []
92   tags:
93     - lint
94
95 # Run mypy Python typechecker on testsuite driver
96 typecheck-testsuite:
97   <<: *only-default
98   stage: lint
99   image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
100   script:
101     - mypy testsuite/driver/runtests.py
102   dependencies: []
103   tags:
104     - lint
105
106 # We allow the submodule checker to fail when run on merge requests (to
107 # accomodate, e.g., haddock changes not yet upstream) but not on `master` or
108 # Marge jobs.
109 .lint-submods:
110   <<: *only-default
111   stage: lint
112   image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
113   script:
114     - git fetch "$CI_MERGE_REQUEST_PROJECT_URL" $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
115     - base="$(git merge-base FETCH_HEAD $CI_COMMIT_SHA)"
116     - "echo Linting submodule changes between $base..$CI_COMMIT_SHA"
117     - git submodule foreach git remote update
118       # TODO: Fix submodule linter
119     - submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA) || true
120   dependencies: []
121   tags:
122     - lint
123
124 lint-submods-marge:
125   extends: .lint-submods
126   only:
127     refs:
128       - merge_requests
129     variables:
130       - "$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/"
131
132 lint-submods-mr:
133   extends: .lint-submods
134   # Allow failure since any necessary submodule patches may not be upstreamed
135   # yet.
136   allow_failure: true
137   only:
138     refs:
139       - merge_requests
140   except:
141     variables:
142       - "$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/"
143
144 lint-submods-branch:
145   extends: .lint-submods
146   script:
147     - "echo Linting submodule changes between $CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA"
148     - git submodule foreach git remote update
149     - submodchecker .git $(git rev-list $CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA)
150   only:
151     refs:
152       - master
153       - /ghc-[0-9]+\.[0-9]+/
154
155 .lint-changelogs:
156   <<: *only-default
157   stage: lint
158   image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
159   dependencies: []
160   tags:
161     - lint
162   script:
163     - |
164       grep TBA libraries/*/changelog.md && (
165           echo "Error: Found \"TBA\"s in changelogs."
166           exit 1
167       )
168
169 lint-changelogs:
170   extends: .lint-changelogs
171   # Allow failure since this isn't a final release.
172   allow_failure: true
173   only:
174     refs:
175       - /ghc-[0-9]+\.[0-9]+/
176
177 lint-release-changelogs:
178   extends: .lint-changelogs
179   only:
180     refs:
181       - /ghc-[0-9]+\.[0-9]+\.[0-9]+-.*/
182
183
184 ############################################################
185 # Validation via Pipelines (hadrian)
186 ############################################################
187
188 .validate-hadrian:
189   <<: *only-default
190   script:
191     - cabal update
192     - git clean -xdf && git submodule foreach git clean -xdf
193     - .gitlab/prepare-system.sh
194     - if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
195     - ./boot
196     - ./configure $CONFIGURE_ARGS
197     - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --docs=no-sphinx binary-dist
198     - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --docs=no-sphinx test --summary-junit=./junit.xml
199     - mv _build/bindist/ghc*.tar.xz ghc.tar.xz
200   cache:
201     key: hadrian
202     paths:
203       - cabal-cache
204   artifacts:
205     reports:
206       junit: junit.xml
207     expire_in: 2 week
208     paths:
209       - ghc.tar.xz
210       - junit.xml
211
212 validate-x86_64-linux-deb9-hadrian:
213   extends: .validate-hadrian
214   stage: build
215   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
216   before_script:
217     # workaround for docker permissions
218     - sudo chown ghc:ghc -R .
219     - git submodule sync --recursive
220     - git submodule update --init --recursive
221     - git checkout .gitmodules
222     - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
223   tags:
224     - x86_64-linux
225
226 hadrian-ghc-in-ghci:
227   <<: *only-default
228   stage: build
229   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
230   before_script:
231     # workaround for docker permissions
232     - sudo chown ghc:ghc -R .
233     - git submodule sync --recursive
234     - git submodule update --init --recursive
235     - git checkout .gitmodules
236   tags:
237     - x86_64-linux
238   script:
239     - cabal update
240     - cd hadrian; cabal new-build --project-file=ci.project; cd ..
241     - git clean -xdf && git submodule foreach git clean -xdf
242     - .gitlab/prepare-system.sh
243     - if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
244     - ./boot
245     - ./configure $CONFIGURE_ARGS
246     # Load ghc-in-ghci then immediately exit and check the modules loaded
247     - echo ":q" | hadrian/ghci.sh | tail -n2 | grep "Ok,"
248   cache:
249     key: hadrian-ghci
250     paths:
251       - cabal-cache
252
253 ############################################################
254 # Validation via Pipelines (make)
255 ############################################################
256
257 .validate:
258   <<: *only-default
259   variables:
260     TEST_TYPE: test
261   before_script:
262     - git clean -xdf && git submodule foreach git clean -xdf
263   script:
264     - ./boot
265     - ./configure $CONFIGURE_ARGS
266     - |
267       THREADS=`mk/detect-cpu-count.sh`
268       make V=0 -j$THREADS WERROR=-Werror
269     - |
270       make bindisttest
271     - |
272       make binary-dist TAR_COMP_OPTS="-1"
273     - |
274       # Prepare to push git notes.
275       METRICS_FILE=$(mktemp)
276       git config user.email "ben+ghc-ci@smart-cactus.org"
277       git config user.name "GHC GitLab CI"
278     - |
279       THREADS=`mk/detect-cpu-count.sh`
280       make $TEST_TYPE THREADS=$THREADS JUNIT_FILE=../../junit.xml METRICS_FILE=$METRICS_FILE
281     - |
282       # Push git notes.
283       METRICS_FILE=$METRICS_FILE .gitlab/push-test-metrics.sh
284   dependencies: []
285   artifacts:
286     reports:
287       junit: junit.xml
288     expire_in: 2 week
289     paths:
290       - ghc-*.tar.xz
291       - junit.xml
292
293 #################################
294 # x86_64-darwin
295 #################################
296
297 validate-x86_64-darwin:
298   extends: .validate
299   stage: full-build
300   tags:
301     - x86_64-darwin
302   variables:
303     GHC_VERSION: 8.6.5
304     CABAL_INSTALL_VERSION: 2.4.1.0
305     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-apple-darwin.tar.xz"
306     MACOSX_DEPLOYMENT_TARGET: "10.7"
307     # Only Sierra and onwards supports clock_gettime. See #12858
308     ac_cv_func_clock_gettime: "no"
309     LANG: "en_US.UTF-8"
310     CONFIGURE_ARGS: --with-intree-gmp
311     TEST_ENV: "x86_64-darwin"
312   before_script:
313     - git clean -xdf && git submodule foreach git clean -xdf
314     - git submodule sync --recursive
315     - git submodule update --init --recursive
316     - git checkout .gitmodules
317     - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
318
319     - bash .gitlab/darwin-init.sh
320     - PATH="`pwd`/toolchain/bin:$PATH"
321   after_script:
322     - cp -Rf $HOME/.cabal cabal-cache
323   artifacts:
324     when: always
325     expire_in: 2 week
326   cache:
327     key: "darwin-$GHC_VERSION"
328     paths:
329       - cabal-cache
330       - toolchain
331
332 # Disabled because of OS X CI capacity
333 .validate-x86_64-darwin-hadrian:
334   <<: *only-default
335   stage: full-build
336   tags:
337     - x86_64-darwin
338   variables:
339     GHC_VERSION: 8.6.3
340     MACOSX_DEPLOYMENT_TARGET: "10.7"
341     ac_cv_func_clock_gettime: "no"
342     LANG: "en_US.UTF-8"
343     CONFIGURE_ARGS: --with-intree-gmp
344     TEST_ENV: "x86_64-darwin"
345   before_script:
346     - git clean -xdf && git submodule foreach git clean -xdf
347     - git submodule sync --recursive
348     - git submodule update --init --recursive
349     - git checkout .gitmodules
350     - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
351
352     - bash .gitlab/darwin-init.sh
353     - PATH="`pwd`/toolchain/bin:$PATH"
354   script:
355     - cabal update
356     - ./boot
357     - ./configure $CONFIGURE_ARGS
358     - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --docs=no-sphinx binary-dist
359     - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --docs=no-sphinx test --summary-junit=./junit.xml
360     - mv _build/bindist/ghc*.tar.xz ghc.tar.xz
361   after_script:
362     - cp -Rf $HOME/.cabal cabal-cache
363   artifacts:
364     when: always
365     expire_in: 2 week
366     reports:
367       junit: junit.xml
368     paths:
369       - ghc.tar.xz
370       - junit.xml
371
372 .validate-linux:
373   extends: .validate
374   tags:
375     - x86_64-linux
376   before_script:
377     - git clean -xdf && git submodule foreach git clean -xdf
378     - git submodule sync --recursive
379     - git submodule update --init --recursive
380     - git checkout .gitmodules
381     - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
382       # Build hyperlinked sources for documentation when building releases
383     - |
384       if [[ -n "$CI_COMMIT_TAG" ]]; then
385         echo "EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump" >> mk/build.mk
386       fi
387
388     - .gitlab/prepare-system.sh
389     # workaround for docker permissions
390     - sudo chown ghc:ghc -R .
391   after_script:
392     - cp -Rf $HOME/.cabal cabal-cache
393   cache:
394     key: linux
395     paths:
396       - cabal-cache
397       - toolchain
398
399 #################################
400 # aarch64-linux-deb9
401 #################################
402
403 .build-aarch64-linux-deb9:
404   extends: .validate-linux
405   stage: full-build
406   image: "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb9:$DOCKER_REV"
407   allow_failure: true
408   variables:
409     TEST_ENV: "aarch64-linux-deb9"
410     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-aarch64-linux-deb9.tar.xz"
411     # Inexplicably makeindex fails
412     BUILD_SPHINX_PDF: "NO"
413   cache:
414     key: linux-aarch64-deb9
415   tags:
416     - aarch64-linux
417
418 validate-aarch64-linux-deb9:
419   extends: .build-aarch64-linux-deb9
420   artifacts:
421     when: always
422     expire_in: 2 week
423
424 nightly-aarch64-linux-deb9:
425   extends: .build-aarch64-linux-deb9
426   artifacts:
427     expire_in: 2 year
428   variables:
429     TEST_TYPE: slowtest
430   only:
431     variables:
432       - $NIGHTLY
433
434 #################################
435 # i386-linux-deb9
436 #################################
437
438 .build-i386-linux-deb9:
439   extends: .validate-linux
440   stage: full-build
441   image: "registry.gitlab.haskell.org/ghc/ci-images/i386-linux-deb9:$DOCKER_REV"
442   variables:
443     TEST_ENV: "i386-linux-deb9"
444     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-i386-deb9-linux.tar.xz"
445   cache:
446     key: linux-i386-deb9
447
448 validate-i386-linux-deb9:
449   extends: .build-i386-linux-deb9
450   artifacts:
451     when: always
452     expire_in: 2 week
453
454 nightly-i386-linux-deb9:
455   extends: .build-i386-linux-deb9
456   variables:
457     TEST_TYPE: slowtest
458   artifacts:
459     when: always
460     expire_in: 2 week
461   only:
462     variables:
463       - $NIGHTLY
464
465 #################################
466 # x86_64-linux-deb9
467 #################################
468
469 .build-x86_64-linux-deb9:
470   extends: .validate-linux
471   stage: full-build
472   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
473   variables:
474     TEST_ENV: "x86_64-linux-deb9"
475     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-deb9-linux.tar.xz"
476   cache:
477     key: linux-x86_64-deb9
478
479 # Disabled to reduce CI load
480 .validate-x86_64-linux-deb9:
481   extends: .build-x86_64-linux-deb9
482   artifacts:
483     when: always
484     expire_in: 2 week
485
486 nightly-x86_64-linux-deb9:
487   extends: .build-x86_64-linux-deb9
488   artifacts:
489     expire_in: 2 year
490   variables:
491     TEST_TYPE: slowtest
492   only:
493     variables:
494       - $NIGHTLY
495
496 # N.B. Has DEBUG assertions enabled in stage2
497 validate-x86_64-linux-deb9-debug:
498   extends: .build-x86_64-linux-deb9
499   stage: build
500   variables:
501     BUILD_FLAVOUR: validate
502     # Ensure that stage2 also has DEBUG enabled
503     ValidateSpeed: SLOW
504     # Override validate flavour default; see #16890.
505     BUILD_SPHINX_PDF: "YES"
506     TEST_TYPE: slowtest
507     TEST_ENV: "x86_64-linux-deb9-debug"
508   artifacts:
509     when: always
510     expire_in: 2 week
511
512 # Disabled to alleviate CI load
513 .validate-x86_64-linux-deb9-llvm:
514   extends: .build-x86_64-linux-deb9
515   stage: full-build
516   variables:
517     BUILD_FLAVOUR: perf-llvm
518     TEST_ENV: "x86_64-linux-deb9-llvm"
519
520 nightly-x86_64-linux-deb9-llvm:
521   extends: .build-x86_64-linux-deb9
522   stage: full-build
523   variables:
524     BUILD_FLAVOUR: perf-llvm
525     TEST_ENV: "x86_64-linux-deb9-llvm"
526   only:
527     variables:
528       - $NIGHTLY
529
530 validate-x86_64-linux-deb9-integer-simple:
531   extends: .build-x86_64-linux-deb9
532   stage: full-build
533   variables:
534     INTEGER_LIBRARY: integer-simple
535     TEST_ENV: "x86_64-linux-deb9-integer-simple"
536     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-deb9-linux-integer-simple.tar.xz"
537
538 nightly-x86_64-linux-deb9-integer-simple:
539   extends: .build-x86_64-linux-deb9
540   stage: full-build
541   variables:
542     INTEGER_LIBRARY: integer-simple
543     TEST_ENV: "x86_64-linux-deb9-integer-simple"
544     TEST_TYPE: slowtest
545   artifacts:
546     expire_in: 2 year
547   only:
548     variables:
549       - $NIGHTLY
550
551 validate-x86_64-linux-deb9-unreg:
552   extends: .build-x86_64-linux-deb9
553   stage: full-build
554   variables:
555     CONFIGURE_ARGS: --enable-unregisterised
556     TEST_ENV: "x86_64-linux-deb9-unreg"
557
558 release-x86_64-linux-deb9-dwarf:
559   extends: .validate-linux
560   stage: build
561   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
562   variables:
563     CONFIGURE_ARGS: "--enable-dwarf-unwind"
564     BUILD_FLAVOUR: dwarf
565     TEST_ENV: "x86_64-linux-deb9-dwarf"
566   artifacts:
567     when: always
568     expire_in: 2 week
569   cache:
570     key: linux-x86_64-deb9
571
572
573 #################################
574 # x86_64-linux-deb8
575 #################################
576
577 release-x86_64-linux-deb8:
578   extends: .validate-linux
579   stage: full-build
580   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb8:$DOCKER_REV"
581   variables:
582     TEST_ENV: "x86_64-linux-deb8"
583     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-deb8-linux.tar.xz"
584   only:
585     - tags
586   cache:
587     key: linux-x86_64-deb8
588   artifacts:
589     when: always
590     expire_in: 2 week
591
592 #################################
593 # x86_64-linux-alpine
594 #################################
595
596 .build-x86_64-linux-alpine:
597   extends: .validate-linux
598   stage: full-build
599   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine:$DOCKER_REV"
600   # There are currently a few failing tests
601   allow_failure: true
602   variables:
603     BUILD_SPHINX_PDF: "NO"
604     TEST_ENV: "x86_64-linux-alpine"
605     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-alpine-linux.tar.xz"
606     # Can't use ld.gold due to #13958.
607     CONFIGURE_ARGS: "--disable-ld-override"
608   cache:
609     key: linux-x86_64-alpine
610   artifacts:
611     when: always
612     expire_in: 2 week
613
614 release-x86_64-linux-alpine:
615   extends: .build-x86_64-linux-alpine
616   only:
617     - tags
618
619 nightly-x86_64-linux-alpine:
620   extends: .build-x86_64-linux-alpine
621   only:
622     variables:
623       - $NIGHTLY
624
625 #################################
626 # x86_64-linux-centos7
627 #################################
628
629 release-x86_64-linux-centos7:
630   extends: .validate-linux
631   stage: full-build
632   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-centos7:$DOCKER_REV"
633   variables:
634     # The sphinx release shipped with Centos 7 fails to build out documentation
635     BUILD_SPHINX_HTML: "NO"
636     BUILD_SPHINX_PDF: "NO"
637     TEST_ENV: "x86_64-linux-centos7"
638     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-centos7-linux.tar.xz"
639   only:
640     - tags
641   cache:
642     key: linux-x86_64-centos7
643   artifacts:
644     when: always
645     expire_in: 2 week
646
647 #################################
648 # x86_64-linux-fedora27
649 #################################
650
651 validate-x86_64-linux-fedora27:
652   extends: .validate-linux
653   stage: full-build
654   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora27:$DOCKER_REV"
655   variables:
656     TEST_ENV: "x86_64-linux-fedora27"
657     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-fedora27-linux.tar.xz"
658   cache:
659     key: linux-x86_64-fedora27
660   artifacts:
661     when: always
662     expire_in: 2 week
663
664 ############################################################
665 # Validation via Pipelines (Windows)
666 ############################################################
667
668 .build-windows:
669   <<: *only-default
670   before_script:
671     - git clean -xdf
672     - git submodule foreach git clean -xdf
673
674     # Use a local temporary directory to ensure that concurrent builds don't
675     # interfere with one another
676     - |
677       mkdir tmp
678       set TMP=%cd%\tmp
679       set TEMP=%cd%\tmp
680
681     - set PATH=C:\msys64\usr\bin;%PATH%
682     - git submodule sync --recursive
683     - git submodule update --init --recursive
684     - git checkout .gitmodules
685     - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
686     - bash .gitlab/win32-init.sh
687   after_script:
688     - rd /s /q tmp
689     - robocopy /np /nfl /ndl /e "%APPDATA%\cabal" cabal-cache
690     - bash -c 'make clean || true'
691   dependencies: []
692   variables:
693     FORCE_SYMLINKS: 1
694     LANG: "en_US.UTF-8"
695     SPHINXBUILD: "/mingw64/bin/sphinx-build.exe"
696   cache:
697     paths:
698       - cabal-cache
699       - ghc-8.6.5
700       - ghc-tarballs
701
702 .build-windows-hadrian:
703   extends: .build-windows
704   stage: full-build
705   variables:
706     GHC_VERSION: "8.6.5"
707   # due to #16574 this currently fails
708   allow_failure: true
709   script:
710     - |
711       python boot
712       bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex'
713     - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --flavour=Quick --docs=no-sphinx binary-dist"
714     - mv _build/bindist/ghc*.tar.xz ghc.tar.xz
715     - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --flavour=quick test --summary-junit=./junit.xml --skip-perf"
716     # skipping perf tests for now since we build a quick-flavoured GHC,
717     # which might result in some broken perf tests?
718   tags:
719     - x86_64-windows
720   artifacts:
721     reports:
722       junit: junit.xml
723     expire_in: 2 week
724     when: always
725     paths:
726       - ghc.tar.xz
727       - junit.xml
728
729 validate-x86_64-windows-hadrian:
730   extends: .build-windows-hadrian
731   variables:
732     MSYSTEM: MINGW64
733   cache:
734     key: "x86_64-windows-hadrian-$WINDOWS_TOOLCHAIN_VERSION"
735
736 nightly-i386-windows-hadrian:
737   extends: .build-windows-hadrian
738   variables:
739     MSYSTEM: MINGW32
740   only:
741     variables:
742       - $NIGHTLY
743   cache:
744     key: "i386-windows-hadrian-$WINDOWS_TOOLCHAIN_VERSION"
745
746 .build-windows-make:
747   extends: .build-windows
748   stage: full-build
749   # due to #16084
750   allow_failure: true
751   variables:
752     BUILD_FLAVOUR: "quick"
753     GHC_VERSION: "8.6.5"
754     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-mingw32.tar.xz"
755   script:
756     - |
757       python boot
758       bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex $CONFIGURE_ARGS'
759     - bash -c "echo include mk/flavours/${BUILD_FLAVOUR}.mk > mk/build.mk"
760     - bash -c "echo 'GhcLibHcOpts+=-haddock' >> mk/build.mk"
761     - bash -c "PATH=`pwd`/toolchain/bin:$PATH make -j`mk/detect-cpu-count.sh`"
762     - bash -c "PATH=`pwd`/toolchain/bin:$PATH make bindisttest"
763     - bash -c "PATH=`pwd`/toolchain/bin:$PATH make binary-dist TAR_COMP_OPTS=-1"
764     - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
765   tags:
766     - x86_64-windows
767   artifacts:
768     when: always
769     expire_in: 2 week
770     reports:
771       junit: junit.xml
772     paths:
773       - ghc-*.tar.xz
774       - junit.xml
775
776 validate-x86_64-windows:
777   extends: .build-windows-make
778   variables:
779     MSYSTEM: MINGW64
780     CONFIGURE_ARGS: "--target=x86_64-unknown-mingw32"
781   cache:
782     key: "x86_64-windows-$WINDOWS_TOOLCHAIN_VERSION"
783
784 nightly-x86_64-windows:
785   extends: .build-windows-make
786   stage: full-build
787   variables:
788     BUILD_FLAVOUR: "validate"
789     MSYSTEM: MINGW64
790     CONFIGURE_ARGS: "--target=x86_64-unknown-mingw32"
791   only:
792     variables:
793       - $NIGHTLY
794   cache:
795     key: "x86_64-windows-$WINDOWS_TOOLCHAIN_VERSION"
796
797 # Normal Windows validate builds are profiled; that won't do for releases.
798 release-x86_64-windows:
799   extends: validate-x86_64-windows
800   variables:
801     MSYSTEM: MINGW64
802     BUILD_FLAVOUR: "perf"
803     CONFIGURE_ARGS: "--target=x86_64-unknown-mingw32"
804   only:
805     - tags
806
807 release-i386-windows:
808   extends: .build-windows-make
809   only:
810     - tags
811   variables:
812     MSYSTEM: MINGW32
813     BUILD_FLAVOUR: "perf"
814     CONFIGURE_ARGS: "--target=i386-unknown-mingw32"
815     # Due to #15934
816     BUILD_PROF_LIBS: "NO"
817   cache:
818     key: "i386-windows-$WINDOWS_TOOLCHAIN_VERSION"
819
820 nightly-i386-windows:
821   extends: .build-windows-make
822   only:
823     variables:
824       - $NIGHTLY
825   variables:
826     MSYSTEM: MINGW32
827     CONFIGURE_ARGS: "--target=i386-unknown-mingw32"
828     # Due to #15934
829     BUILD_PROF_LIBS: "NO"
830   cache:
831     key: "i386-windows-$WINDOWS_TOOLCHAIN_VERSION"
832
833 ############################################################
834 # Cleanup
835 ############################################################
836
837 # Note [Cleaning up after shell executor]
838 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
839 #
840 # As noted in [1], gitlab-runner's shell executor doesn't clean up its working
841 # directory after builds. Unfortunately, we are forced to use the shell executor
842 # on Darwin. To avoid running out of disk space we add a stage at the end of
843 # the build to remove the /.../GitLabRunner/builds directory. Since we only run a
844 # single build at a time on Darwin this should be safe.
845 #
846 # We used to have a similar cleanup job on Windows as well however it ended up
847 # being quite fragile as we have multiple Windows builders yet there is no
848 # guarantee that the cleanup job is run on the same machine as the build itself
849 # was run. Consequently we were forced to instead handle cleanup with a separate
850 # cleanup cron job on Windows.
851 #
852 # [1] https://gitlab.com/gitlab-org/gitlab-runner/issues/3856
853
854 # See Note [Cleanup after shell executor]
855 cleanup-darwin:
856   <<: *only-default
857   stage: cleanup
858   tags:
859     - x86_64-darwin
860   when: always
861   dependencies: []
862   before_script:
863     - echo "Time to clean up"
864   script:
865     - echo "Let's go"
866   after_script:
867     - BUILD_DIR=$CI_PROJECT_DIR
868     - echo "Cleaning $BUILD_DIR"
869     - cd $HOME
870     - rm -Rf $BUILD_DIR/*
871     - exit 0
872
873 ############################################################
874 # Packaging
875 ############################################################
876
877 doc-tarball:
878   <<: *only-default
879   stage: packaging
880   tags:
881     - x86_64-linux
882   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
883   dependencies:
884     - validate-x86_64-linux-deb9-debug
885     - validate-x86_64-windows
886   variables:
887     LINUX_BINDIST: "ghc-x86_64-deb9-linux.tar.xz"
888     WINDOWS_BINDIST: "ghc-x86_64-mingw32.tar.xz"
889   # Due to Windows allow_failure
890   allow_failure: true
891   artifacts:
892     paths:
893       - haddock.html.tar.xz
894       - libraries.html.tar.xz
895       - users_guide.html.tar.xz
896       - index.html
897       - "*.pdf"
898   script:
899     - |
900       if [ ! -f "$LINUX_BINDIST" ]; then
901         echo "Error: $LINUX_BINDIST does not exist. Did the Debian 9 job fail?"
902         exit 1
903       fi
904       if [ ! -f "$WINDOWS_BINDIST" ]; then
905         echo "Error: $WINDOWS_BINDIST does not exist. Did the 64-bit Windows job fail?"
906         exit 1
907       fi
908     - rm -Rf docs
909     - bash -ex distrib/mkDocs/mkDocs $LINUX_BINDIST $WINDOWS_BINDIST
910     - ls -lh
911     - mv docs/*.tar.xz docs/index.html .
912
913 source-tarball:
914   stage: packaging
915   tags:
916     - x86_64-linux
917   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
918   dependencies: []
919   only:
920     - tags
921   artifacts:
922     paths:
923       - ghc-*.tar.xz
924       - version
925   script:
926     - mk/get-win32-tarballs.sh download all
927     - ./boot
928     - ./configure
929     - make sdist
930     - mv sdistprep/*.xz  .
931     - make show! --quiet VALUE=ProjectVersion > version
932     - source version
933     - echo "$ProjectVersion" > version
934
935
936 ############################################################
937 # Testing via head.hackage
938 ############################################################
939
940 # Triggering jobs in the ghc/head.hackage project requires that we have a job
941 # token for that repository. Furthermore the head.hackage CI job must have
942 # access to an unprivileged access token with the ability to query the ghc/ghc
943 # project such that it can find the job ID of the fedora27 job for the current
944 # pipeline.
945
946 .hackage:
947   <<: *only-default
948   stage: testing
949   image: ghcci/x86_64-linux-deb9:0.2
950   tags:
951     - x86_64-linux
952   dependencies: []
953   variables:
954     HEAD_HACKAGE_PROJECT_ID: "78"
955   script:
956     - bash .gitlab/start-head.hackage.sh
957
958 hackage:
959   extends: .hackage
960   when: manual
961
962 hackage-label:
963   extends: .hackage
964   only:
965     variables:
966       - $CI_MERGE_REQUEST_LABELS =~ /.*user-facing.*/
967
968 nightly-hackage:
969   extends: .hackage
970   only:
971     variables:
972       - $NIGHTLY
973
974 ############################################################
975 # Nofib testing
976 ############################################################
977
978 perf-nofib:
979   stage: testing
980   dependencies:
981     - release-x86_64-linux-deb9-dwarf
982   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
983   only:
984     refs:
985       - merge_requests
986       - master
987       - /ghc-[0-9]+\.[0-9]+/
988   tags:
989     - x86_64-linux
990   script:
991     - root=$(pwd)/ghc
992     - |
993       mkdir tmp
994       tar -xf ghc-*-x86_64-unknown-linux.tar.xz -C tmp
995       pushd tmp/ghc-*/
996       ./configure --prefix=$root
997       make install
998       popd
999       rm -Rf tmp
1000     - export BOOT_HC=$(which ghc)
1001     - cabal update; cabal install -w $BOOT_HC regex-compat
1002     - export PATH=$root/bin:$PATH
1003     - make -C nofib boot mode=fast -j$CPUS
1004     - "make -C nofib EXTRA_RUNTEST_OPTS='-cachegrind +RTS -V0 -RTS' NoFibRuns=1 mode=fast -j$CPUS 2>&1 | tee nofib.log"
1005   artifacts:
1006     expire_in: 12 week
1007     when: always
1008     paths:
1009       - nofib.log
1010
1011 ############################################################
1012 # Documentation deployment via GitLab Pages
1013 ############################################################
1014
1015 pages:
1016   stage: deploy
1017   dependencies:
1018     - doc-tarball
1019   image: ghcci/x86_64-linux-deb9:0.2
1020   # Due to Windows allow_failure
1021   allow_failure: true
1022   tags:
1023     - x86_64-linux
1024   script:
1025     - mkdir -p public/doc
1026     - tar -xf haddock.html.tar.xz -C public/doc
1027     - tar -xf libraries.html.tar.xz -C public/doc
1028     - tar -xf users_guide.html.tar.xz -C public/doc
1029     - |
1030       cat >public/index.html <<EOF
1031       <!DOCTYPE HTML>
1032       <meta charset="UTF-8">
1033       <meta http-equiv="refresh" content="1; url=doc/">
1034       EOF
1035     - cp -f index.html public/doc
1036   only:
1037     - master
1038   artifacts:
1039     paths:
1040       - public