.gitlab-ci.yml 19.1 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: cefaee3c742af193e0f7783f87edb0d35374515c
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
stages:
15 16 17 18 19 20
  - lint       # Source linting
  - build      # A quick smoke-test to weed out broken commits
  - full-build # Build all the things
  - cleanup    # See Note [Cleanup on Windows]
  - packaging  # Source distribution, etc.
  - hackage    # head.hackage testing
21
  - deploy     # push documentation
Ben Gamari's avatar
Ben Gamari committed
22

23 24 25 26 27 28 29
.only-default: &only-default
  only:
    - master
    - /ghc-[0-9]+\.[0-9]+/
    - merge_requests
    - tags

Ben Gamari's avatar
Ben Gamari committed
30
############################################################
31
# Runner Tags
Ben Gamari's avatar
Ben Gamari committed
32 33 34 35 36 37 38 39 40 41
############################################################
#
# * 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
42 43 44 45 46 47
############################################################
# Linting
############################################################

ghc-linters:
  stage: lint
48
  image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
Ben Gamari's avatar
Ben Gamari committed
49
  script:
50 51
    - git fetch origin
    - base="$(git merge-base $CI_MERGE_REQUEST_TARGET_BRANCH_NAME $CI_COMMIT_SHA)"
Ben Gamari's avatar
Ben Gamari committed
52
    - "echo Merge base $base"
53 54 55 56
    #    - validate-commit-msg .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
57
  dependencies: []
Ben Gamari's avatar
Ben Gamari committed
58 59
  tags:
    - lint
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
  only:
    refs:
      - merge_requests

# We allow the submodule checker to fail when run on merge requests (to
# accomodate, e.g., haddock changes not yet upstream) but not on `master` or
# Marge jobs.
.lint-submods:
  stage: lint
  image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
  script:
    - submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA)
  dependencies: []
  tags:
    - lint

lint-submods:
  extends: .lint-submods
  only:
    refs:
      - master
      - /ghc-[0-9]+\.[0-9]+/
      - wip/marge_bot_batch_merge_job

lint-submods-mr:
  extends: .lint-submods
  allow_failure: true
  only:
    refs:
      - merge_requests
Ben Gamari's avatar
Ben Gamari committed
90

Ben Gamari's avatar
Ben Gamari committed
91 92 93
############################################################
# Validation via Pipelines (hadrian)
############################################################
94

Ben Gamari's avatar
Ben Gamari committed
95
.validate-hadrian:
96
  <<: *only-default
Ben Gamari's avatar
Ben Gamari committed
97
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
98
  script:
99
    - cabal update
100
    - git clean -xdf && git submodule foreach git clean -xdf
Ben Gamari's avatar
Ben Gamari committed
101 102 103
    - 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
104
    - ./configure $CONFIGURE_ARGS
105 106
    - 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
107 108
  cache:
    key: hadrian
109
    paths:
Ben Gamari's avatar
Ben Gamari committed
110
      - cabal-cache
111 112 113 114
  artifacts:
    when: always
    paths:
      - ghc.tar.xz
115

Ben Gamari's avatar
Ben Gamari committed
116
validate-x86_64-linux-deb8-hadrian:
Ben Gamari's avatar
Ben Gamari committed
117
  extends: .validate-hadrian
118
  stage: build
119
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb8:$DOCKER_REV"
Ben Gamari's avatar
Ben Gamari committed
120 121 122
  before_script:
    # workaround for docker permissions
    - sudo chown ghc:ghc -R .
123 124 125 126
    - python3 .gitlab/fix-submodules.py
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
127
    - "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
128 129 130
  tags:
    - x86_64-linux

131
hadrian-ghc-in-ghci:
132
  <<: *only-default
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
  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
158 159 160 161 162
############################################################
# Validation via Pipelines (make)
############################################################

.validate:
163
  <<: *only-default
164 165
  variables:
    TEST_TYPE: test
Ben Gamari's avatar
Ben Gamari committed
166
  before_script:
167
    - git clean -xdf && git submodule foreach git clean -xdf
Ben Gamari's avatar
Ben Gamari committed
168
  script:
Ben Gamari's avatar
Ben Gamari committed
169
    - ./boot
Ben Gamari's avatar
Ben Gamari committed
170
    - ./configure $CONFIGURE_ARGS
Ben Gamari's avatar
Ben Gamari committed
171 172
    - |
      THREADS=`mk/detect-cpu-count.sh`
173
      make V=0 -j$THREADS WERROR=-Werror
Ben Gamari's avatar
Ben Gamari committed
174 175
    - |
      make binary-dist TAR_COMP_OPTS="-1"
176 177 178 179 180
    - |
      # 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
181 182
    - |
      THREADS=`mk/detect-cpu-count.sh`
183 184 185 186
      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
187
  dependencies: []
188 189 190
  artifacts:
    reports:
      junit: junit.xml
191
    expire_in: 2 week
192
    paths:
193
      - ghc-*.tar.xz
194 195
      - junit.xml

196 197 198 199
#################################
# x86_64-darwin
#################################

Ben Gamari's avatar
Ben Gamari committed
200
validate-x86_64-darwin:
Ben Gamari's avatar
Ben Gamari committed
201
  extends: .validate
202
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
203 204 205
  tags:
    - x86_64-darwin
  variables:
206
    GHC_VERSION: 8.6.3
207
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-apple-darwin.tar.xz"
Ben Gamari's avatar
Ben Gamari committed
208 209 210
    MACOSX_DEPLOYMENT_TARGET: "10.7"
    # Only Sierra and onwards supports clock_gettime. See #12858
    ac_cv_func_clock_gettime: "no"
211
    LANG: "en_US.UTF-8"
212
    CONFIGURE_ARGS: --with-intree-gmp
213
    TEST_ENV: "x86_64-darwin"
Ben Gamari's avatar
Ben Gamari committed
214
  before_script:
Ben Gamari's avatar
Ben Gamari committed
215
    - git clean -xdf && git submodule foreach git clean -xdf
216
    - python3 .gitlab/fix-submodules.py
217 218 219
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
220
    - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
221

Ben Gamari's avatar
Ben Gamari committed
222 223 224 225
    - bash .gitlab/darwin-init.sh
    - PATH="`pwd`/toolchain/bin:$PATH"
  after_script:
    - cp -Rf $HOME/.cabal cabal-cache
226 227
  artifacts:
    when: always
228
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
229 230 231 232 233 234
  cache:
    key: darwin
    paths:
      - cabal-cache
      - toolchain

Ben Gamari's avatar
Ben Gamari committed
235
.validate-linux:
Ben Gamari's avatar
Ben Gamari committed
236 237 238 239
  extends: .validate
  tags:
    - x86_64-linux
  before_script:
Ben Gamari's avatar
Ben Gamari committed
240
    - git clean -xdf && git submodule foreach git clean -xdf
241 242 243 244
    - python3 .gitlab/fix-submodules.py
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
245
    - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
246

Ben Gamari's avatar
Ben Gamari committed
247 248 249 250 251 252
    - 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
253
    key: linux
Ben Gamari's avatar
Ben Gamari committed
254 255 256 257
    paths:
      - cabal-cache
      - toolchain

258 259 260 261 262
#################################
# aarch64-linux-deb9
#################################

.build-aarch64-linux-deb9:
Ben Gamari's avatar
Ben Gamari committed
263
  extends: .validate-linux
264
  stage: full-build
265
  image: "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb9:$DOCKER_REV"
Ben Gamari's avatar
Ben Gamari committed
266
  allow_failure: true
267 268
  variables:
    TEST_ENV: "aarch64-linux-deb9"
269
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-aarch64-linux-deb9.tar.xz"
Ben Gamari's avatar
Ben Gamari committed
270 271 272 273 274
  cache:
    key: linux-aarch64-deb9
  tags:
    - aarch64-linux

275 276 277 278 279 280
validate-aarch64-linux-deb9:
  extends: .build-aarch64-linux-deb9
  artifacts:
    when: always
    expire_in: 2 week

281
nightly-aarch64-linux-deb9:
282
  extends: .build-aarch64-linux-deb9
283
  artifacts:
284
    expire_in: 2 year
285 286 287 288 289 290
  variables:
    TEST_TYPE: slowtest
  only:
    variables:
      - $NIGHTLY

291 292 293 294 295
#################################
# i386-linux-deb9
#################################

.build-i386-linux-deb9:
296 297
  extends: .validate-linux
  stage: full-build
298
  image: "registry.gitlab.haskell.org/ghc/ci-images/i386-linux-deb9:$DOCKER_REV"
299 300
  variables:
    TEST_ENV: "i386-linux-deb9"
301
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-i386-deb9-linux.tar.xz"
302 303 304 305 306
  cache:
    key: linux-i386-deb9

validate-i386-linux-deb9:
  extends: .build-i386-linux-deb9
307 308 309
  artifacts:
    when: always
    expire_in: 2 week
310 311

nightly-i386-linux-deb9:
312
  extends: .build-i386-linux-deb9
313 314 315 316
  variables:
    TEST_TYPE: slowtest
  artifacts:
    when: always
317
    expire_in: 2 week
318 319 320
  only:
    variables:
      - $NIGHTLY
321

322 323 324
#################################
# x86_64-linux-deb9
#################################
Ben Gamari's avatar
Ben Gamari committed
325

326
.build-x86_64-linux-deb9:
Ben Gamari's avatar
Ben Gamari committed
327
  extends: .validate-linux
328
  stage: full-build
329
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
330 331
  variables:
    TEST_ENV: "x86_64-linux-deb9"
332
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-deb9-linux.tar.xz"
Ben Gamari's avatar
Ben Gamari committed
333 334 335
  cache:
    key: linux-x86_64-deb9

336 337
validate-x86_64-linux-deb9:
  extends: .build-x86_64-linux-deb9
338 339 340 341
  artifacts:
    when: always
    expire_in: 2 week

342
nightly-x86_64-linux-deb9:
343
  extends: .build-x86_64-linux-deb9
344
  artifacts:
345
    expire_in: 2 year
346 347 348 349 350 351
  variables:
    TEST_TYPE: slowtest
  only:
    variables:
      - $NIGHTLY

352 353 354
# N.B. Has DEBUG assertions enabled in stage2
validate-x86_64-linux-deb9-debug:
  extends: .build-x86_64-linux-deb9
355
  stage: build
356 357 358 359
  variables:
    BUILD_FLAVOUR: validate
    TEST_ENV: "x86_64-linux-deb9-debug"

Ben Gamari's avatar
Ben Gamari committed
360
validate-x86_64-linux-deb9-llvm:
361
  extends: .build-x86_64-linux-deb9
362
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
363 364
  variables:
    BUILD_FLAVOUR: perf-llvm
365
    TEST_ENV: "x86_64-linux-deb9-llvm"
366 367 368 369 370 371 372

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"
373
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-deb9-linux-integer-simple.tar.xz"
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398

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
399

400
release-x86_64-linux-deb8:
Ben Gamari's avatar
Ben Gamari committed
401
  extends: .validate-linux
402
  stage: full-build
403
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb8:$DOCKER_REV"
404 405
  variables:
    TEST_ENV: "x86_64-linux-deb8"
406
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-deb8-linux.tar.xz"
407 408
  only:
    - tags
Ben Gamari's avatar
Ben Gamari committed
409 410
  cache:
    key: linux-x86_64-deb8
411 412 413
  artifacts:
    when: always
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
414

415 416 417 418 419

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

420
validate-x86_64-linux-fedora27:
Ben Gamari's avatar
Ben Gamari committed
421
  extends: .validate-linux
422
  stage: full-build
423
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora27:$DOCKER_REV"
424 425
  variables:
    TEST_ENV: "x86_64-linux-fedora27"
426
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-fedora27-linux.tar.xz"
Ben Gamari's avatar
Ben Gamari committed
427 428
  cache:
    key: linux-x86_64-fedora27
429 430
  artifacts:
    when: always
431
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
432

Ben Gamari's avatar
Ben Gamari committed
433
############################################################
434
# Validation via Pipelines (Windows)
Ben Gamari's avatar
Ben Gamari committed
435 436
############################################################

437
.build-windows:
438
  <<: *only-default
Ben Gamari's avatar
Ben Gamari committed
439
  before_script:
440
    - git clean -xdf
441
    - git submodule foreach git clean -xdf
442 443 444 445 446 447 448 449 450

    # 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
451 452 453 454
    - python .gitlab/fix-submodules.py
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
455
    - "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
456
    - bash .gitlab/win32-init.sh
457 458
  after_script:
    - rd /s /q tmp
459
    - robocopy /np /nfl /ndl /e "%APPDATA%\cabal" cabal-cache
460
    - bash -c 'make clean || true'
461
  dependencies: []
Tamar Christina's avatar
Tamar Christina committed
462 463
  variables:
    FORCE_SYMLINKS: 1
464
    LANG: "en_US.UTF-8"
Ben Gamari's avatar
Ben Gamari committed
465 466 467 468 469 470
  cache:
    paths:
      - cabal-cache
      - ghc-8.6.2
      - ghc-tarballs

471 472
.build-windows-hadrian:
  extends: .build-windows
473
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
474 475 476 477 478
  variables:
    GHC_VERSION: "8.6.2"
  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 481
    - 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
482
    # FIXME: Testsuite disabled due to #16156.
483
    # - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
Ben Gamari's avatar
Ben Gamari committed
484 485
  tags:
    - x86_64-windows
486 487 488 489
  artifacts:
    when: always
    paths:
      - ghc.tar.xz
Ben Gamari's avatar
Ben Gamari committed
490

491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509
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
510
  stage: full-build
511 512
  # due to #16084
  allow_failure: true
513
  variables:
514
    BUILD_FLAVOUR: "quick"
515
    GHC_VERSION: "8.6.2"
516
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-mingw32.tar.xz"
517 518 519
  script:
    - |
      python boot
520
      bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex $CONFIGURE_ARGS'
521
    - bash -c "echo include mk/flavours/${BUILD_FLAVOUR}.mk > mk/build.mk"
522
    - bash -c "PATH=`pwd`/toolchain/bin:$PATH make -j`mk/detect-cpu-count.sh`"
523
    - bash -c "PATH=`pwd`/toolchain/bin:$PATH make binary-dist TAR_COMP_OPTS=-1"
524
    - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
525 526
  tags:
    - x86_64-windows
527 528
  artifacts:
    when: always
529
    expire_in: 2 week
530 531 532
    reports:
      junit: junit.xml
    paths:
533
      - ghc-*.tar.xz
534
      - junit.xml
Ben Gamari's avatar
Ben Gamari committed
535

536 537 538 539
validate-x86_64-windows:
  extends: .build-windows-make
  variables:
    MSYSTEM: MINGW64
540
    CONFIGURE_ARGS: "--target=x86_64-unknown-mingw32"
541 542 543
  cache:
    key: x86_64-windows

544 545 546 547 548 549
# Normal Windows validate builds are profiled; that won't do for releases.
release-x86_64-windows:
  extends: validate-x86_64-windows
  variables:
    MSYSTEM: MINGW64
    BUILD_FLAVOUR: "perf"
550
    CONFIGURE_ARGS: "--target=x86_64-unknown-mingw32"
551 552 553
  only:
    - tags

554 555 556 557 558 559
release-i386-windows:
  extends: .build-windows-make
  only:
    - tags
  variables:
    MSYSTEM: MINGW32
560
    BUILD_FLAVOUR: "perf"
561
    CONFIGURE_ARGS: "--target=i386-unknown-mingw32"
562 563 564 565 566 567 568 569 570 571
  cache:
    key: i386-windows

nightly-i386-windows:
  extends: .build-windows-make
  only:
    variables:
      - $NIGHTLY
  variables:
    MSYSTEM: MINGW32
572
    CONFIGURE_ARGS: "--target=i386-unknown-mingw32"
573 574 575
  cache:
    key: i386-windows

576 577 578 579
############################################################
# Cleanup
############################################################

580 581
# Note [Cleaning up after shell executor]
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
582 583 584 585 586 587 588 589 590
#
# 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

591
# See Note [Cleanup after shell executor]
592
cleanup-windows:
593
  <<: *only-default
594 595 596 597
  stage: cleanup
  tags:
    - x86_64-windows
  when: always
598
  dependencies: []
599 600 601 602 603 604 605 606 607
  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
608 609 610 611
    # 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"
612
    - exit /b 0
613 614 615

# See Note [Cleanup after shell executor]
cleanup-darwin:
616
  <<: *only-default
617 618 619 620
  stage: cleanup
  tags:
    - x86_64-darwin
  when: always
621
  dependencies: []
622 623 624 625 626 627 628 629 630 631 632
  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

633 634 635 636 637
############################################################
# Packaging
############################################################

doc-tarball:
638
  <<: *only-default
639
  stage: packaging
640
  allow_failure: true
641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659
  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 .

660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677
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
678 679 680 681 682 683 684 685 686 687 688 689 690


############################################################
# Testing via head.hackage
############################################################

# Triggering jobs in the ghc/head.hackage project requires that we have a job
# token for that repository. Furthermore the head.hackage CI job must have
# access to an unprivileged access token with the ability to query the ghc/ghc
# project such that it can find the job ID of the fedora27 job for the current
# pipeline.

.hackage:
691
  <<: *only-default
692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716
  stage: hackage
  image: ghcci/x86_64-linux-deb9:0.2
  tags:
    - x86_64-linux
  dependencies: []
  variables:
    HEAD_HACKAGE_PROJECT_ID: "78"
  script:
    - bash .gitlab/start-head.hackage.sh

hackage:
  extends: .hackage
  when: manual

hackage-label:
  extends: .hackage
  only:
    variables:
      - $CI_MERGE_REQUEST_LABELS =~ /.*user-facing.*/

nightly-hackage:
  extends: .hackage
  only:
    variables:
      - $NIGHTLY
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736

pages:
  stage: deploy
  dependencies:
    - doc-tarball
  image: ghcci/x86_64-linux-deb9:0.2
  tags:
    - x86_64-linux
  script:
    - mkdir -p public/doc
    - tar -xf haddock.html.tar.xz -C public/doc
    - tar -xf libraries.html.tar.xz -C public/doc
    - tar -xf users_guide.html.tar.xz -C public/doc
    - cp -f index.html public/doc
  only:
    - master
  artifacts:
    paths:
      - public