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

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

Ben Gamari's avatar
Ben Gamari committed
7 8 9 10
  # Sequential version number capturing the versions of all tools fetched by
  # .gitlab/win32-init.sh.
  WINDOWS_TOOLCHAIN_VERSION: 1

11 12 13 14 15
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
16
  - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
17

Ben Gamari's avatar
Ben Gamari committed
18
stages:
Ben Gamari's avatar
Ben Gamari committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32
  - 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
33

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

ghc-linters:
Ben Gamari's avatar
Ben Gamari committed
51
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
52
  stage: lint
Ben Gamari's avatar
Ben Gamari committed
53
  image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
Ben Gamari's avatar
Ben Gamari committed
54
  script:
Ben Gamari's avatar
Ben Gamari committed
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 95 96 97 98
    - 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"
99
  dependencies: []
Ben Gamari's avatar
Ben Gamari committed
100 101
  tags:
    - lint
Ben Gamari's avatar
Ben Gamari committed
102
  script:
103
    - bash .gitlab/linters/check-changelogs.sh
Ben Gamari's avatar
Ben Gamari committed
104 105 106 107 108 109 110 111 112 113 114

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
201
    CABAL_INSTALL_VERSION: 2.4.1.0
Ben Gamari's avatar
Ben Gamari committed
202
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-apple-darwin.tar.xz"
Ben Gamari's avatar
Ben Gamari committed
203 204 205
    MACOSX_DEPLOYMENT_TARGET: "10.7"
    # Only Sierra and onwards supports clock_gettime. See #12858
    ac_cv_func_clock_gettime: "no"
206
    LANG: "en_US.UTF-8"
207
    CONFIGURE_ARGS: --with-intree-gmp
Ben Gamari's avatar
Ben Gamari committed
208
    TEST_ENV: "x86_64-darwin"
Ben Gamari's avatar
Ben Gamari committed
209
  before_script:
Ben Gamari's avatar
Ben Gamari committed
210
    - git clean -xdf && git submodule foreach git clean -xdf
211
    - python3 .gitlab/fix-submodules.py
212 213 214
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
Ben Gamari's avatar
Ben Gamari committed
215
    - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
216

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

Ben Gamari's avatar
Ben Gamari committed
230
.validate-linux:
Ben Gamari's avatar
Ben Gamari committed
231 232 233 234
  extends: .validate
  tags:
    - x86_64-linux
  before_script:
Ben Gamari's avatar
Ben Gamari committed
235
    - git clean -xdf && git submodule foreach git clean -xdf
236 237 238 239
    - python3 .gitlab/fix-submodules.py
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
Ben Gamari's avatar
Ben Gamari committed
240 241 242 243 244 245
    - "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
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

Ben Gamari's avatar
Ben Gamari committed
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
Ben Gamari's avatar
Ben Gamari committed
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
Ben Gamari's avatar
Ben Gamari committed
267 268 269
  variables:
    TEST_ENV: "aarch64-linux-deb9"
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-aarch64-linux-deb9.tar.xz"
270 271
    # Inexplicably makeindex fails
    BUILD_SPHINX_PDF: "NO"
Ben Gamari's avatar
Ben Gamari committed
272 273 274 275 276
  cache:
    key: linux-aarch64-deb9
  tags:
    - aarch64-linux

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

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

Ben Gamari's avatar
Ben Gamari committed
293 294 295 296 297
#################################
# i386-linux-deb9
#################################

.build-i386-linux-deb9:
298 299
  extends: .validate-linux
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
300 301 302 303 304 305 306 307 308
  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
309 310 311 312 313
  artifacts:
    when: always
    expire_in: 2 week

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

#################################
# 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"
335
  cache:
Ben Gamari's avatar
Ben Gamari committed
336
    key: linux-x86_64-deb9
337

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

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

Ben Gamari's avatar
Ben Gamari committed
354 355 356 357 358 359 360 361
# 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
362
validate-x86_64-linux-deb9-llvm:
Ben Gamari's avatar
Ben Gamari committed
363
  extends: .build-x86_64-linux-deb9
364
  stage: full-build
365
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
366 367
  variables:
    BUILD_FLAVOUR: perf-llvm
Ben Gamari's avatar
Ben Gamari committed
368
    TEST_ENV: "x86_64-linux-deb9-llvm"
Ben Gamari's avatar
Ben Gamari committed
369 370

validate-x86_64-linux-deb9-integer-simple:
Ben Gamari's avatar
Ben Gamari committed
371
  extends: .build-x86_64-linux-deb9
372
  stage: full-build
373
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
374 375
  variables:
    INTEGER_LIBRARY: integer-simple
Ben Gamari's avatar
Ben Gamari committed
376 377
    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
378

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

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

400 401 402 403 404 405 406 407 408 409 410 411 412 413 414
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
415 416 417 418 419 420 421 422 423 424 425 426

#################################
# 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"
427 428
    # 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
429 430
  only:
    - tags
Ben Gamari's avatar
Ben Gamari committed
431
  cache:
Ben Gamari's avatar
Ben Gamari committed
432 433 434 435 436
    key: linux-x86_64-deb8
  artifacts:
    when: always
    expire_in: 2 week

437 438 439 440 441 442 443 444 445
#################################
# 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:
446 447
    # For the testsuite
    LANG: "en_US.UTF-8"
448 449 450 451 452
    # 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"
453
  allow_failure: true
454 455 456 457 458 459 460
  only:
    - tags
  cache:
    key: linux-x86_64-centos7
  artifacts:
    when: always
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477

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

Ben Gamari's avatar
Ben Gamari committed
479
############################################################
480
# Validation via Pipelines (Windows)
Ben Gamari's avatar
Ben Gamari committed
481 482
############################################################

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

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

Ben Gamari's avatar
Ben Gamari committed
518 519
.build-windows-hadrian:
  extends: .build-windows
520
  stage: full-build
521
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
522 523 524 525 526
  variables:
    GHC_VERSION: "8.6.2"
  script:
    - |
      python boot
527
      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
528 529
    - 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
530
    # FIXME: Testsuite disabled due to #16156.
Ben Gamari's avatar
Ben Gamari committed
531
    # - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
Ben Gamari's avatar
Ben Gamari committed
532 533
  tags:
    - x86_64-windows
Ben Gamari's avatar
Ben Gamari committed
534 535 536 537
  artifacts:
    when: always
    paths:
      - ghc.tar.xz
Ben Gamari's avatar
Ben Gamari committed
538

Ben Gamari's avatar
Ben Gamari committed
539 540 541 542 543
validate-x86_64-windows-hadrian:
  extends: .build-windows-hadrian
  variables:
    MSYSTEM: MINGW64
  cache:
Ben Gamari's avatar
Ben Gamari committed
544
    key: "x86_64-windows-hadrian-$WINDOWS_TOOLCHAIN_VERSION"
Ben Gamari's avatar
Ben Gamari committed
545 546 547 548 549 550 551 552 553

nightly-i386-windows-hadrian:
  extends: .build-windows-hadrian
  variables:
    MSYSTEM: MINGW32
  only:
    variables:
      - $NIGHTLY
  cache:
Ben Gamari's avatar
Ben Gamari committed
554
    key: "i386-windows-hadrian-$WINDOWS_TOOLCHAIN_VERSION"
Ben Gamari's avatar
Ben Gamari committed
555 556 557

.build-windows-make:
  extends: .build-windows
558
  stage: full-build
559 560
  # due to #16084
  allow_failure: true
561
  variables:
562
    BUILD_FLAVOUR: "UNSET"
563
    GHC_VERSION: "8.6.2"
564
    BUILD_PROF_LIBS: "YES"
Ben Gamari's avatar
Ben Gamari committed
565
    BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-mingw32.tar.xz"
566 567 568
  script:
    - |
      python boot
Ben Gamari's avatar
Ben Gamari committed
569
      bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex $CONFIGURE_ARGS'
570 571 572
    - bash -c "echo \"include mk/flavours/${BUILD_FLAVOUR}.mk\" > mk/build.mk"
    - bash -c "echo \"GhcLibHcOpts+=-haddock\" >> mk/build.mk"
    - bash -c "echo \"BUILD_PROF_LIBS = $BUILD_PROF_LIBS\" >> mk/build.mk"
573
    - bash -c "PATH=`pwd`/toolchain/bin:$PATH make -j`mk/detect-cpu-count.sh`"
Ben Gamari's avatar
Ben Gamari committed
574
    - bash -c "PATH=`pwd`/toolchain/bin:$PATH make binary-dist TAR_COMP_OPTS=-1"
575
    - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
576 577
  tags:
    - x86_64-windows
578 579
  artifacts:
    when: always
Ben Gamari's avatar
Ben Gamari committed
580
    expire_in: 2 week
581 582 583
    reports:
      junit: junit.xml
    paths:
Ben Gamari's avatar
Ben Gamari committed
584
      - ghc-*.tar.xz
585
      - junit.xml
Ben Gamari's avatar
Ben Gamari committed
586

Ben Gamari's avatar
Ben Gamari committed
587 588 589 590
validate-x86_64-windows:
  extends: .build-windows-make
  variables:
    MSYSTEM: MINGW64
591
    BUILD_FLAVOUR: "quick"
Ben Gamari's avatar
Ben Gamari committed
592 593
    CONFIGURE_ARGS: "--target=x86_64-unknown-mingw32"
  cache:
Ben Gamari's avatar
Ben Gamari committed
594
    key: "x86_64-windows-$WINDOWS_TOOLCHAIN_VERSION"
Ben Gamari's avatar
Ben Gamari committed
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613

# 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"
614 615
    # Due to #15934
    BUILD_PROF_LIBS: "NO"
Ben Gamari's avatar
Ben Gamari committed
616
  cache:
Ben Gamari's avatar
Ben Gamari committed
617
    key: "i386-windows-$WINDOWS_TOOLCHAIN_VERSION"
Ben Gamari's avatar
Ben Gamari committed
618 619 620 621 622 623 624 625 626

nightly-i386-windows:
  extends: .build-windows-make
  only:
    variables:
      - $NIGHTLY
  variables:
    MSYSTEM: MINGW32
    CONFIGURE_ARGS: "--target=i386-unknown-mingw32"
627
    BUILD_FLAVOUR: "quick"
628 629
    # Due to #15934
    BUILD_PROF_LIBS: "NO"
Ben Gamari's avatar
Ben Gamari committed
630
  cache:
Ben Gamari's avatar
Ben Gamari committed
631
    key: "i386-windows-$WINDOWS_TOOLCHAIN_VERSION"
Ben Gamari's avatar
Ben Gamari committed
632 633 634 635 636

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

637 638
# Note [Cleaning up after shell executor]
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ben Gamari's avatar
Ben Gamari committed
639 640 641 642 643 644 645 646 647
#
# 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

648
# See Note [Cleanup after shell executor]
Ben Gamari's avatar
Ben Gamari committed
649
cleanup-windows:
Ben Gamari's avatar
Ben Gamari committed
650
  <<: *only-default
Ben Gamari's avatar
Ben Gamari committed
651 652 653 654
  stage: cleanup
  tags:
    - x86_64-windows
  when: always
655
  dependencies: []
Ben Gamari's avatar
Ben Gamari committed
656 657 658 659 660 661 662 663 664
  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
665 666 667 668
    # 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
669
    - exit /b 0
670 671 672

# See Note [Cleanup after shell executor]
cleanup-darwin:
Ben Gamari's avatar
Ben Gamari committed
673
  <<: *only-default
674 675 676 677
  stage: cleanup
  tags:
    - x86_64-darwin
  when: always
Ben Gamari's avatar
Ben Gamari committed
678
  dependencies: []
679 680 681 682 683 684 685 686 687 688 689
  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
690 691 692 693 694 695 696 697
############################################################
# Packaging
############################################################

source-tarball:
  stage: packaging
  tags:
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
698 699
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
  dependencies: []
Ben Gamari's avatar
Ben Gamari committed
700 701 702 703 704 705 706 707 708 709 710 711
  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
712 713 714
    - make show! --quiet VALUE=ProjectVersion > version
    - source version
    - echo "$ProjectVersion" > version
Ben Gamari's avatar
Ben Gamari committed
715 716 717 718 719 720 721 722 723 724 725 726 727 728 729


############################################################
# 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
730
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
Ben Gamari's avatar
Ben Gamari committed
731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754
  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