gitlab: Don't run lint-submods job on Marge branches
[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: cefaee3c742af193e0f7783f87edb0d35374515c
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 before_script:
12   - python3 .gitlab/fix-submodules.py
13   - git submodule sync --recursive
14   - git submodule update --init --recursive
15   - git checkout .gitmodules
16   - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
17
18 stages:
19   - lint       # Source linting
20   - build      # A quick smoke-test to weed out broken commits
21   - full-build # Build all the things
22   - cleanup    # See Note [Cleanup on Windows]
23   - packaging  # Source distribution, etc.
24   - hackage    # head.hackage testing
25   - deploy     # push documentation
26
27 .only-default: &only-default
28   only:
29     - master
30     - /ghc-[0-9]+\.[0-9]+/
31     - merge_requests
32     - tags
33
34 ############################################################
35 # Runner Tags
36 ############################################################
37 #
38 # * x86_64-linux: Any Docker-capable x86_64 Linux machine
39 # * aarch64-linux: Any Docker-capable AArch64 Linux machine
40 # * x86_64-windows: A x86_64 Windows machine
41 # * lint: Any Docker-capable x86_64 Linux machine; distinct from
42 #         x86_64-linux to ensure low-latency availability.
43 #
44
45
46 ############################################################
47 # Linting
48 ############################################################
49
50 ghc-linters:
51   allow_failure: true
52   stage: lint
53   image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
54   script:
55     - git fetch "$CI_MERGE_REQUEST_PROJECT_URL" $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
56     - base="$(git merge-base FETCH_HEAD $CI_COMMIT_SHA)"
57     - "echo Merge base $base"
58     #    - validate-commit-msg .git $(git rev-list $base..$CI_COMMIT_SHA)
59     - validate-whitespace .git $(git rev-list $base..$CI_COMMIT_SHA)
60     - .gitlab/linters/check-makefiles.py $base $CI_COMMIT_SHA
61     - .gitlab/linters/check-cpp.py $base $CI_COMMIT_SHA
62     - .gitlab/linters/check-version-number.sh
63   dependencies: []
64   tags:
65     - lint
66   only:
67     refs:
68       - merge_requests
69
70 # We allow the submodule checker to fail when run on merge requests (to
71 # accomodate, e.g., haddock changes not yet upstream) but not on `master` or
72 # Marge jobs.
73 .lint-submods:
74   stage: lint
75   image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
76   script:
77     - submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA)
78   dependencies: []
79   tags:
80     - lint
81
82 lint-submods:
83   extends: .lint-submods
84   only:
85     refs:
86       - master
87       - /ghc-[0-9]+\.[0-9]+/
88
89 lint-submods-marge:
90   extends: .lint-submods
91   only:
92     refs:
93       - merge_requests
94     variables:
95       - $CI_MERGE_REQUEST_LABELS =~ /.*wip/marge_bot_batch_merge_job.*/
96
97 lint-submods-mr:
98   extends: .lint-submods
99   allow_failure: true
100   only:
101     refs:
102       - merge_requests
103
104 .lint-changelogs:
105   stage: lint
106   image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
107   dependencies: []
108   tags:
109     - lint
110   script:
111     - |
112       grep TBA libraries/*/changelog.md && (
113           echo "Error: Found \"TBA\"s in changelogs."
114           exit 1
115       )
116
117 lint-changelogs:
118   extends: .lint-changelogs
119   allow_failure: true
120   only:
121     refs:
122       - /ghc-[0-9]+\.[0-9]+/
123
124 lint-release-changelogs:
125   extends: .lint-changelogs
126   only:
127     - tags
128
129
130 ############################################################
131 # Validation via Pipelines (hadrian)
132 ############################################################
133
134 .validate-hadrian:
135   <<: *only-default
136   allow_failure: true
137   script:
138     - cabal update
139     - git clean -xdf && git submodule foreach git clean -xdf
140     - bash .circleci/prepare-system.sh
141     - if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
142     - ./boot
143     - ./configure $CONFIGURE_ARGS
144     - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --docs=no-sphinx binary-dist
145     - mv _build/bindist/ghc*.tar.xz ghc.tar.xz
146   cache:
147     key: hadrian
148     paths:
149       - cabal-cache
150   artifacts:
151     when: always
152     paths:
153       - ghc.tar.xz
154
155 validate-x86_64-linux-deb8-hadrian:
156   extends: .validate-hadrian
157   stage: build
158   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb8:$DOCKER_REV"
159   before_script:
160     # workaround for docker permissions
161     - sudo chown ghc:ghc -R .
162     - python3 .gitlab/fix-submodules.py
163     - git submodule sync --recursive
164     - git submodule update --init --recursive
165     - git checkout .gitmodules
166     - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
167   tags:
168     - x86_64-linux
169
170 hadrian-ghc-in-ghci:
171   <<: *only-default
172   stage: build
173   image: ghcci/x86_64-linux-deb8:0.1
174   before_script:
175     # workaround for docker permissions
176     - sudo chown ghc:ghc -R .
177     - python3 .gitlab/fix-submodules.py
178     - git submodule sync --recursive
179     - git submodule update --init --recursive
180     - git checkout .gitmodules
181   tags:
182     - x86_64-linux
183   script:
184     - cabal update
185     - git clean -xdf && git submodule foreach git clean -xdf
186     - bash .circleci/prepare-system.sh
187     - if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
188     - ./boot
189     - ./configure $CONFIGURE_ARGS
190     # Load ghc-in-ghci then immediately exit and check the modules loaded
191     - echo ":q" | hadrian/ghci.sh | tail -n2 | grep "Ok,"
192   cache:
193     key: hadrian-ghci
194     paths:
195       - cabal-cache
196
197 ############################################################
198 # Validation via Pipelines (make)
199 ############################################################
200
201 .validate:
202   <<: *only-default
203   variables:
204     TEST_TYPE: test
205   before_script:
206     - git clean -xdf && git submodule foreach git clean -xdf
207   script:
208     - ./boot
209     - ./configure $CONFIGURE_ARGS
210     - |
211       THREADS=`mk/detect-cpu-count.sh`
212       make V=0 -j$THREADS WERROR=-Werror
213     - |
214       make binary-dist TAR_COMP_OPTS="-1"
215     - |
216       # Prepare to push git notes.
217       METRICS_FILE=$(mktemp)
218       git config user.email "ben+ghc-ci@smart-cactus.org"
219       git config user.name "GHC GitLab CI"
220     - |
221       THREADS=`mk/detect-cpu-count.sh`
222       make $TEST_TYPE THREADS=$THREADS JUNIT_FILE=../../junit.xml METRICS_FILE=$METRICS_FILE
223     - |
224       # Push git notes.
225       METRICS_FILE=$METRICS_FILE .gitlab/push-test-metrics.sh
226   dependencies: []
227   artifacts:
228     reports:
229       junit: junit.xml
230     expire_in: 2 week
231     paths:
232       - ghc-*.tar.xz
233       - junit.xml
234
235 #################################
236 # x86_64-darwin
237 #################################
238
239 validate-x86_64-darwin:
240   extends: .validate
241   stage: full-build
242   tags:
243     - x86_64-darwin
244   variables:
245     GHC_VERSION: 8.6.3
246     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-apple-darwin.tar.xz"
247     MACOSX_DEPLOYMENT_TARGET: "10.7"
248     # Only Sierra and onwards supports clock_gettime. See #12858
249     ac_cv_func_clock_gettime: "no"
250     LANG: "en_US.UTF-8"
251     CONFIGURE_ARGS: --with-intree-gmp
252     TEST_ENV: "x86_64-darwin"
253   before_script:
254     - git clean -xdf && git submodule foreach git clean -xdf
255     - python3 .gitlab/fix-submodules.py
256     - git submodule sync --recursive
257     - git submodule update --init --recursive
258     - git checkout .gitmodules
259     - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
260
261     - bash .gitlab/darwin-init.sh
262     - PATH="`pwd`/toolchain/bin:$PATH"
263   after_script:
264     - cp -Rf $HOME/.cabal cabal-cache
265   artifacts:
266     when: always
267     expire_in: 2 week
268   cache:
269     key: darwin
270     paths:
271       - cabal-cache
272       - toolchain
273
274 .validate-linux:
275   extends: .validate
276   tags:
277     - x86_64-linux
278   before_script:
279     - git clean -xdf && git submodule foreach git clean -xdf
280     - python3 .gitlab/fix-submodules.py
281     - git submodule sync --recursive
282     - git submodule update --init --recursive
283     - git checkout .gitmodules
284     - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
285       # Build hyperlinked sources for documentation when building releases
286     - |
287       if [[ -n "$CI_COMMIT_TAG" ]]; then
288         echo "EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump" >> mk/build.mk
289       fi
290
291     - bash .circleci/prepare-system.sh
292     # workaround for docker permissions
293     - sudo chown ghc:ghc -R .
294   after_script:
295     - cp -Rf $HOME/.cabal cabal-cache
296   cache:
297     key: linux
298     paths:
299       - cabal-cache
300       - toolchain
301
302 #################################
303 # aarch64-linux-deb9
304 #################################
305
306 .build-aarch64-linux-deb9:
307   extends: .validate-linux
308   stage: full-build
309   image: "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb9:$DOCKER_REV"
310   allow_failure: true
311   variables:
312     TEST_ENV: "aarch64-linux-deb9"
313     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-aarch64-linux-deb9.tar.xz"
314   cache:
315     key: linux-aarch64-deb9
316   tags:
317     - aarch64-linux
318
319 validate-aarch64-linux-deb9:
320   extends: .build-aarch64-linux-deb9
321   artifacts:
322     when: always
323     expire_in: 2 week
324
325 nightly-aarch64-linux-deb9:
326   extends: .build-aarch64-linux-deb9
327   artifacts:
328     expire_in: 2 year
329   variables:
330     TEST_TYPE: slowtest
331   only:
332     variables:
333       - $NIGHTLY
334
335 #################################
336 # i386-linux-deb9
337 #################################
338
339 .build-i386-linux-deb9:
340   extends: .validate-linux
341   stage: full-build
342   image: "registry.gitlab.haskell.org/ghc/ci-images/i386-linux-deb9:$DOCKER_REV"
343   variables:
344     TEST_ENV: "i386-linux-deb9"
345     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-i386-deb9-linux.tar.xz"
346   cache:
347     key: linux-i386-deb9
348
349 validate-i386-linux-deb9:
350   extends: .build-i386-linux-deb9
351   artifacts:
352     when: always
353     expire_in: 2 week
354
355 nightly-i386-linux-deb9:
356   extends: .build-i386-linux-deb9
357   variables:
358     TEST_TYPE: slowtest
359   artifacts:
360     when: always
361     expire_in: 2 week
362   only:
363     variables:
364       - $NIGHTLY
365
366 #################################
367 # x86_64-linux-deb9
368 #################################
369
370 .build-x86_64-linux-deb9:
371   extends: .validate-linux
372   stage: full-build
373   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
374   variables:
375     TEST_ENV: "x86_64-linux-deb9"
376     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-deb9-linux.tar.xz"
377   cache:
378     key: linux-x86_64-deb9
379
380 validate-x86_64-linux-deb9:
381   extends: .build-x86_64-linux-deb9
382   artifacts:
383     when: always
384     expire_in: 2 week
385
386 nightly-x86_64-linux-deb9:
387   extends: .build-x86_64-linux-deb9
388   artifacts:
389     expire_in: 2 year
390   variables:
391     TEST_TYPE: slowtest
392   only:
393     variables:
394       - $NIGHTLY
395
396 # N.B. Has DEBUG assertions enabled in stage2
397 validate-x86_64-linux-deb9-debug:
398   extends: .build-x86_64-linux-deb9
399   stage: build
400   variables:
401     BUILD_FLAVOUR: validate
402     TEST_ENV: "x86_64-linux-deb9-debug"
403
404 validate-x86_64-linux-deb9-llvm:
405   extends: .build-x86_64-linux-deb9
406   stage: full-build
407   variables:
408     BUILD_FLAVOUR: perf-llvm
409     TEST_ENV: "x86_64-linux-deb9-llvm"
410
411 validate-x86_64-linux-deb9-integer-simple:
412   extends: .build-x86_64-linux-deb9
413   stage: full-build
414   variables:
415     INTEGER_LIBRARY: integer-simple
416     TEST_ENV: "x86_64-linux-deb9-integer-simple"
417     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-deb9-linux-integer-simple.tar.xz"
418
419 nightly-x86_64-linux-deb9-integer-simple:
420   extends: .build-x86_64-linux-deb9
421   stage: full-build
422   variables:
423     INTEGER_LIBRARY: integer-simple
424     TEST_ENV: "x86_64-linux-deb9-integer-simple"
425     TEST_TYPE: slowtest
426   artifacts:
427     expire_in: 2 year
428   only:
429     variables:
430       - $NIGHTLY
431
432 validate-x86_64-linux-deb9-unreg:
433   extends: .build-x86_64-linux-deb9
434   stage: full-build
435   variables:
436     CONFIGURE_ARGS: --enable-unregisterised
437     TEST_ENV: "x86_64-linux-deb9-unreg"
438
439
440 #################################
441 # x86_64-linux-deb8
442 #################################
443
444 release-x86_64-linux-deb8:
445   extends: .validate-linux
446   stage: full-build
447   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb8:$DOCKER_REV"
448   variables:
449     TEST_ENV: "x86_64-linux-deb8"
450     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-deb8-linux.tar.xz"
451   only:
452     - tags
453   cache:
454     key: linux-x86_64-deb8
455   artifacts:
456     when: always
457     expire_in: 2 week
458
459
460 #################################
461 # x86_64-linux-fedora27
462 #################################
463
464 validate-x86_64-linux-fedora27:
465   extends: .validate-linux
466   stage: full-build
467   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora27:$DOCKER_REV"
468   variables:
469     TEST_ENV: "x86_64-linux-fedora27"
470     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-fedora27-linux.tar.xz"
471   cache:
472     key: linux-x86_64-fedora27
473   artifacts:
474     when: always
475     expire_in: 2 week
476
477 ############################################################
478 # Validation via Pipelines (Windows)
479 ############################################################
480
481 .build-windows:
482   <<: *only-default
483   before_script:
484     - git clean -xdf
485     - git submodule foreach git clean -xdf
486
487     # Use a local temporary directory to ensure that concurrent builds don't
488     # interfere with one another
489     - |
490       mkdir tmp
491       set TMP=%cd%\tmp
492       set TEMP=%cd%\tmp
493
494     - set PATH=C:\msys64\usr\bin;%PATH%
495     - python .gitlab/fix-submodules.py
496     - git submodule sync --recursive
497     - git submodule update --init --recursive
498     - git checkout .gitmodules
499     - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
500     - bash .gitlab/win32-init.sh
501   after_script:
502     - rd /s /q tmp
503     - robocopy /np /nfl /ndl /e "%APPDATA%\cabal" cabal-cache
504     - bash -c 'make clean || true'
505   dependencies: []
506   variables:
507     FORCE_SYMLINKS: 1
508     LANG: "en_US.UTF-8"
509   cache:
510     paths:
511       - cabal-cache
512       - ghc-8.6.2
513       - ghc-tarballs
514
515 .build-windows-hadrian:
516   extends: .build-windows
517   stage: full-build
518   variables:
519     GHC_VERSION: "8.6.2"
520   script:
521     - |
522       python boot
523       bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex'
524     - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --flavour=Quick --docs=no-sphinx binary-dist"
525     - mv _build/bindist/ghc*.tar.xz ghc.tar.xz
526     # FIXME: Testsuite disabled due to #16156.
527     # - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
528   tags:
529     - x86_64-windows
530   artifacts:
531     when: always
532     paths:
533       - ghc.tar.xz
534
535 .validate-x86_64-windows-hadrian:
536   extends: .build-windows-hadrian
537   variables:
538     MSYSTEM: MINGW64
539   cache:
540     key: "x86_64-windows-hadrian-$WINDOWS_TOOLCHAIN_VERSION"
541
542 nightly-i386-windows-hadrian:
543   extends: .build-windows-hadrian
544   variables:
545     MSYSTEM: MINGW32
546   only:
547     variables:
548       - $NIGHTLY
549   cache:
550     key: "i386-windows-hadrian-$WINDOWS_TOOLCHAIN_VERSION"
551
552 .build-windows-make:
553   extends: .build-windows
554   stage: full-build
555   # due to #16084
556   allow_failure: true
557   variables:
558     BUILD_FLAVOUR: "quick"
559     GHC_VERSION: "8.6.2"
560     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-mingw32.tar.xz"
561   script:
562     - |
563       python boot
564       bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex $CONFIGURE_ARGS'
565     - bash -c "echo include mk/flavours/${BUILD_FLAVOUR}.mk > mk/build.mk"
566     - bash -c "PATH=`pwd`/toolchain/bin:$PATH make -j`mk/detect-cpu-count.sh`"
567     - bash -c "PATH=`pwd`/toolchain/bin:$PATH make binary-dist TAR_COMP_OPTS=-1"
568     - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
569   tags:
570     - x86_64-windows
571   artifacts:
572     when: always
573     expire_in: 2 week
574     reports:
575       junit: junit.xml
576     paths:
577       - ghc-*.tar.xz
578       - junit.xml
579
580 validate-x86_64-windows:
581   extends: .build-windows-make
582   variables:
583     MSYSTEM: MINGW64
584     CONFIGURE_ARGS: "--target=x86_64-unknown-mingw32"
585   cache:
586     key: "x86_64-windows-$WINDOWS_TOOLCHAIN_VERSION"
587
588 # Normal Windows validate builds are profiled; that won't do for releases.
589 release-x86_64-windows:
590   extends: validate-x86_64-windows
591   variables:
592     MSYSTEM: MINGW64
593     BUILD_FLAVOUR: "perf"
594     CONFIGURE_ARGS: "--target=x86_64-unknown-mingw32"
595   only:
596     - tags
597
598 release-i386-windows:
599   extends: .build-windows-make
600   only:
601     - tags
602   variables:
603     MSYSTEM: MINGW32
604     BUILD_FLAVOUR: "perf"
605     CONFIGURE_ARGS: "--target=i386-unknown-mingw32"
606   cache:
607     key: "i386-windows-$WINDOWS_TOOLCHAIN_VERSION"
608
609 nightly-i386-windows:
610   extends: .build-windows-make
611   only:
612     variables:
613       - $NIGHTLY
614   variables:
615     MSYSTEM: MINGW32
616     CONFIGURE_ARGS: "--target=i386-unknown-mingw32"
617   cache:
618     key: "i386-windows-$WINDOWS_TOOLCHAIN_VERSION"
619
620 ############################################################
621 # Cleanup
622 ############################################################
623
624 # Note [Cleaning up after shell executor]
625 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
626 #
627 # As noted in [1], gitlab-runner's shell executor doesn't clean up its working
628 # directory after builds. Unfortunately, we are forced to use the shell executor
629 # on Windows. To avoid running out of disk space we add a stage at the end of
630 # the build to remove the \GitLabRunner\builds directory. Since we only run a
631 # single build at a time on Windows this should be safe.
632 #
633 # [1] https://gitlab.com/gitlab-org/gitlab-runner/issues/3856
634
635 # See Note [Cleanup after shell executor]
636 cleanup-windows:
637   <<: *only-default
638   stage: cleanup
639   tags:
640     - x86_64-windows
641   when: always
642   dependencies: []
643   before_script:
644     - echo "Time to clean up"
645   script:
646     - echo "Let's go"
647   after_script:
648     - set "BUILD_DIR=%CI_PROJECT_DIR%"
649     - set "BUILD_DIR=%BUILD_DIR:/=\%"
650     - echo "Cleaning %BUILD_DIR%"
651     - cd \GitLabRunner
652     # This is way more complicated than it should be:
653     # See https://stackoverflow.com/questions/1965787
654     - del %BUILD_DIR%\* /F /Q
655     - for /d %%p in (%BUILD_DIR%\*) do rd /Q /S "%%p"
656     - exit /b 0
657
658 # See Note [Cleanup after shell executor]
659 cleanup-darwin:
660   <<: *only-default
661   stage: cleanup
662   tags:
663     - x86_64-darwin
664   when: always
665   dependencies: []
666   before_script:
667     - echo "Time to clean up"
668   script:
669     - echo "Let's go"
670   after_script:
671     - BUILD_DIR=$CI_PROJECT_DIR
672     - echo "Cleaning $BUILD_DIR"
673     - cd $HOME
674     - rm -Rf $BUILD_DIR/*
675     - exit 0
676
677 ############################################################
678 # Packaging
679 ############################################################
680
681 doc-tarball:
682   <<: *only-default
683   stage: packaging
684   tags:
685     - x86_64-linux
686   image: ghcci/x86_64-linux-deb9:0.2
687   dependencies:
688     - validate-x86_64-linux-deb9
689     - validate-x86_64-windows
690   artifacts:
691     paths:
692       - haddock.html.tar.xz
693       - libraries.html.tar.xz
694       - users_guide.html.tar.xz
695       - index.html
696       - "*.pdf"
697   script:
698     - rm -Rf docs
699     - bash -ex distrib/mkDocs/mkDocs ghc-x86_64-deb9-linux.tar.xz ghc-x86_64-mingw32.tar.xz
700     - ls -lh
701     - mv docs/*.tar.xz docs/index.html .
702
703 source-tarball:
704   stage: packaging
705   tags:
706     - x86_64-linux
707   image: ghcci/x86_64-linux-deb9:0.2
708   only:
709     - tags
710   artifacts:
711     paths:
712       - ghc-*.tar.xz
713       - version
714   script:
715     - mk/get-win32-tarballs.sh download all
716     - ./boot
717     - ./configure
718     - make sdist
719     - mv sdistprep/*.xz  .
720     - make show VALUE=version > version
721
722
723 ############################################################
724 # Testing via head.hackage
725 ############################################################
726
727 # Triggering jobs in the ghc/head.hackage project requires that we have a job
728 # token for that repository. Furthermore the head.hackage CI job must have
729 # access to an unprivileged access token with the ability to query the ghc/ghc
730 # project such that it can find the job ID of the fedora27 job for the current
731 # pipeline.
732
733 .hackage:
734   <<: *only-default
735   stage: hackage
736   image: ghcci/x86_64-linux-deb9:0.2
737   tags:
738     - x86_64-linux
739   dependencies: []
740   variables:
741     HEAD_HACKAGE_PROJECT_ID: "78"
742   script:
743     - bash .gitlab/start-head.hackage.sh
744
745 hackage:
746   extends: .hackage
747   when: manual
748
749 hackage-label:
750   extends: .hackage
751   only:
752     variables:
753       - $CI_MERGE_REQUEST_LABELS =~ /.*user-facing.*/
754
755 nightly-hackage:
756   extends: .hackage
757   only:
758     variables:
759       - $NIGHTLY
760
761 pages:
762   stage: deploy
763   dependencies:
764     - doc-tarball
765   image: ghcci/x86_64-linux-deb9:0.2
766   tags:
767     - x86_64-linux
768   script:
769     - mkdir -p public/doc
770     - tar -xf haddock.html.tar.xz -C public/doc
771     - tar -xf libraries.html.tar.xz -C public/doc
772     - tar -xf users_guide.html.tar.xz -C public/doc
773     - cp -f index.html public/doc
774   only:
775     - master
776   artifacts:
777     paths:
778       - public