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