.gitlab-ci.yml 16.3 KB
Newer Older
1 2
variables:
  GIT_SSL_NO_VERIFY: "1"
3

4
  # Commit of ghc/ci-images repository from which to pull Docker images
5
  DOCKER_REV: 6d19c3adc1f5c28c82aed8c5b1ac40931ac60f3f
6 7 8 9 10 11

before_script:
  - python3 .gitlab/fix-submodules.py
  - git submodule sync --recursive
  - git submodule update --init --recursive
  - git checkout .gitmodules
12
  - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
13

Ben Gamari's avatar
Ben Gamari committed
14 15 16
stages:
  - lint
  - build
17
  - full-build
Ben Gamari's avatar
Ben Gamari committed
18
  - cleanup # See Note [Cleanup on Windows]
19
  - packaging
Ben Gamari's avatar
Ben Gamari committed
20

Ben Gamari's avatar
Ben Gamari committed
21
############################################################
22
# Runner Tags
Ben Gamari's avatar
Ben Gamari committed
23 24 25 26 27 28 29 30 31 32
############################################################
#
# * x86_64-linux: Any Docker-capable x86_64 Linux machine
# * aarch64-linux: Any Docker-capable AArch64 Linux machine
# * x86_64-windows: A x86_64 Windows machine
# * lint: Any Docker-capable x86_64 Linux machine; distinct from
#         x86_64-linux to ensure low-latency availability.
#


Ben Gamari's avatar
Ben Gamari committed
33 34 35 36 37 38
############################################################
# Linting
############################################################

ghc-linters:
  stage: lint
39
  image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
Ben Gamari's avatar
Ben Gamari committed
40 41 42 43 44 45 46 47 48 49
  script:
    - |
      if [ -n "$CI_MERGE_REQUEST_ID" ]; then
        base="$(git merge-base $CI_MERGE_REQUEST_BRANCH_NAME HEAD)"
        validate-commit-msg .git $(git rev-list $base..$CI_COMMIT_SHA)
        submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA)
        validate-whitespace .git $(git rev-list $base..$CI_COMMIT_SHA)
        .gitlab/linters/check-makefiles.py $base $CI_COMMIT_SHA
        .gitlab/linters/check-cpp.py $base $CI_COMMIT_SHA
      fi
50
  dependencies: []
Ben Gamari's avatar
Ben Gamari committed
51 52
  tags:
    - lint
Ben Gamari's avatar
Ben Gamari committed
53

Ben Gamari's avatar
Ben Gamari committed
54 55 56
############################################################
# Validation via Pipelines (hadrian)
############################################################
57

Ben Gamari's avatar
Ben Gamari committed
58
.validate-hadrian:
Ben Gamari's avatar
Ben Gamari committed
59
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
60
  script:
61
    - cabal update
62
    - git clean -xdf && git submodule foreach git clean -xdf
Ben Gamari's avatar
Ben Gamari committed
63 64 65
    - bash .circleci/prepare-system.sh
    - if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
    - ./boot
Ben Gamari's avatar
Ben Gamari committed
66
    - ./configure $CONFIGURE_ARGS
67 68
    - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --docs=no-sphinx binary-dist
    - mv _build/bindist/ghc*.tar.xz ghc.tar.xz
Ben Gamari's avatar
Ben Gamari committed
69 70
  cache:
    key: hadrian
71
    paths:
Ben Gamari's avatar
Ben Gamari committed
72
      - cabal-cache
73 74 75 76
  artifacts:
    when: always
    paths:
      - ghc.tar.xz
77

Ben Gamari's avatar
Ben Gamari committed
78
validate-x86_64-linux-deb8-hadrian:
Ben Gamari's avatar
Ben Gamari committed
79
  extends: .validate-hadrian
80
  stage: build
81
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb8:$DOCKER_REV"
Ben Gamari's avatar
Ben Gamari committed
82 83 84
  before_script:
    # workaround for docker permissions
    - sudo chown ghc:ghc -R .
85 86 87 88
    - python3 .gitlab/fix-submodules.py
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
89
    - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
Ben Gamari's avatar
Ben Gamari committed
90 91 92
  tags:
    - x86_64-linux

93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
hadrian-ghc-in-ghci:
  stage: build
  image: ghcci/x86_64-linux-deb8:0.1
  before_script:
    # workaround for docker permissions
    - sudo chown ghc:ghc -R .
    - python3 .gitlab/fix-submodules.py
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
  tags:
    - x86_64-linux
  script:
    - cabal update
    - git clean -xdf && git submodule foreach git clean -xdf
    - bash .circleci/prepare-system.sh
    - if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
    - ./boot
    - ./configure $CONFIGURE_ARGS
    # Load ghc-in-ghci then immediately exit
    - echo ":q" | hadrian/ghci.sh
  cache:
    key: hadrian-ghci
    paths:
      - cabal-cache

Ben Gamari's avatar
Ben Gamari committed
119 120 121 122 123
############################################################
# Validation via Pipelines (make)
############################################################

.validate:
124 125
  variables:
    TEST_TYPE: test
Ben Gamari's avatar
Ben Gamari committed
126
  before_script:
127
    - git clean -xdf && git submodule foreach git clean -xdf
Ben Gamari's avatar
Ben Gamari committed
128
  script:
Ben Gamari's avatar
Ben Gamari committed
129
    - ./boot
Ben Gamari's avatar
Ben Gamari committed
130
    - ./configure $CONFIGURE_ARGS
Ben Gamari's avatar
Ben Gamari committed
131 132
    - |
      THREADS=`mk/detect-cpu-count.sh`
Matthew Pickering's avatar
Matthew Pickering committed
133
      make V=0 -j$THREADS WERROR=-Werror
Ben Gamari's avatar
Ben Gamari committed
134 135
    - |
      make binary-dist TAR_COMP_OPTS="-1"
136 137 138 139 140
    - |
      # Prepare to push git notes.
      METRICS_FILE=$(mktemp)
      git config user.email "ben+ghc-ci@smart-cactus.org"
      git config user.name "GHC GitLab CI"
Ben Gamari's avatar
Ben Gamari committed
141 142
    - |
      THREADS=`mk/detect-cpu-count.sh`
143 144 145 146
      make $TEST_TYPE THREADS=$THREADS JUNIT_FILE=../../junit.xml METRICS_FILE=$METRICS_FILE
    - |
      # Push git notes.
      METRICS_FILE=$METRICS_FILE .gitlab/push-test-metrics.sh
147
  dependencies: []
148 149 150
  artifacts:
    reports:
      junit: junit.xml
151
    expire_in: 2 week
152
    paths:
153
      - ghc-*.tar.xz
154 155
      - junit.xml

156 157 158 159
#################################
# x86_64-darwin
#################################

Ben Gamari's avatar
Ben Gamari committed
160
validate-x86_64-darwin:
Ben Gamari's avatar
Ben Gamari committed
161
  extends: .validate
162
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
163 164 165
  tags:
    - x86_64-darwin
  variables:
166
    GHC_VERSION: 8.6.3
167
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-apple-darwin.tar.xz"
Ben Gamari's avatar
Ben Gamari committed
168 169 170
    MACOSX_DEPLOYMENT_TARGET: "10.7"
    # Only Sierra and onwards supports clock_gettime. See #12858
    ac_cv_func_clock_gettime: "no"
171
    LANG: "en_US.UTF-8"
172
    CONFIGURE_ARGS: --with-intree-gmp
173
    TEST_ENV: "x86_64-darwin"
Ben Gamari's avatar
Ben Gamari committed
174
  before_script:
Ben Gamari's avatar
Ben Gamari committed
175
    - git clean -xdf && git submodule foreach git clean -xdf
176
    - python3 .gitlab/fix-submodules.py
177 178 179
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
180
    - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
181

Ben Gamari's avatar
Ben Gamari committed
182 183 184 185
    - bash .gitlab/darwin-init.sh
    - PATH="`pwd`/toolchain/bin:$PATH"
  after_script:
    - cp -Rf $HOME/.cabal cabal-cache
186 187
  artifacts:
    when: always
188
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
189 190 191 192 193 194
  cache:
    key: darwin
    paths:
      - cabal-cache
      - toolchain

Ben Gamari's avatar
Ben Gamari committed
195
.validate-linux:
Ben Gamari's avatar
Ben Gamari committed
196 197 198 199
  extends: .validate
  tags:
    - x86_64-linux
  before_script:
Ben Gamari's avatar
Ben Gamari committed
200
    - git clean -xdf && git submodule foreach git clean -xdf
201 202 203 204
    - python3 .gitlab/fix-submodules.py
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
205
    - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
206

Ben Gamari's avatar
Ben Gamari committed
207 208 209 210 211 212
    - bash .circleci/prepare-system.sh
    # workaround for docker permissions
    - sudo chown ghc:ghc -R .
  after_script:
    - cp -Rf $HOME/.cabal cabal-cache
  cache:
Ben Gamari's avatar
Ben Gamari committed
213
    key: linux
Ben Gamari's avatar
Ben Gamari committed
214 215 216 217
    paths:
      - cabal-cache
      - toolchain

218 219 220 221 222
#################################
# aarch64-linux-deb9
#################################

.build-aarch64-linux-deb9:
Ben Gamari's avatar
Ben Gamari committed
223
  extends: .validate-linux
224
  stage: full-build
225
  image: "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb9:$DOCKER_REV"
Ben Gamari's avatar
Ben Gamari committed
226
  allow_failure: true
227 228
  variables:
    TEST_ENV: "aarch64-linux-deb9"
229
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-aarch64-linux-deb9.tar.xz"
Ben Gamari's avatar
Ben Gamari committed
230 231 232 233 234
  cache:
    key: linux-aarch64-deb9
  tags:
    - aarch64-linux

235 236 237 238 239 240
validate-aarch64-linux-deb9:
  extends: .build-aarch64-linux-deb9
  artifacts:
    when: always
    expire_in: 2 week

241
nightly-aarch64-linux-deb9:
242
  extends: .build-aarch64-linux-deb9
243
  artifacts:
244
    expire_in: 2 year
245 246 247 248 249 250
  variables:
    TEST_TYPE: slowtest
  only:
    variables:
      - $NIGHTLY

251 252 253 254 255
#################################
# i386-linux-deb9
#################################

.build-i386-linux-deb9:
256 257
  extends: .validate-linux
  stage: full-build
258
  image: "registry.gitlab.haskell.org/ghc/ci-images/i386-linux-deb9:$DOCKER_REV"
259 260
  variables:
    TEST_ENV: "i386-linux-deb9"
261
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-i386-deb9-linux.tar.xz"
262 263 264 265 266
  cache:
    key: linux-i386-deb9

validate-i386-linux-deb9:
  extends: .build-i386-linux-deb9
267 268 269
  artifacts:
    when: always
    expire_in: 2 week
270 271

nightly-i386-linux-deb9:
272
  extends: .build-i386-linux-deb9
273 274 275 276
  variables:
    TEST_TYPE: slowtest
  artifacts:
    when: always
277
    expire_in: 2 week
278 279 280
  only:
    variables:
      - $NIGHTLY
281

282 283 284
#################################
# x86_64-linux-deb9
#################################
Ben Gamari's avatar
Ben Gamari committed
285

286
.build-x86_64-linux-deb9:
Ben Gamari's avatar
Ben Gamari committed
287
  extends: .validate-linux
288
  stage: build
289
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
290 291
  variables:
    TEST_ENV: "x86_64-linux-deb9"
292
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-deb9-linux.tar.xz"
Ben Gamari's avatar
Ben Gamari committed
293 294 295
  cache:
    key: linux-x86_64-deb9

296 297
validate-x86_64-linux-deb9:
  extends: .build-x86_64-linux-deb9
298 299 300 301
  artifacts:
    when: always
    expire_in: 2 week

302
nightly-x86_64-linux-deb9:
303
  extends: .build-x86_64-linux-deb9
304
  artifacts:
305
    expire_in: 2 year
306 307 308 309 310 311
  variables:
    TEST_TYPE: slowtest
  only:
    variables:
      - $NIGHTLY

312 313 314 315 316 317 318
# N.B. Has DEBUG assertions enabled in stage2
validate-x86_64-linux-deb9-debug:
  extends: .build-x86_64-linux-deb9
  variables:
    BUILD_FLAVOUR: validate
    TEST_ENV: "x86_64-linux-deb9-debug"

Ben Gamari's avatar
Ben Gamari committed
319
validate-x86_64-linux-deb9-llvm:
320
  extends: .build-x86_64-linux-deb9
321
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
322 323
  variables:
    BUILD_FLAVOUR: perf-llvm
324
    TEST_ENV: "x86_64-linux-deb9-llvm"
325 326 327 328 329 330 331

validate-x86_64-linux-deb9-integer-simple:
  extends: .build-x86_64-linux-deb9
  stage: full-build
  variables:
    INTEGER_LIBRARY: integer-simple
    TEST_ENV: "x86_64-linux-deb9-integer-simple"
332
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-deb9-linux-integer-simple.tar.xz"
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357

nightly-x86_64-linux-deb9-integer-simple:
  extends: .build-x86_64-linux-deb9
  stage: full-build
  variables:
    INTEGER_LIBRARY: integer-simple
    TEST_ENV: "x86_64-linux-deb9-integer-simple"
    TEST_TYPE: slowtest
  artifacts:
    expire_in: 2 year
  only:
    variables:
      - $NIGHTLY

validate-x86_64-linux-deb9-unreg:
  extends: .build-x86_64-linux-deb9
  stage: full-build
  variables:
    CONFIGURE_ARGS: --enable-unregisterised
    TEST_ENV: "x86_64-linux-deb9-unreg"


#################################
# x86_64-linux-deb8
#################################
Ben Gamari's avatar
Ben Gamari committed
358

359
release-x86_64-linux-deb8:
Ben Gamari's avatar
Ben Gamari committed
360
  extends: .validate-linux
361
  stage: full-build
362
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb8:$DOCKER_REV"
363 364
  variables:
    TEST_ENV: "x86_64-linux-deb8"
365
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-deb8-linux.tar.xz"
366 367
  only:
    - tags
Ben Gamari's avatar
Ben Gamari committed
368 369
  cache:
    key: linux-x86_64-deb8
370 371 372
  artifacts:
    when: always
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
373

374 375 376 377 378

#################################
# x86_64-linux-fedora27
#################################

379
release-x86_64-linux-fedora27:
Ben Gamari's avatar
Ben Gamari committed
380
  extends: .validate-linux
381
  stage: full-build
382
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora27:$DOCKER_REV"
383 384
  variables:
    TEST_ENV: "x86_64-linux-fedora27"
385
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-fedora27-linux.tar.xz"
386 387
  only:
    - tags
Ben Gamari's avatar
Ben Gamari committed
388 389
  cache:
    key: linux-x86_64-fedora27
390 391
  artifacts:
    when: always
392
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
393

Ben Gamari's avatar
Ben Gamari committed
394
############################################################
395
# Validation via Pipelines (Windows)
Ben Gamari's avatar
Ben Gamari committed
396 397
############################################################

398
.build-windows:
Ben Gamari's avatar
Ben Gamari committed
399
  before_script:
400
    - git clean -xdf
401
    - git submodule foreach git clean -xdf
402 403 404 405 406 407 408 409 410

    # Use a local temporary directory to ensure that concurrent builds don't
    # interfere with one another
    - |
      mkdir tmp
      set TMP=%cd%\tmp
      set TEMP=%cd%\tmp

    - set PATH=C:\msys64\usr\bin;%PATH%
Ben Gamari's avatar
Ben Gamari committed
411 412 413 414
    - python .gitlab/fix-submodules.py
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
415
    - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
Ben Gamari's avatar
Ben Gamari committed
416
    - bash .gitlab/win32-init.sh
417 418
  after_script:
    - rd /s /q tmp
419
    - robocopy /np /nfl /ndl /e "%APPDATA%\cabal" cabal-cache
420
    - bash -c 'make clean || true'
421
  dependencies: []
Tamar Christina's avatar
Tamar Christina committed
422 423
  variables:
    FORCE_SYMLINKS: 1
424
    LANG: "en_US.UTF-8"
Ben Gamari's avatar
Ben Gamari committed
425 426 427 428 429 430
  cache:
    paths:
      - cabal-cache
      - ghc-8.6.2
      - ghc-tarballs

431 432
.build-windows-hadrian:
  extends: .build-windows
433
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
434 435 436 437 438
  variables:
    GHC_VERSION: "8.6.2"
  script:
    - |
      python boot
439
      bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex'
440 441
    - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --flavour=Quick --docs=no-sphinx binary-dist"
    - mv _build/bindist/ghc*.tar.xz ghc.tar.xz
442
    # FIXME: Testsuite disabled due to #16156.
443
    # - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
Ben Gamari's avatar
Ben Gamari committed
444 445
  tags:
    - x86_64-windows
446 447 448 449
  artifacts:
    when: always
    paths:
      - ghc.tar.xz
Ben Gamari's avatar
Ben Gamari committed
450

451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469
validate-x86_64-windows-hadrian:
  extends: .build-windows-hadrian
  variables:
    MSYSTEM: MINGW64
  cache:
    key: x86_64-windows-hadrian

nightly-i386-windows-hadrian:
  extends: .build-windows-hadrian
  variables:
    MSYSTEM: MINGW32
  only:
    variables:
      - $NIGHTLY
  cache:
    key: i386-windows-hadrian

.build-windows-make:
  extends: .build-windows
470
  stage: full-build
471 472
  # due to #16084
  allow_failure: true
473 474
  variables:
    GHC_VERSION: "8.6.2"
475
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-mingw32.tar.xz"
476 477 478
  script:
    - |
      python boot
479
      bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex'
480
    - bash -c "echo include mk/flavours/quick.mk > mk/build.mk"
481
    - bash -c "PATH=`pwd`/toolchain/bin:$PATH make -j`mk/detect-cpu-count.sh`"
482
    - bash -c "PATH=`pwd`/toolchain/bin:$PATH make binary-dist TAR_COMP_OPTS=-1"
Ben Gamari's avatar
test  
Ben Gamari committed
483
    - ls
484
    - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
485 486
  tags:
    - x86_64-windows
487 488
  artifacts:
    when: always
489
    expire_in: 2 week
490 491 492
    reports:
      junit: junit.xml
    paths:
493
      - ghc-*.tar.xz
494
      - junit.xml
Ben Gamari's avatar
Ben Gamari committed
495

496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521
validate-x86_64-windows:
  extends: .build-windows-make
  variables:
    MSYSTEM: MINGW64
  cache:
    key: x86_64-windows

release-i386-windows:
  extends: .build-windows-make
  only:
    - tags
  variables:
    MSYSTEM: MINGW32
  cache:
    key: i386-windows

nightly-i386-windows:
  extends: .build-windows-make
  only:
    variables:
      - $NIGHTLY
  variables:
    MSYSTEM: MINGW32
  cache:
    key: i386-windows

522 523 524 525
############################################################
# Cleanup
############################################################

526 527
# Note [Cleaning up after shell executor]
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ben Gamari's avatar
Ben Gamari committed
528 529 530 531 532 533 534 535 536
#
# As noted in [1], gitlab-runner's shell executor doesn't clean up its working
# directory after builds. Unfortunately, we are forced to use the shell executor
# on Windows. To avoid running out of disk space we add a stage at the end of
# the build to remove the \GitLabRunner\builds directory. Since we only run a
# single build at a time on Windows this should be safe.
#
# [1] https://gitlab.com/gitlab-org/gitlab-runner/issues/3856

537
# See Note [Cleanup after shell executor]
Ben Gamari's avatar
Ben Gamari committed
538 539 540 541 542
cleanup-windows:
  stage: cleanup
  tags:
    - x86_64-windows
  when: always
543
  dependencies: []
Ben Gamari's avatar
Ben Gamari committed
544 545 546 547 548 549 550 551 552
  before_script:
    - echo "Time to clean up"
  script:
    - echo "Let's go"
  after_script:
    - set "BUILD_DIR=%CI_PROJECT_DIR%"
    - set "BUILD_DIR=%BUILD_DIR:/=\%"
    - echo "Cleaning %BUILD_DIR%"
    - cd \GitLabRunner
553 554 555 556
    # This is way more complicated than it should be:
    # See https://stackoverflow.com/questions/1965787
    - del %BUILD_DIR%\* /F /Q
    - for /d %%p in (%BUILD_DIR%\*) do rd /Q /S "%%p"
Ben Gamari's avatar
Ben Gamari committed
557
    - exit /b 0
558 559 560 561 562 563 564

# See Note [Cleanup after shell executor]
cleanup-darwin:
  stage: cleanup
  tags:
    - x86_64-darwin
  when: always
565
  dependencies: []
566 567 568 569 570 571 572 573 574 575 576
  before_script:
    - echo "Time to clean up"
  script:
    - echo "Let's go"
  after_script:
    - BUILD_DIR=$CI_PROJECT_DIR
    - echo "Cleaning $BUILD_DIR"
    - cd $HOME
    - rm -Rf $BUILD_DIR/*
    - exit 0

577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601
############################################################
# Packaging
############################################################

doc-tarball:
  stage: packaging
  tags:
    - x86_64-linux
  image: ghcci/x86_64-linux-deb9:0.2
  dependencies:
    - validate-x86_64-linux-deb9
    - validate-x86_64-windows
  artifacts:
    paths:
      - haddock.html.tar.xz
      - libraries.html.tar.xz
      - users_guide.html.tar.xz
      - index.html
      - "*.pdf"
  script:
    - rm -Rf docs
    - distrib/mkDocs/mkDocs ghc-x86_64-deb9-linux.tar.xz ghc-x86_64-mingw32.tar.xz
    - ls -lh
    - mv docs/*.tar.xz .

602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619
source-tarball:
  stage: packaging
  tags:
    - x86_64-linux
  image: ghcci/x86_64-linux-deb9:0.2
  only:
    - tags
  artifacts:
    paths:
      - ghc-*.tar.xz
      - version
  script:
    - mk/get-win32-tarballs.sh download all
    - ./boot
    - ./configure
    - make sdist
    - mv sdistprep/*.xz  .
    - make show VALUE=version > version