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

Ben Gamari's avatar
Ben Gamari committed
4 5 6
  # Commit of ghc/ci-images repository from which to pull Docker images
  DOCKER_REV: cefaee3c742af193e0f7783f87edb0d35374515c

7 8 9 10 11
before_script:
  - python3 .gitlab/fix-submodules.py
  - git submodule sync --recursive
  - git submodule update --init --recursive
  - git checkout .gitmodules
Ben Gamari's avatar
Ben Gamari committed
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:
Ben Gamari's avatar
Ben Gamari committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28
  - 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
  - deploy     # push documentation

.only-default: &only-default
  only:
    - master
    - /ghc-[0-9]+\.[0-9]+/
    - merge_requests
    - tags
Ben Gamari's avatar
Ben Gamari committed
29

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
############################################################
# Linting
############################################################

ghc-linters:
Ben Gamari's avatar
Ben Gamari committed
47
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
48
  stage: lint
Ben Gamari's avatar
Ben Gamari committed
49
  image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
Ben Gamari's avatar
Ben Gamari committed
50
  script:
Ben Gamari's avatar
Ben Gamari committed
51 52 53 54 55 56 57 58 59 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 90 91 92 93 94
    - git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
    - base="$(git merge-base FETCH_HEAD $CI_COMMIT_SHA)"
    - "echo Merge base $base"
    #    - 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
  dependencies: []
  tags:
    - lint
  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

.lint-changelogs:
  stage: lint
  image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
95
  dependencies: []
Ben Gamari's avatar
Ben Gamari committed
96 97
  tags:
    - lint
Ben Gamari's avatar
Ben Gamari committed
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
  script:
    - |
      grep TBA libraries/*/changelog.md && (
          echo "Error: Found \"TBA\"s in changelogs."
          exit 1
      )

lint-changelogs:
  extends: .lint-changelogs
  allow_failure: true
  only:
    refs:
      - /ghc-[0-9]+\.[0-9]+/

lint-release-changelogs:
  extends: .lint-changelogs
  only:
115
    refs:
116
      - /ghc-[0-9]+\.[0-9]+\.[0-9]+-.*-release/
Ben Gamari's avatar
Ben Gamari committed
117

Ben Gamari's avatar
Ben Gamari committed
118

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

Ben Gamari's avatar
Ben Gamari committed
123
.validate-hadrian:
Ben Gamari's avatar
Ben Gamari committed
124
  <<: *only-default
Ben Gamari's avatar
Ben Gamari committed
125
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
126
  script:
Ben Gamari's avatar
Ben Gamari committed
127
    - cabal update
128
    - git clean -xdf && git submodule foreach git clean -xdf
Ben Gamari's avatar
Ben Gamari committed
129 130 131
    - 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
132
    - ./configure $CONFIGURE_ARGS
Ben Gamari's avatar
Ben Gamari committed
133 134
    - 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
135 136
  cache:
    key: hadrian
137
    paths:
Ben Gamari's avatar
Ben Gamari committed
138
      - cabal-cache
Ben Gamari's avatar
Ben Gamari committed
139 140 141 142
  artifacts:
    when: always
    paths:
      - ghc.tar.xz
143

Ben Gamari's avatar
Ben Gamari committed
144
validate-x86_64-linux-deb8-hadrian:
Ben Gamari's avatar
Ben Gamari committed
145
  extends: .validate-hadrian
146
  stage: build
Ben Gamari's avatar
Ben Gamari committed
147
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb8:$DOCKER_REV"
Ben Gamari's avatar
Ben Gamari committed
148 149 150
  before_script:
    # workaround for docker permissions
    - sudo chown ghc:ghc -R .
151 152 153 154
    - python3 .gitlab/fix-submodules.py
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
Ben Gamari's avatar
Ben Gamari committed
155
    - "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
156 157 158
  tags:
    - x86_64-linux

Ben Gamari's avatar
Ben Gamari committed
159

Ben Gamari's avatar
Ben Gamari committed
160 161 162 163 164
############################################################
# Validation via Pipelines (make)
############################################################

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

Ben Gamari's avatar
Ben Gamari committed
190 191 192 193
#################################
# x86_64-darwin
#################################

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

Ben Gamari's avatar
Ben Gamari committed
216 217 218 219
    - bash .gitlab/darwin-init.sh
    - PATH="`pwd`/toolchain/bin:$PATH"
  after_script:
    - cp -Rf $HOME/.cabal cabal-cache
220 221
  artifacts:
    when: always
222
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
223 224 225 226 227 228
  cache:
    key: darwin
    paths:
      - cabal-cache
      - toolchain

Ben Gamari's avatar
Ben Gamari committed
229
.validate-linux:
Ben Gamari's avatar
Ben Gamari committed
230 231 232 233
  extends: .validate
  tags:
    - x86_64-linux
  before_script:
Ben Gamari's avatar
Ben Gamari committed
234
    - git clean -xdf && git submodule foreach git clean -xdf
235 236 237 238
    - python3 .gitlab/fix-submodules.py
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
Ben Gamari's avatar
Ben Gamari committed
239 240 241 242 243 244
    - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
      # Build hyperlinked sources for documentation when building releases
    - |
      if [[ -n "$CI_COMMIT_TAG" ]]; then
        echo "EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump" >> mk/build.mk
      fi
245

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

Ben Gamari's avatar
Ben Gamari committed
257 258 259 260 261
#################################
# aarch64-linux-deb9
#################################

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

Ben Gamari's avatar
Ben Gamari committed
274 275 276 277 278 279
validate-aarch64-linux-deb9:
  extends: .build-aarch64-linux-deb9
  artifacts:
    when: always
    expire_in: 2 week

280
nightly-aarch64-linux-deb9:
Ben Gamari's avatar
Ben Gamari committed
281
  extends: .build-aarch64-linux-deb9
282 283 284 285 286 287 288 289
  artifacts:
    expire_in: 2 year
  variables:
    TEST_TYPE: slowtest
  only:
    variables:
      - $NIGHTLY

Ben Gamari's avatar
Ben Gamari committed
290 291 292 293 294
#################################
# i386-linux-deb9
#################################

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

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

nightly-i386-linux-deb9:
Ben Gamari's avatar
Ben Gamari committed
311
  extends: .build-i386-linux-deb9
312 313 314 315 316
  variables:
    TEST_TYPE: slowtest
  artifacts:
    when: always
    expire_in: 2 week
317 318 319
  only:
    variables:
      - $NIGHTLY
Ben Gamari's avatar
Ben Gamari committed
320 321 322 323 324 325 326 327 328 329 330 331

#################################
# x86_64-linux-deb9
#################################

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

Ben Gamari's avatar
Ben Gamari committed
335
validate-x86_64-linux-deb9:
Ben Gamari's avatar
Ben Gamari committed
336
  extends: .build-x86_64-linux-deb9
Ben Gamari's avatar
Ben Gamari committed
337 338
  artifacts:
    when: always
339
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
340

341
nightly-x86_64-linux-deb9:
Ben Gamari's avatar
Ben Gamari committed
342
  extends: .build-x86_64-linux-deb9
343 344 345 346 347 348 349 350
  artifacts:
    expire_in: 2 year
  variables:
    TEST_TYPE: slowtest
  only:
    variables:
      - $NIGHTLY

Ben Gamari's avatar
Ben Gamari committed
351 352 353 354 355 356 357 358
# N.B. Has DEBUG assertions enabled in stage2
validate-x86_64-linux-deb9-debug:
  extends: .build-x86_64-linux-deb9
  stage: build
  variables:
    BUILD_FLAVOUR: validate
    TEST_ENV: "x86_64-linux-deb9-debug"

Ben Gamari's avatar
Ben Gamari committed
359
validate-x86_64-linux-deb9-llvm:
Ben Gamari's avatar
Ben Gamari committed
360
  extends: .build-x86_64-linux-deb9
361
  stage: full-build
362
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
363 364
  variables:
    BUILD_FLAVOUR: perf-llvm
Ben Gamari's avatar
Ben Gamari committed
365
    TEST_ENV: "x86_64-linux-deb9-llvm"
Ben Gamari's avatar
Ben Gamari committed
366 367

validate-x86_64-linux-deb9-integer-simple:
Ben Gamari's avatar
Ben Gamari committed
368
  extends: .build-x86_64-linux-deb9
369
  stage: full-build
370
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
371 372
  variables:
    INTEGER_LIBRARY: integer-simple
Ben Gamari's avatar
Ben Gamari committed
373 374
    TEST_ENV: "x86_64-linux-deb9-integer-simple"
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-deb9-linux-integer-simple.tar.xz"
Ben Gamari's avatar
Ben Gamari committed
375

376
nightly-x86_64-linux-deb9-integer-simple:
Ben Gamari's avatar
Ben Gamari committed
377
  extends: .build-x86_64-linux-deb9
378
  stage: full-build
379
  variables:
Ben Gamari's avatar
Ben Gamari committed
380 381
    INTEGER_LIBRARY: integer-simple
    TEST_ENV: "x86_64-linux-deb9-integer-simple"
382
    TEST_TYPE: slowtest
Ben Gamari's avatar
Ben Gamari committed
383 384
  artifacts:
    expire_in: 2 year
385 386 387 388
  only:
    variables:
      - $NIGHTLY

Ben Gamari's avatar
Ben Gamari committed
389
validate-x86_64-linux-deb9-unreg:
Ben Gamari's avatar
Ben Gamari committed
390
  extends: .build-x86_64-linux-deb9
391
  stage: full-build
392
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
393 394
  variables:
    CONFIGURE_ARGS: --enable-unregisterised
Ben Gamari's avatar
Ben Gamari committed
395 396
    TEST_ENV: "x86_64-linux-deb9-unreg"

397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
release-x86_64-linux-deb9-dwarf:
  extends: .validate-linux
  stage: build
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
  allow_failure: true
  variables:
    CONFIGURE_ARGS: "--enable-dwarf-unwind"
    BUILD_FLAVOUR: dwarf
    TEST_ENV: "x86_64-linux-deb9"
  artifacts:
    when: always
    expire_in: 2 week
  cache:
    key: linux-x86_64-deb9

Ben Gamari's avatar
Ben Gamari committed
412 413 414 415 416 417 418 419 420 421 422 423

#################################
# x86_64-linux-deb8
#################################

release-x86_64-linux-deb8:
  extends: .validate-linux
  stage: full-build
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb8:$DOCKER_REV"
  variables:
    TEST_ENV: "x86_64-linux-deb8"
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-deb8-linux.tar.xz"
424 425
    # Disable sphinx PDF output as our Debian image doesn't have the requisite packages
    BUILD_SPHINX_PDF: "NO"
Ben Gamari's avatar
Ben Gamari committed
426 427
  only:
    - tags
Ben Gamari's avatar
Ben Gamari committed
428
  cache:
Ben Gamari's avatar
Ben Gamari committed
429 430 431 432 433
    key: linux-x86_64-deb8
  artifacts:
    when: always
    expire_in: 2 week

434 435 436 437 438 439 440 441 442
#################################
# x86_64-linux-centos7
#################################

release-x86_64-linux-centos7:
  extends: .validate-linux
  stage: full-build
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-centos7:$DOCKER_REV"
  variables:
443 444
    # For the testsuite
    LANG: "en_US.UTF-8"
445 446 447 448 449
    # The sphinx release shipped with Centos 7 fails to build out documentation
    BUILD_SPHINX_HTML: "NO"
    BUILD_SPHINX_PDF: "NO"
    TEST_ENV: "x86_64-linux-centos7"
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-centos7-linux.tar.xz"
450
  allow_failure: true
451 452 453 454 455 456 457
  only:
    - tags
  cache:
    key: linux-x86_64-centos7
  artifacts:
    when: always
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474

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

validate-x86_64-linux-fedora27:
  extends: .validate-linux
  stage: full-build
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora27:$DOCKER_REV"
  variables:
    TEST_ENV: "x86_64-linux-fedora27"
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-fedora27-linux.tar.xz"
  cache:
    key: linux-x86_64-fedora27
  artifacts:
    when: always
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
475

Ben Gamari's avatar
Ben Gamari committed
476
############################################################
477
# Validation via Pipelines (Windows)
Ben Gamari's avatar
Ben Gamari committed
478 479
############################################################

Ben Gamari's avatar
Ben Gamari committed
480 481
.build-windows:
  <<: *only-default
Ben Gamari's avatar
Ben Gamari committed
482
  before_script:
483
    - git clean -xdf
484
    - git submodule foreach git clean -xdf
485 486 487 488 489 490 491 492 493

    # 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
494 495 496 497
    - python .gitlab/fix-submodules.py
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
Ben Gamari's avatar
Ben Gamari committed
498
    - "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
499
    - bash .gitlab/win32-init.sh
500 501
  after_script:
    - rd /s /q tmp
502
    - robocopy /np /nfl /ndl /e "%APPDATA%\cabal" cabal-cache
503
    - bash -c 'make clean || true'
504
  dependencies: []
Ben Gamari's avatar
Ben Gamari committed
505 506 507
  variables:
    FORCE_SYMLINKS: 1
    LANG: "en_US.UTF-8"
Ben Gamari's avatar
Ben Gamari committed
508 509 510 511 512 513
  cache:
    paths:
      - cabal-cache
      - ghc-8.6.2
      - ghc-tarballs

Ben Gamari's avatar
Ben Gamari committed
514 515
.build-windows-hadrian:
  extends: .build-windows
516
  stage: full-build
517
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
518 519 520 521 522
  variables:
    GHC_VERSION: "8.6.2"
  script:
    - |
      python boot
523
      bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex'
Ben Gamari's avatar
Ben Gamari committed
524 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"
    - mv _build/bindist/ghc*.tar.xz ghc.tar.xz
526
    # FIXME: Testsuite disabled due to #16156.
Ben Gamari's avatar
Ben Gamari committed
527
    # - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
Ben Gamari's avatar
Ben Gamari committed
528 529
  tags:
    - x86_64-windows
Ben Gamari's avatar
Ben Gamari committed
530 531 532 533
  artifacts:
    when: always
    paths:
      - ghc.tar.xz
Ben Gamari's avatar
Ben Gamari committed
534

Ben Gamari's avatar
Ben Gamari committed
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553
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
554
  stage: full-build
555 556
  # due to #16084
  allow_failure: true
557
  variables:
Ben Gamari's avatar
Ben Gamari committed
558
    BUILD_FLAVOUR: "quick"
559
    GHC_VERSION: "8.6.2"
Ben Gamari's avatar
Ben Gamari committed
560
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-mingw32.tar.xz"
561 562 563
  script:
    - |
      python boot
Ben Gamari's avatar
Ben Gamari committed
564 565
      bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex $CONFIGURE_ARGS'
    - bash -c "echo include mk/flavours/${BUILD_FLAVOUR}.mk > mk/build.mk"
566
    - bash -c "echo 'GhcLibHcOpts+=-haddock' >> mk/build.mk"
567
    - bash -c "PATH=`pwd`/toolchain/bin:$PATH make -j`mk/detect-cpu-count.sh`"
Ben Gamari's avatar
Ben Gamari committed
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 571
  tags:
    - x86_64-windows
572 573
  artifacts:
    when: always
Ben Gamari's avatar
Ben Gamari committed
574
    expire_in: 2 week
575 576 577
    reports:
      junit: junit.xml
    paths:
Ben Gamari's avatar
Ben Gamari committed
578
      - ghc-*.tar.xz
579
      - junit.xml
Ben Gamari's avatar
Ben Gamari committed
580

Ben Gamari's avatar
Ben Gamari committed
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606
validate-x86_64-windows:
  extends: .build-windows-make
  variables:
    MSYSTEM: MINGW64
    CONFIGURE_ARGS: "--target=x86_64-unknown-mingw32"
  cache:
    key: x86_64-windows

# 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"
    CONFIGURE_ARGS: "--target=x86_64-unknown-mingw32"
  only:
    - tags

release-i386-windows:
  extends: .build-windows-make
  only:
    - tags
  variables:
    MSYSTEM: MINGW32
    BUILD_FLAVOUR: "perf"
    CONFIGURE_ARGS: "--target=i386-unknown-mingw32"
607 608
    # Due to #15934
    BUILD_PROF_LIBS: "NO"
Ben Gamari's avatar
Ben Gamari committed
609 610 611 612 613 614 615 616 617 618 619
  cache:
    key: i386-windows

nightly-i386-windows:
  extends: .build-windows-make
  only:
    variables:
      - $NIGHTLY
  variables:
    MSYSTEM: MINGW32
    CONFIGURE_ARGS: "--target=i386-unknown-mingw32"
620 621
    # Due to #15934
    BUILD_PROF_LIBS: "NO"
Ben Gamari's avatar
Ben Gamari committed
622 623 624 625 626 627 628
  cache:
    key: i386-windows

############################################################
# Cleanup
############################################################

629 630
# Note [Cleaning up after shell executor]
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ben Gamari's avatar
Ben Gamari committed
631 632 633 634 635 636 637 638 639
#
# 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

640
# See Note [Cleanup after shell executor]
Ben Gamari's avatar
Ben Gamari committed
641
cleanup-windows:
Ben Gamari's avatar
Ben Gamari committed
642
  <<: *only-default
Ben Gamari's avatar
Ben Gamari committed
643 644 645 646
  stage: cleanup
  tags:
    - x86_64-windows
  when: always
647
  dependencies: []
Ben Gamari's avatar
Ben Gamari committed
648 649 650 651 652 653 654 655 656
  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
657 658 659 660
    # 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
661
    - exit /b 0
662 663 664

# See Note [Cleanup after shell executor]
cleanup-darwin:
Ben Gamari's avatar
Ben Gamari committed
665
  <<: *only-default
666 667 668 669
  stage: cleanup
  tags:
    - x86_64-darwin
  when: always
Ben Gamari's avatar
Ben Gamari committed
670
  dependencies: []
671 672 673 674 675 676 677 678 679 680 681
  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

Ben Gamari's avatar
Ben Gamari committed
682 683 684 685 686 687 688 689
############################################################
# Packaging
############################################################

source-tarball:
  stage: packaging
  tags:
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
690 691
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
  dependencies: []
Ben Gamari's avatar
Ben Gamari committed
692 693 694 695 696 697 698 699 700 701 702 703
  only:
    - tags
  artifacts:
    paths:
      - ghc-*.tar.xz
      - version
  script:
    - mk/get-win32-tarballs.sh download all
    - ./boot
    - ./configure
    - make sdist
    - mv sdistprep/*.xz  .
Ben Gamari's avatar
Ben Gamari committed
704 705 706
    - make show! --quiet VALUE=ProjectVersion > version
    - source version
    - echo "$ProjectVersion" > version
Ben Gamari's avatar
Ben Gamari committed
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721


############################################################
# 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:
  <<: *only-default
  stage: hackage
Ben Gamari's avatar
Ben Gamari committed
722
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
Ben Gamari's avatar
Ben Gamari committed
723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746
  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