.gitlab-ci.yml 34.5 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
Ben Gamari's avatar
Ben Gamari committed
5
  DOCKER_REV: 0da9c4be73f2d73868f610d20352af856e8f2727
6

7
  # Sequential version number capturing the versions of all tools fetched by
8 9
  # .gitlab/ci.sh. Used for invalidation of GitLab CI cache.
  WINDOWS_TOOLCHAIN_VERSION: 4
10

Ben Gamari's avatar
Ben Gamari committed
11 12 13
  # Disable shallow clones; they break our linting rules
  GIT_DEPTH: 0

Ben Gamari's avatar
Ben Gamari committed
14 15 16 17
  # Overridden by individual jobs
  CONFIGURE_ARGS: ""

  GIT_SUBMODULE_STRATEGY: "recursive"
18

Ben Gamari's avatar
Ben Gamari committed
19
stages:
20 21 22 23 24 25 26 27
  - tool-lint      # Source linting of the tools
  - quick-build    # A very quick smoke-test to weed out broken commits
  - lint           # Source linting of GHC
  - build          # A quick smoke-test to weed out broken commits
  - full-build     # Build all the things
  - packaging      # Source distribution, etc.
  - testing        # head.hackage correctness and compiler performance testing
  - deploy         # push documentation
Ben Gamari's avatar
Ben Gamari committed
28

29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
# Note [The CI Story]
# ~~~~~~~~~~~~~~~~~~~
#
# There are two different types of pipelines:
#
#  - marge-bot merges to `master`. Here we perform an exhaustive validation
#    across all of the platforms which we support. In addition, we push
#    performance metric notes upstream, providing a persistent record of the
#    performance characteristics of the compiler.
#
#  - merge requests. Here we perform a slightly less exhaustive battery of
#    testing. Namely we omit some configurations (e.g. the unregisterised job).
#    These use the merge request's base commit for performance metric
#    comparisons.
#

45
workflow:
46
  # N.B. Don't run on wip/ branches, instead on run on merge requests.
47 48 49
  rules:
    - if: $CI_MERGE_REQUEST_ID
    - if: $CI_COMMIT_TAG
50
    - if: '$CI_COMMIT_BRANCH == "master"'
51
    - if: '$CI_COMMIT_BRANCH == "wip/marge_bot_batch_merge_job"'
Ben Gamari's avatar
Ben Gamari committed
52
    - if: '$CI_COMMIT_BRANCH =~ /ghc-[0-9]+\.[0-9]+/'
53
    - if: '$CI_PIPELINE_SOURCE == "web"'
54

55
.nightly: &nightly
56 57
  rules:
    - if: $NIGHTLY
58 59 60 61
  artifacts:
    when: always
    expire_in: 8 weeks

62
.release: &release
Ben Gamari's avatar
Ben Gamari committed
63 64
  variables:
    BUILD_FLAVOUR: "perf"
65 66 67
  artifacts:
    when: always
    expire_in: 1 year
68
  rules:
69
    - if: '$RELEASE_JOB == "yes"'
70

Ben Gamari's avatar
Ben Gamari committed
71
############################################################
72
# Runner Tags
Ben Gamari's avatar
Ben Gamari committed
73 74 75 76 77 78 79 80 81 82
############################################################
#
# * 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
83
############################################################
84
# tool linting
Ben Gamari's avatar
Ben Gamari committed
85 86 87
############################################################

ghc-linters:
88
  stage: tool-lint
89
  image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
Ben Gamari's avatar
Ben Gamari committed
90
  script:
Ben Gamari's avatar
Ben Gamari committed
91
    - git fetch "$CI_MERGE_REQUEST_PROJECT_URL" $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
92
    - base="$(git merge-base FETCH_HEAD $CI_COMMIT_SHA)"
93
    - "echo Linting changes between $base..$CI_COMMIT_SHA"
94 95
    #    - validate-commit-msg .git $(git rev-list $base..$CI_COMMIT_SHA)
    - validate-whitespace .git $(git rev-list $base..$CI_COMMIT_SHA)
96 97
    - .gitlab/linters/check-makefiles.py commits $base $CI_COMMIT_SHA
    - .gitlab/linters/check-cpp.py commits $base $CI_COMMIT_SHA
98
    - .gitlab/linters/check-version-number.sh
99
    - python3 utils/checkUniques/check-uniques.py .
100
  dependencies: []
Ben Gamari's avatar
Ben Gamari committed
101 102
  tags:
    - lint
103 104
  rules:
    - if: $CI_MERGE_REQUEST_ID
105

106
# Run mypy Python typechecker on linter scripts.
Ben Gamari's avatar
Ben Gamari committed
107
lint-linters:
108
  stage: tool-lint
Ben Gamari's avatar
Ben Gamari committed
109 110 111 112 113 114 115
  image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
  script:
    - mypy .gitlab/linters/*.py
  dependencies: []
  tags:
    - lint

116
# Check that .T files all parse by listing broken tests.
117
lint-testsuite:
118
  stage: tool-lint
119 120
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
  script:
Ben Gamari's avatar
Ben Gamari committed
121
    - make -Ctestsuite list_broken TEST_HC=$GHC
122 123 124 125
  dependencies: []
  tags:
    - lint

126 127
# Run mypy Python typechecker on testsuite driver
typecheck-testsuite:
128
  stage: tool-lint
129 130 131 132 133 134 135
  image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
  script:
    - mypy testsuite/driver/runtests.py
  dependencies: []
  tags:
    - lint

136
# We allow the submodule checker to fail when run on merge requests (to
Brian Wignall's avatar
Brian Wignall committed
137
# accommodate, e.g., haddock changes not yet upstream) but not on `master` or
138 139
# Marge jobs.
.lint-submods:
140
  stage: tool-lint
141 142
  image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
  script:
Ben Gamari's avatar
Ben Gamari committed
143
    - git fetch "$CI_MERGE_REQUEST_PROJECT_URL" $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
Ben Gamari's avatar
Ben Gamari committed
144
    - base="$(git merge-base FETCH_HEAD $CI_COMMIT_SHA)"
145
    - "echo Linting submodule changes between $base..$CI_COMMIT_SHA"
146
    - git submodule foreach git remote update
147
    - submodchecker . $(git rev-list $base..$CI_COMMIT_SHA)
148 149 150 151
  dependencies: []
  tags:
    - lint

152
lint-submods:
153
  extends: .lint-submods
154 155 156 157 158 159
  # Allow failure on merge requests since any necessary submodule patches may
  # not be upstreamed yet.
  rules:
    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
      allow_failure: false
    - allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
160

161 162 163
lint-submods-branch:
  extends: .lint-submods
  script:
164
    - "echo Linting submodule changes between $CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA"
165
    - git submodule foreach git remote update
Ben Gamari's avatar
Ben Gamari committed
166
    - submodchecker . $(git rev-list $CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA)
167 168 169
  rules:
    - if: '$CI_COMMIT_BRANCH == "master"'
    - if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
170

171
.lint-changelogs:
172
  stage: tool-lint
173 174 175 176 177
  image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
  dependencies: []
  tags:
    - lint
  script:
178
    - bash .gitlab/linters/check-changelogs.sh
179 180 181

lint-changelogs:
  extends: .lint-changelogs
182
  # Allow failure since this isn't a final release.
183
  allow_failure: true
184 185
  rules:
    - if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
186 187 188

lint-release-changelogs:
  extends: .lint-changelogs
189 190
  rules:
    - if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
191

Ben Gamari's avatar
Ben Gamari committed
192 193 194
############################################################
# Validation via Pipelines (hadrian)
############################################################
195

Ben Gamari's avatar
Ben Gamari committed
196
.validate-hadrian:
197
  variables:
198
    BUILD_FLAVOUR: "validate"
Ben Gamari's avatar
Ben Gamari committed
199
  script:
Ben Gamari's avatar
Ben Gamari committed
200 201 202 203
    - .gitlab/ci.sh setup
    - .gitlab/ci.sh configure
    - .gitlab/ci.sh build_hadrian
    - .gitlab/ci.sh test_hadrian
Ben Gamari's avatar
Ben Gamari committed
204 205
  cache:
    key: hadrian
206
    paths:
Ben Gamari's avatar
Ben Gamari committed
207
      - cabal-cache
208
  dependencies: []
209
  artifacts:
210 211 212
    reports:
      junit: junit.xml
    expire_in: 2 week
213
    paths:
214
      - "$BIN_DIST_NAME.tar.xz"
215
      - junit.xml
216

217
.validate-linux-hadrian:
Ben Gamari's avatar
Ben Gamari committed
218
  extends: .validate-hadrian
219
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
220 221
  variables:
    TEST_ENV: "x86_64-linux-deb9-hadrian"
222
    BIN_DIST_NAME: "ghc-x86_64-deb9-linux"
Ben Gamari's avatar
Ben Gamari committed
223 224 225
  before_script:
    # workaround for docker permissions
    - sudo chown ghc:ghc -R .
226 227 228
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
229
    - "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
230
  after_script:
231
    - cp -Rf $HOME/.cabal cabal-cache
Ben Gamari's avatar
Ben Gamari committed
232
    - .gitlab/ci.sh clean
Ben Gamari's avatar
Ben Gamari committed
233 234 235
  tags:
    - x86_64-linux

236 237 238 239 240 241 242 243 244 245 246
# Verify that Hadrian builds with stack. Note that we don't actually perform a
# build of GHC itself; we merely test that the Hadrian executable builds and
# works (by invoking `hadrian --version`).
stack-hadrian-build:
  extends: .validate-linux-hadrian
  stage: build
  script:
    - .gitlab/ci.sh setup
    - .gitlab/ci.sh configure
    - hadrian/build-stack --version

247 248
validate-x86_64-linux-deb9-hadrian:
  extends: .validate-linux-hadrian
249
  needs: [hadrian-ghc-in-ghci]
250 251
  stage: build

252
validate-x86_64-linux-deb9-unreg-hadrian:
253
  extends: .validate-linux-hadrian
254
  needs: [validate-x86_64-linux-deb9-hadrian]
255 256 257
  stage: full-build
  variables:
    CONFIGURE_ARGS: --enable-unregisterised
258
    TEST_ENV: "x86_64-linux-deb9-unreg-hadrian"
259

260
.build-x86_64-linux-deb10-hadrian-cross-aarch64:
261 262 263 264 265 266 267
  extends: .validate-linux-hadrian
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV"
  variables:
    BIN_DIST_NAME: "ghc-x86_64-deb9-linux"
    CONFIGURE_ARGS: --with-intree-gmp
    CROSS_TARGET: "aarch64-linux-gnu"

268 269 270 271 272 273
validate-x86_64-linux-deb10-hadrian-cross-aarch64:
  extends: .build-x86_64-linux-deb10-hadrian-cross-aarch64
  stage: full-build
  rules:
    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*cross-compilation.*/'

274 275
nightly-x86_64-linux-deb10-hadrian-cross-aarch64:
  <<: *nightly
276
  extends: .build-x86_64-linux-deb10-hadrian-cross-aarch64
277 278 279 280 281 282 283
  stage: full-build


############################################################
# GHC-in-GHCi (Hadrian)
############################################################

284
hadrian-ghc-in-ghci:
285
  stage: quick-build
286
  needs: [lint-linters, lint-submods]
287
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
288 289 290 291 292 293
  before_script:
    # workaround for docker permissions
    - sudo chown ghc:ghc -R .
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
294 295
  variables:
    GHC_FLAGS: -Werror
296 297 298
  tags:
    - x86_64-linux
  script:
299
    - git clean -xdf && git submodule foreach git clean -xdf
300
    - .gitlab/ci.sh setup
301
    - .gitlab/ci.sh configure
302
    - cabal update
303
    - cd hadrian; cabal new-build -j`../mk/detect-cpu-count.sh` --with-compiler=$GHC --project-file=ci.project; cd ..
304
    # Load ghc-in-ghci then immediately exit and check the modules loaded
305
    - echo ":q" | hadrian/ghci -j`mk/detect-cpu-count.sh`| tail -n2 | grep "Ok,"
306 307
  after_script:
    - cp -Rf $HOME/.cabal cabal-cache
308 309 310 311 312
  cache:
    key: hadrian-ghci
    paths:
      - cabal-cache

313 314 315 316 317 318
############################################################
# GHC source code linting
############################################################

.lint-params:
  stage: lint
319
  needs: [lint-submods]
320 321 322 323 324 325 326 327 328 329 330 331 332
  tags:
    - lint
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
  before_script:
    - export PATH="/opt/toolchain/bin:$PATH"
    # workaround for docker permissions
    - sudo chown ghc:ghc -R .
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
    - .gitlab/ci.sh setup
    - cabal update
    - cd hadrian; cabal new-build -j`../mk/detect-cpu-count.sh` --with-compiler=$GHC --project-file=ci.project; cd ..
333 334
  after_script:
    - cp -Rf $HOME/.cabal cabal-cache
335 336
  variables:
    GHC_FLAGS: -Werror
337 338 339 340
  cache:
    key: lint
    paths:
      - cabal-cache
341 342 343

lint-base:
  extends: .lint-params
344 345
  variables:
    BUILD_FLAVOUR: default
346
  script:
347 348 349 350
    - .gitlab/ci.sh setup
    - .gitlab/ci.sh configure
    - .gitlab/ci.sh run_hadrian stage1:lib:base
    - .gitlab/ci.sh run_hadrian lint:base
351

Ben Gamari's avatar
Ben Gamari committed
352 353 354 355 356
############################################################
# Validation via Pipelines (make)
############################################################

.validate:
357 358
  variables:
    TEST_TYPE: test
Ben Gamari's avatar
Ben Gamari committed
359
    MAKE_ARGS: "-Werror"
Ben Gamari's avatar
Ben Gamari committed
360
  script:
Ben Gamari's avatar
Ben Gamari committed
361 362 363 364
    - .gitlab/ci.sh setup
    - .gitlab/ci.sh configure
    - .gitlab/ci.sh build_make
    - .gitlab/ci.sh test_make
365
  dependencies: []
366 367 368
  artifacts:
    reports:
      junit: junit.xml
369
    expire_in: 2 week
370
    paths:
371
      - $BIN_DIST_PREP_TAR_COMP
372
      - junit.xml
373
      - performance-metrics.tsv
374

Ben Gamari's avatar
Ben Gamari committed
375 376 377 378 379
#################################
# x86_64-freebsd
#################################

.build-x86_64-freebsd:
380
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
381
  extends: .validate
382
  needs: [validate-x86_64-linux-deb9-hadrian]
Ben Gamari's avatar
Ben Gamari committed
383 384 385 386 387 388 389 390 391
  tags:
    - x86_64-freebsd
  allow_failure: true
  variables:
    # N.B. we use iconv from ports as I see linker errors when we attempt
    # to use the "native" iconv embedded in libc as suggested by the
    # porting guide [1].
    # [1] https://www.freebsd.org/doc/en/books/porters-handbook/using-iconv.html)
    CONFIGURE_ARGS: "--with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib"
392 393
    GHC_VERSION: "8.10.1"
    CABAL_INSTALL_VERSION: "3.2.0.0"
Ben Gamari's avatar
Ben Gamari committed
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
    BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-portbld-freebsd.tar.xz"
    TEST_ENV: "x86_64-freebsd"
    BUILD_FLAVOUR: "validate"
  after_script:
    - cp -Rf $HOME/.cabal cabal-cache
    - .gitlab/ci.sh clean
  artifacts:
    when: always
    expire_in: 2 week
  cache:
    key: "freebsd-$GHC_VERSION"
    paths:
      - cabal-cache
      - toolchain

409 410
# Conditional due to lack of builder capacity
validate-x86_64-freebsd:
Ben Gamari's avatar
Ben Gamari committed
411
  extends: .build-x86_64-freebsd
412 413
  rules:
    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*FreeBSD.*/'
Ben Gamari's avatar
Ben Gamari committed
414 415 416 417 418

nightly-x86_64-freebsd:
  <<: *nightly
  extends: .build-x86_64-freebsd

419 420 421 422
release-x86_64-freebsd:
  <<: *release
  extends: .build-x86_64-freebsd

Ben Gamari's avatar
Ben Gamari committed
423 424 425 426 427 428 429 430 431 432
.build-x86_64-freebsd-hadrian:
  extends: .validate-hadrian
  tags:
    - x86_64-freebsd
  allow_failure: true
  variables:
    CONFIGURE_ARGS: "--with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib"
    HADRIAN_ARGS: "--docs=no-sphinx"
    GHC_VERSION: 8.6.3
    CABAL_INSTALL_VERSION: 3.0.0.0
433
    BIN_DIST_NAME: "ghc-x86_64-portbld-freebsd"
Ben Gamari's avatar
Ben Gamari committed
434
    TEST_ENV: "x86_64-freebsd-hadrian"
435
    BUILD_FLAVOUR: "validate"
Ben Gamari's avatar
Ben Gamari committed
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
  after_script:
    - cp -Rf $HOME/.cabal cabal-cache
    - .gitlab/ci.sh clean
  artifacts:
    when: always
    expire_in: 2 week
  cache:
    key: "freebsd-$GHC_VERSION"
    paths:
      - cabal-cache
      - toolchain

# Disabled due to lack of builder capacity
.validate-x86_64-freebsd-hadrian:
  extends: .build-x86_64-freebsd-hadrian

452 453 454 455
#################################
# x86_64-darwin
#################################

Ben Gamari's avatar
Ben Gamari committed
456
validate-x86_64-darwin:
Ben Gamari's avatar
Ben Gamari committed
457
  extends: .validate
458
  needs: [validate-x86_64-linux-deb9-hadrian]
459
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
460 461 462
  tags:
    - x86_64-darwin
  variables:
463
    GHC_VERSION: 8.8.4
Ben Gamari's avatar
Ben Gamari committed
464
    CABAL_INSTALL_VERSION: 3.0.0.0
465
    BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-apple-darwin.tar.xz"
Ben Gamari's avatar
Ben Gamari committed
466 467 468
    MACOSX_DEPLOYMENT_TARGET: "10.7"
    # Only Sierra and onwards supports clock_gettime. See #12858
    ac_cv_func_clock_gettime: "no"
469
    LANG: "en_US.UTF-8"
Ben Gamari's avatar
Ben Gamari committed
470
    CONFIGURE_ARGS: "--with-intree-gmp"
471
    TEST_ENV: "x86_64-darwin"
Ben Gamari's avatar
Ben Gamari committed
472
    BUILD_FLAVOUR: "perf"
Ben Gamari's avatar
Ben Gamari committed
473 474
  after_script:
    - cp -Rf $HOME/.cabal cabal-cache
Ben Gamari's avatar
Ben Gamari committed
475
    - .gitlab/ci.sh clean
476 477
  artifacts:
    when: always
478
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
479
  cache:
480
    key: "darwin-$GHC_VERSION"
Ben Gamari's avatar
Ben Gamari committed
481 482 483 484
    paths:
      - cabal-cache
      - toolchain

485 486
# Disabled because of OS X CI capacity
.validate-x86_64-darwin-hadrian:
487
  stage: full-build
488
  needs: [validate-x86_64-linux-deb9-hadrian]
489 490 491
  tags:
    - x86_64-darwin
  variables:
492
    GHC_VERSION: 8.8.4
493 494 495 496
    MACOSX_DEPLOYMENT_TARGET: "10.7"
    ac_cv_func_clock_gettime: "no"
    LANG: "en_US.UTF-8"
    CONFIGURE_ARGS: --with-intree-gmp
497
    TEST_ENV: "x86_64-darwin-hadrian"
498
    BIN_DIST_NAME: "ghc-x86_64-apple-darwin"
499
    BUILD_FLAVOUR: "validate"
500
  script:
Ben Gamari's avatar
Ben Gamari committed
501 502 503 504
    - .gitlab/ci.sh setup
    - .gitlab/ci.sh configure
    - .gitlab/ci.sh build_hadrian
    - .gitlab/ci.sh test_hadrian
505 506
  after_script:
    - cp -Rf $HOME/.cabal cabal-cache
Ben Gamari's avatar
Ben Gamari committed
507
    - .gitlab/ci.sh clean
508 509 510 511 512 513
  artifacts:
    when: always
    expire_in: 2 week
    reports:
      junit: junit.xml
    paths:
514
      - "$BIN_DIST_NAME.tar.xz"
515 516
      - junit.xml

Ben Gamari's avatar
Ben Gamari committed
517
.validate-linux:
Ben Gamari's avatar
Ben Gamari committed
518
  extends: .validate
519
  needs: [validate-x86_64-linux-deb9-hadrian]
Ben Gamari's avatar
Ben Gamari committed
520 521
  tags:
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
522 523
  variables:
    BUILD_FLAVOUR: "perf"
Ben Gamari's avatar
Ben Gamari committed
524
  before_script:
525 526 527
      # Build hyperlinked sources for documentation when building releases
    - |
      if [[ -n "$CI_COMMIT_TAG" ]]; then
Ben Gamari's avatar
Ben Gamari committed
528
        HADDOCK_HYPERLINKED_SOURCES=1
529
      fi
530

Ben Gamari's avatar
Ben Gamari committed
531 532 533 534 535
    # 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
536
    key: linux
Ben Gamari's avatar
Ben Gamari committed
537 538 539 540
    paths:
      - cabal-cache
      - toolchain

541
#################################
Ben Gamari's avatar
Ben Gamari committed
542
# aarch64-linux-deb10
543 544
#################################

Ben Gamari's avatar
Ben Gamari committed
545
.build-aarch64-linux-deb10:
Ben Gamari's avatar
Ben Gamari committed
546
  extends: .validate-linux
547
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
548
  image: "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb10:$DOCKER_REV"
Ben Gamari's avatar
Ben Gamari committed
549
  allow_failure: true
550
  variables:
Ben Gamari's avatar
Ben Gamari committed
551 552
    TEST_ENV: "aarch64-linux-deb10"
    BIN_DIST_PREP_TAR_COMP: "ghc-aarch64-linux-deb10.tar.xz"
Ben Gamari's avatar
Ben Gamari committed
553
  cache:
Ben Gamari's avatar
Ben Gamari committed
554
    key: linux-aarch64-deb10
Ben Gamari's avatar
Ben Gamari committed
555 556 557
  tags:
    - aarch64-linux

Moritz Angermann's avatar
Moritz Angermann committed
558 559 560 561 562 563 564 565
.build-aarch64-linux-deb10-llvm:
  extends: .build-aarch64-linux-deb10
  stage: full-build
  variables:
    BUILD_FLAVOUR: perf-llvm
  tags:
    - aarch64-linux

Ben Gamari's avatar
Ben Gamari committed
566 567
validate-aarch64-linux-deb10:
  extends: .build-aarch64-linux-deb10
568 569 570 571
  artifacts:
    when: always
    expire_in: 2 week

Ben Gamari's avatar
Ben Gamari committed
572
nightly-aarch64-linux-deb10:
573
  <<: *nightly
Ben Gamari's avatar
Ben Gamari committed
574
  extends: .build-aarch64-linux-deb10
575 576 577
  variables:
    TEST_TYPE: slowtest

578
#################################
Ben Gamari's avatar
Ben Gamari committed
579
# armv7-linux-deb10
580 581
#################################

Ben Gamari's avatar
Ben Gamari committed
582
.build-armv7-linux-deb10:
583 584
  extends: .validate-linux
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
585
  image: "registry.gitlab.haskell.org/ghc/ci-images/armv7-linux-deb10:$DOCKER_REV"
586 587
  # Due to linker issues
  allow_failure: true
588
  variables:
Ben Gamari's avatar
Ben Gamari committed
589 590
    TEST_ENV: "armv7-linux-deb10"
    BIN_DIST_PREP_TAR_COMP: "ghc-armv7-linux-deb10.tar.xz"
591
    CONFIGURE_ARGS: "--host=armv7-linux-gnueabihf --build=armv7-linux-gnueabihf --target=armv7-linux-gnueabihf"
592 593
    # N.B. We disable ld.lld explicitly here because it appears to fail
    # non-deterministically on ARMv7. See #18280.
594 595
    LD: "ld.gold"
    GccUseLdOpt: "-fuse-ld=gold"
596
  cache:
Ben Gamari's avatar
Ben Gamari committed
597
    key: linux-armv7-deb10
598 599 600
  tags:
    - armv7-linux

Ben Gamari's avatar
Ben Gamari committed
601 602
validate-armv7-linux-deb10:
  extends: .build-armv7-linux-deb10
603 604 605 606
  artifacts:
    when: always
    expire_in: 2 week

Ben Gamari's avatar
Ben Gamari committed
607
nightly-armv7-linux-deb10:
608
  <<: *nightly
Ben Gamari's avatar
Ben Gamari committed
609
  extends: .build-armv7-linux-deb10
610 611 612
  variables:
    TEST_TYPE: slowtest

613 614 615 616 617
#################################
# i386-linux-deb9
#################################

.build-i386-linux-deb9:
618 619
  extends: .validate-linux
  stage: full-build
620
  image: "registry.gitlab.haskell.org/ghc/ci-images/i386-linux-deb9:$DOCKER_REV"
621 622
  variables:
    TEST_ENV: "i386-linux-deb9"
623
    BIN_DIST_PREP_TAR_COMP: "ghc-i386-deb9-linux.tar.xz"
624 625 626 627 628
  cache:
    key: linux-i386-deb9

validate-i386-linux-deb9:
  extends: .build-i386-linux-deb9
629 630 631
  artifacts:
    when: always
    expire_in: 2 week
632 633

nightly-i386-linux-deb9:
634
  <<: *nightly
635
  extends: .build-i386-linux-deb9
636 637 638
  variables:
    TEST_TYPE: slowtest

639 640 641
#################################
# x86_64-linux-deb9
#################################
Ben Gamari's avatar
Ben Gamari committed
642

643
.build-x86_64-linux-deb9:
Ben Gamari's avatar
Ben Gamari committed
644
  extends: .validate-linux
645
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
646 647
  variables:
    TEST_ENV: "x86_64-linux-deb9"
648
    BIN_DIST_PREP_TAR_COMP: "./ghc-x86_64-deb9-linux.tar.xz"
Ben Gamari's avatar
Ben Gamari committed
649 650 651
  cache:
    key: linux-x86_64-deb9

652 653
# Disabled to reduce CI load
.validate-x86_64-linux-deb9:
654
  extends: .build-x86_64-linux-deb9
655
  stage: full-build
656 657 658 659
  artifacts:
    when: always
    expire_in: 2 week

660 661 662 663 664
release-x86_64-linux-deb9:
  <<: *release
  extends: .build-x86_64-linux-deb9
  stage: full-build

665
nightly-x86_64-linux-deb9:
666
  <<: *nightly
667
  extends: .build-x86_64-linux-deb9
668
  stage: full-build
669 670 671
  variables:
    TEST_TYPE: slowtest

672 673 674
# N.B. Has DEBUG assertions enabled in stage2
validate-x86_64-linux-deb9-debug:
  extends: .build-x86_64-linux-deb9
675
  stage: full-build
676 677
  variables:
    BUILD_FLAVOUR: validate
678 679
    # Ensure that stage2 also has DEBUG enabled
    ValidateSpeed: SLOW
Ben Gamari's avatar
Ben Gamari committed
680 681
    # Override validate flavour default; see #16890.
    BUILD_SPHINX_PDF: "YES"
682
    TEST_TYPE: slowtest
683
    TEST_ENV: "x86_64-linux-deb9-debug"
684
    BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-deb9-linux-debug.tar.xz"
685 686 687
  artifacts:
    when: always
    expire_in: 2 week
688 689 690 691 692

validate-x86_64-linux-deb9-integer-simple:
  extends: .build-x86_64-linux-deb9
  stage: full-build
  variables:
693
    BUILD_FLAVOUR: validate
694
    BIGNUM_BACKEND: native
695
    TEST_ENV: "x86_64-linux-deb9-integer-simple-validate"
696
    BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-deb9-linux-integer-simple.tar.xz"
697 698

nightly-x86_64-linux-deb9-integer-simple:
699
  <<: *nightly
700 701 702
  extends: .build-x86_64-linux-deb9
  stage: full-build
  variables:
703
    BIGNUM_BACKEND: native
704 705 706
    TEST_ENV: "x86_64-linux-deb9-integer-simple"
    TEST_TYPE: slowtest

707 708 709 710 711
.build-x86_64-linux-deb9-tsan:
  extends: .validate-linux-hadrian
  stage: full-build
  variables:
    TEST_ENV: "x86_64-linux-deb9-tsan"
712
    BUILD_FLAVOUR: "default+thread_sanitizer"
713
    TSAN_OPTIONS: "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions"
714 715 716
    # Haddock is large enough to make TSAN choke without massive quantities of
    # memory.
    HADRIAN_ARGS: "--docs=none"
717 718 719 720 721 722 723 724 725

nightly-x86_64-linux-deb9-tsan:
  <<: *nightly
  extends: .build-x86_64-linux-deb9-tsan

validate-x86_64-linux-deb9-tsan:
  extends: .build-x86_64-linux-deb9-tsan
  when: manual

726 727
validate-x86_64-linux-deb9-dwarf:
  extends: .build-x86_64-linux-deb9
728
  stage: full-build
729 730 731
  variables:
    CONFIGURE_ARGS: "--enable-dwarf-unwind"
    BUILD_FLAVOUR: dwarf
732
    TEST_ENV: "x86_64-linux-deb9-dwarf"
733
    BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-deb9-linux-dwarf.tar.xz"
734

Ben Gamari's avatar
Ben Gamari committed
735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754
#################################
# x86_64-linux-deb10
#################################

.build-x86_64-linux-deb10:
  extends: .validate-linux
  stage: full-build
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV"
  variables:
    TEST_ENV: "x86_64-linux-deb10"
    BIN_DIST_PREP_TAR_COMP: "./ghc-x86_64-deb10-linux.tar.xz"
  cache:
    key: linux-x86_64-deb10

# Disabled to alleviate CI load
.validate-x86_64-linux-deb10:
  extends: .build-x86_64-linux-deb10
  stage: full-build

nightly-x86_64-linux-deb10:
755
  <<: *nightly
Ben Gamari's avatar
Ben Gamari committed
756 757 758 759 760 761 762 763
  extends: .build-x86_64-linux-deb10
  variables:
    TEST_TYPE: slowtest

release-x86_64-linux-deb10:
  <<: *release
  extends: .build-x86_64-linux-deb10

764 765 766 767 768 769 770 771 772
release-x86_64-linux-deb10-dwarf:
  <<: *release
  extends: .build-x86_64-linux-deb10
  variables:
    CONFIGURE_ARGS: "--enable-dwarf-unwind"
    BUILD_FLAVOUR: dwarf
    TEST_ENV: "x86_64-linux-deb10-dwarf"
    BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-deb10-linux-dwarf.tar.xz"

773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789
validate-x86_64-linux-deb10-llvm:
  extends: .build-x86_64-linux-deb10
  stage: full-build
  rules:
    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/'
  variables:
    BUILD_FLAVOUR: perf-llvm
    TEST_ENV: "x86_64-linux-deb10-llvm"

nightly-x86_64-linux-deb10-llvm:
  <<: *nightly
  extends: .build-x86_64-linux-deb10
  stage: full-build
  variables:
    BUILD_FLAVOUR: perf-llvm
    TEST_ENV: "x86_64-linux-deb10-llvm"

790 791 792 793 794 795 796
#################################
# x86_64-linux-ubuntu 20.04
#################################

.build-x86_64-linux-ubuntu2004:
  extends: .validate-linux
  stage: full-build
797
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-ubuntu20_04:$DOCKER_REV"
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818
  variables:
    TEST_ENV: "x86_64-linux-ubuntu2004"
    BIN_DIST_PREP_TAR_COMP: "./ghc-x86_64-ubuntu2004-linux.tar.xz"
  cache:
    key: linux-x86_64-ubuntu2004

# Disabled to alleviate CI load
.validate-x86_64-linux-ubuntu2004:
  extends: .build-x86_64-linux-ubuntu2004
  stage: full-build

nightly-x86_64-linux-ubuntu2004:
  <<: *nightly
  extends: .build-x86_64-linux-ubuntu2004
  variables:
    TEST_TYPE: slowtest

release-x86_64-linux-ubuntu2004:
  <<: *release
  extends: .build-x86_64-linux-ubuntu2004

819 820 821
#################################
# x86_64-linux-deb8
#################################
Ben Gamari's avatar
Ben Gamari committed
822

823
.build-x86_64-linux-deb8:
Ben Gamari's avatar
Ben Gamari committed
824
  extends: .validate-linux
825
  stage: full-build
826
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb8:$DOCKER_REV"
827
  # Due to #18298.
828
  allow_failure: true
829 830
  variables:
    TEST_ENV: "x86_64-linux-deb8"
831
    BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-deb8-linux.tar.xz"
832 833 834 835 836 837
    # Debian 8's Sphinx is too old to support the table directive's :widths:
    # option: https://sourceforge.net/p/docutils/patches/120/
    BUILD_SPHINX_HTML: "NO"
    BUILD_SPHINX_INFO: "NO"
    BUILD_SPHINX_PDF: "NO"
    BUILD_SPHINX_MAN: "NO"
Ben Gamari's avatar
Ben Gamari committed
838 839
  cache:
    key: linux-x86_64-deb8
840 841 842 843

release-x86_64-linux-deb8:
  <<: *release
  extends: .build-x86_64-linux-deb8
Ben Gamari's avatar
Ben Gamari committed
844

845 846 847 848
#################################
# x86_64-linux-alpine
#################################

849 850
.build-x86_64-linux-alpine-hadrian:
  extends: .validate-linux-hadrian
851
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
852
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine3_12:$DOCKER_REV"
853 854 855 856
  # There are currently a few failing tests
  allow_failure: true
  variables:
    TEST_ENV: "x86_64-linux-alpine"
857
    BIN_DIST_NAME: "ghc-x86_64-alpine-linux"
858 859
    # Can't use ld.gold due to #13958.
    CONFIGURE_ARGS: "--disable-ld-override"
860
    HADRIAN_ARGS: "--docs=no-sphinx"
861 862 863
    # encoding004 due to lack of locale support
    # T10458 due to fact that dynamic linker tries to reload libAS
    BROKEN_TESTS: "encoding004 T10458"
864 865 866 867 868 869
  cache:
    key: linux-x86_64-alpine
  artifacts:
    when: always
    expire_in: 2 week

870
release-x86_64-linux-alpine:
871
  <<: *release
872
  extends: .build-x86_64-linux-alpine-hadrian
873 874

nightly-x86_64-linux-alpine:
875
  <<: *nightly
876
  extends: .build-x86_64-linux-alpine-hadrian
877

878 879 880 881
#################################
# x86_64-linux-centos7
#################################

882
.build-x86_64-linux-centos7:
883 884 885 886 887 888 889 890
  extends: .validate-linux
  stage: full-build
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-centos7:$DOCKER_REV"
  variables:
    # 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"
891
    BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-centos7-linux.tar.xz"
Ben Gamari's avatar
Ben Gamari committed
892 893
    # CentOS seems to default to ascii
    LANG: "en_US.UTF-8"
894 895
  cache:
    key: linux-x86_64-centos7
896 897 898 899

release-x86_64-linux-centos7:
  <<: *release
  extends: .build-x86_64-linux-centos7
900 901 902 903 904

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

905
.build-x86_64-linux-fedora27:
Ben Gamari's avatar
Ben Gamari committed
906
  extends: .validate-linux
907
  stage: full-build
908
  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora27:$DOCKER_REV"
909
  variables:
Ben Gamari's avatar
Ben Gamari committed
910 911 912
    # LLVM 10 is not available for Fedora27
    LLC: /bin/false
    OPT: /bin/false
913
    TEST_ENV: "x86_64-linux-fedora27"
Ben Gamari's avatar
Ben Gamari committed
914 915
  cache:
    key: linux-x86_64-fedora27
916 917
  artifacts:
    when: always
918 919 920
    # These are used for head.hackage jobs therefore we keep them around for
    # longer.
    expire_in: 8 week
Ben Gamari's avatar
Ben Gamari committed
921

922 923 924 925 926 927 928 929 930 931 932 933 934 935
validate-x86_64-linux-fedora27:
  extends: .build-x86_64-linux-fedora27
  variables:
    BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-fedora27-linux.tar.xz"

release-x86_64-linux-fedora27-dwarf:
  <<: *release
  extends: .build-x86_64-linux-fedora27
  variables:
    CONFIGURE_ARGS: "--enable-dwarf-unwind"
    BUILD_FLAVOUR: dwarf
    BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-fedora27-linux-dwarf.tar.xz"
    TEST_ENV: "x86_64-linux-fedora27-dwarf"

Ben Gamari's avatar
Ben Gamari committed
936
############################################################
937
# Validation via Pipelines (Windows)
Ben Gamari's avatar
Ben Gamari committed
938 939
############################################################

940
.build-windows:
941
  needs: [validate-x86_64-linux-deb9-hadrian]
Ben Gamari's avatar
Ben Gamari committed
942
  before_script:
943
    - git clean -xdf
944

Ben Gamari's avatar
Ben Gamari committed
945 946
    # Setup toolchain
    - bash .gitlab/ci.sh setup
947
  after_script:
Ben Gamari's avatar
Ben Gamari committed
948 949 950
    - |
      Copy-Item -Recurse -Path $Env:APPDATA\cabal -Destination cabal-cache
    - bash .gitlab/ci.sh clean
951
  dependencies: []
Tamar Christina's avatar
Tamar Christina committed
952
  variables:
953
    #FORCE_SYMLINKS: 1
954
    LANG: "en_US.UTF-8"
955
    SPHINXBUILD: "/mingw64/bin/sphinx-build.exe"
956 957
    CABAL_INSTALL_VERSION: "3.0.0.0"
    GHC_VERSION: "8.8.4"
Ben Gamari's avatar
Ben Gamari committed
958 959 960
  cache:
    paths:
      - cabal-cache
Ben Gamari's avatar
Ben Gamari committed
961
      - toolchain
Ben Gamari's avatar
Ben Gamari committed
962 963
      - ghc-tarballs

964 965
.build-windows-hadrian:
  extends: .build-windows
966
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
967
  variables:
968
    BUILD_FLAVOUR: "validate"
Ben Gamari's avatar
Ben Gamari committed
969 970 971 972
    # skipping perf tests for now since we build a quick-flavoured GHC,
    # which might result in some broken perf tests?
    HADRIAN_ARGS: "--docs=no-sphinx --skip-perf"

Ben Gamari's avatar
Ben Gamari committed
973
  script:
Ben Gamari's avatar
Ben Gamari committed
974 975 976
    - bash .gitlab/ci.sh configure
    - bash .gitlab/ci.sh build_hadrian
    - bash .gitlab/ci.sh test_hadrian
Ben Gamari's avatar
Ben Gamari committed
977
  tags:
Ben Gamari's avatar
Ben Gamari committed
978 979
    - new-x86_64-windows
    - test
980
  artifacts:
981 982 983
    reports:
      junit: junit.xml
    expire_in: 2 week
984 985
    when: always
    paths:
986
      - "$BIN_DIST_NAME.tar.xz"
987
      - junit.xml
Ben Gamari's avatar
Ben Gamari committed
988

989
.build-x86_64-windows-hadrian:
990 991 992
  extends: .build-windows-hadrian
  variables:
    MSYSTEM: MINGW64
993
    TEST_ENV: "x86_64-windows"
994
    BIN_DIST_NAME: "ghc-x86_64-unknown-mingw32"
995
  cache:
996 997 998 999
    key: "x86_64-windows-$WINDOWS_TOOLCHAIN_VERSION"

validate-x86_64-windows-hadrian:
  extends: .build-x86_64-windows-hadrian
1000 1001