.gitlab-ci.yml 10.4 KB
Newer Older
1 2
variables:
  GIT_SSL_NO_VERIFY: "1"
3 4 5 6 7 8

before_script:
  - python3 .gitlab/fix-submodules.py
  - git submodule sync --recursive
  - git submodule update --init --recursive
  - git checkout .gitmodules
9

Ben Gamari's avatar
Ben Gamari committed
10 11 12
stages:
  - lint
  - build
13
  - full-build
14
  - cleanup # See Note [Cleanup on Windows]
Ben Gamari's avatar
Ben Gamari committed
15

Ben Gamari's avatar
Ben Gamari committed
16
############################################################
17
# Runner Tags
Ben Gamari's avatar
Ben Gamari committed
18 19 20 21 22 23 24 25 26 27
############################################################
#
# * 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
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
############################################################
# Linting
############################################################

ghc-linters:
  stage: lint
  image: ghcci/linters:0.1
  script:
    - |
      if [ -n "$CI_MERGE_REQUEST_ID" ]; then
        base="$(git merge-base $CI_MERGE_REQUEST_BRANCH_NAME HEAD)"
        validate-commit-msg .git $(git rev-list $base..$CI_COMMIT_SHA)
        submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA)
        validate-whitespace .git $(git rev-list $base..$CI_COMMIT_SHA)
        .gitlab/linters/check-makefiles.py $base $CI_COMMIT_SHA
        .gitlab/linters/check-cpp.py $base $CI_COMMIT_SHA
      fi
45
  dependencies: []
Ben Gamari's avatar
Ben Gamari committed
46 47
  tags:
    - lint
Ben Gamari's avatar
Ben Gamari committed
48

Ben Gamari's avatar
Ben Gamari committed
49 50 51
############################################################
# Validation via Pipelines (hadrian)
############################################################
52

Ben Gamari's avatar
Ben Gamari committed
53
.validate-hadrian:
Ben Gamari's avatar
Ben Gamari committed
54
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
55
  script:
56
    - git clean -xdf && git submodule foreach git clean -xdf
Ben Gamari's avatar
Ben Gamari committed
57 58 59
    - 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
60
    - ./configure $CONFIGURE_ARGS
Ben Gamari's avatar
Ben Gamari committed
61 62 63
    - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh`
  cache:
    key: hadrian
64
    paths:
Ben Gamari's avatar
Ben Gamari committed
65
      - cabal-cache
66

Ben Gamari's avatar
Ben Gamari committed
67
validate-x86_64-linux-deb8-hadrian:
Ben Gamari's avatar
Ben Gamari committed
68
  extends: .validate-hadrian
69
  stage: build
Ben Gamari's avatar
Ben Gamari committed
70
  image: ghcci/x86_64-linux-deb8:0.1
Ben Gamari's avatar
Ben Gamari committed
71 72 73
  before_script:
    # workaround for docker permissions
    - sudo chown ghc:ghc -R .
74 75 76 77
    - python3 .gitlab/fix-submodules.py
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
Ben Gamari's avatar
Ben Gamari committed
78 79 80 81 82 83 84 85
  tags:
    - x86_64-linux

############################################################
# Validation via Pipelines (make)
############################################################

.validate:
86 87
  variables:
    TEST_TYPE: test
Ben Gamari's avatar
Ben Gamari committed
88
  before_script:
89
    - git clean -xdf && git submodule foreach git clean -xdf
Ben Gamari's avatar
Ben Gamari committed
90
  script:
Ben Gamari's avatar
Ben Gamari committed
91
    - ./boot
Ben Gamari's avatar
Ben Gamari committed
92
    - ./configure $CONFIGURE_ARGS
Ben Gamari's avatar
Ben Gamari committed
93 94
    - |
      THREADS=`mk/detect-cpu-count.sh`
95
      make V=0 -j$THREADS
Ben Gamari's avatar
Ben Gamari committed
96 97 98 99 100
    - |
      make binary-dist TAR_COMP_OPTS="-1"
      mv ghc-*.tar.xz ghc.tar.xz
    - |
      THREADS=`mk/detect-cpu-count.sh`
101
      make $TEST_TYPE THREADS=$THREADS JUNIT_FILE=../../junit.xml
102
  dependencies: []
103 104 105
  artifacts:
    reports:
      junit: junit.xml
106
    expire_in: 2 week
107 108 109 110
    paths:
      - ghc.tar.xz
      - junit.xml

111
validate-x86_64-darwin:
Ben Gamari's avatar
Ben Gamari committed
112
  extends: .validate
113
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
114 115 116
  tags:
    - x86_64-darwin
  variables:
117
    GHC_VERSION: 8.6.3
Ben Gamari's avatar
Ben Gamari committed
118 119 120
    MACOSX_DEPLOYMENT_TARGET: "10.7"
    # Only Sierra and onwards supports clock_gettime. See #12858
    ac_cv_func_clock_gettime: "no"
121
    LANG: "en_US.UTF-8"
122
    CONFIGURE_ARGS: --with-intree-gmp
Ben Gamari's avatar
Ben Gamari committed
123
  before_script:
Ben Gamari's avatar
Ben Gamari committed
124
    - git clean -xdf && git submodule foreach git clean -xdf
125
    - python3 .gitlab/fix-submodules.py
126 127 128 129
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules

Ben Gamari's avatar
Ben Gamari committed
130 131 132 133
    - bash .gitlab/darwin-init.sh
    - PATH="`pwd`/toolchain/bin:$PATH"
  after_script:
    - cp -Rf $HOME/.cabal cabal-cache
134 135
  artifacts:
    when: always
136
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
137 138 139 140 141 142
  cache:
    key: darwin
    paths:
      - cabal-cache
      - toolchain

Ben Gamari's avatar
Ben Gamari committed
143
.validate-linux:
Ben Gamari's avatar
Ben Gamari committed
144 145 146 147
  extends: .validate
  tags:
    - x86_64-linux
  before_script:
Ben Gamari's avatar
Ben Gamari committed
148
    - git clean -xdf && git submodule foreach git clean -xdf
149 150 151 152 153
    - python3 .gitlab/fix-submodules.py
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules

Ben Gamari's avatar
Ben Gamari committed
154 155 156 157 158 159
    - 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
160
    key: linux
Ben Gamari's avatar
Ben Gamari committed
161 162 163 164
    paths:
      - cabal-cache
      - toolchain

165 166
validate-aarch64-linux-deb9:
  extends: .validate-linux
167
  stage: full-build
168 169 170 171
  image: ghcci/aarch64-linux-deb9:0.1
  allow_failure: true
  artifacts:
    when: always
172
    expire_in: 2 week
173 174 175 176 177
  cache:
    key: linux-aarch64-deb9
  tags:
    - aarch64-linux

178 179
nightly-aarch64-linux-deb9:
  extends: validate-aarch64-linux-deb9
180
  stage: full-build
181 182 183 184 185 186 187 188
  artifacts:
    expire_in: 2 year
  variables:
    TEST_TYPE: slowtest
  only:
    variables:
      - $NIGHTLY

189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
validate-i386-linux-deb9:
  extends: .validate-linux
  stage: full-build
  image: ghcci/i386-linux-deb9:0.1
  allow_failure: true
  artifacts:
    when: always
    expire_in: 2 week
  cache:
    key: linux-i386-deb9

nightly-i386-linux-deb9:
  extends: .validate-linux
  stage: full-build
  image: ghcci/i386-linux-deb9:0.1
  allow_failure: true
  variables:
    TEST_TYPE: slowtest
  artifacts:
    when: always
    expire_in: 2 week
210 211 212
  only:
    variables:
      - $NIGHTLY
213 214 215
  cache:
    key: linux-i386-deb9

Ben Gamari's avatar
Ben Gamari committed
216 217
validate-x86_64-linux-deb9:
  extends: .validate-linux
218
  stage: build
Ben Gamari's avatar
Ben Gamari committed
219 220 221
  image: ghcci/x86_64-linux-deb9:0.2
  artifacts:
    when: always
222
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
223 224 225
  cache:
    key: linux-x86_64-deb9

226 227
nightly-x86_64-linux-deb9:
  extends: validate-x86_64-linux-deb9
228
  stage: build
229 230 231 232 233 234 235 236
  artifacts:
    expire_in: 2 year
  variables:
    TEST_TYPE: slowtest
  only:
    variables:
      - $NIGHTLY

Ben Gamari's avatar
Ben Gamari committed
237 238
validate-x86_64-linux-deb9-llvm:
  extends: .validate-linux
239
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
240
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
241 242 243
  image: ghcci/x86_64-linux-deb9:0.2
  variables:
    BUILD_FLAVOUR: perf-llvm
Ben Gamari's avatar
Ben Gamari committed
244 245 246 247 248
  cache:
    key: linux-x86_64-deb9

validate-x86_64-linux-deb8:
  extends: .validate-linux
249
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
250 251 252
  image: ghcci/x86_64-linux-deb8:0.1
  cache:
    key: linux-x86_64-deb8
253 254
  artifacts:
    when: always
255
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
256 257 258

validate-x86_64-linux-fedora27:
  extends: .validate-linux
259
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
260 261 262
  image: ghcci/x86_64-linux-fedora27:0.1
  cache:
    key: linux-x86_64-fedora27
263 264
  artifacts:
    when: always
265
    expire_in: 2 week
Ben Gamari's avatar
Ben Gamari committed
266 267 268

validate-x86_64-linux-deb9-integer-simple:
  extends: .validate-linux
269
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
270 271
  variables:
    INTEGER_LIBRARY: integer-simple
Ben Gamari's avatar
Ben Gamari committed
272
  image: ghcci/x86_64-linux-deb9:0.2
Ben Gamari's avatar
Ben Gamari committed
273 274 275
  cache:
    key: linux-x86_64-deb9

276 277
nightly-x86_64-linux-deb9-integer-simple:
  extends: validate-x86_64-linux-deb9-integer-simple
278
  stage: full-build
279 280 281 282 283 284 285 286
  artifacts:
    expire_in: 2 year
  variables:
    TEST_TYPE: slowtest
  only:
    variables:
      - $NIGHTLY

Ben Gamari's avatar
Ben Gamari committed
287 288
validate-x86_64-linux-deb9-unreg:
  extends: .validate-linux
289
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
290 291
  variables:
    CONFIGURE_ARGS: --enable-unregisterised
Ben Gamari's avatar
Ben Gamari committed
292
  image: ghcci/x86_64-linux-deb9:0.2
Ben Gamari's avatar
Ben Gamari committed
293 294 295
  cache:
    key: linux-x86_64-deb9

Ben Gamari's avatar
Ben Gamari committed
296
############################################################
297
# Validation via Pipelines (Windows)
Ben Gamari's avatar
Ben Gamari committed
298 299
############################################################

300 301
.validate-windows:
  before_script:
302
    - git clean -xdf
303
    - git submodule foreach git clean -xdf
304 305 306 307 308 309 310 311 312

    # 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%
313 314 315 316 317
    - python .gitlab/fix-submodules.py
    - git submodule sync --recursive
    - git submodule update --init --recursive
    - git checkout .gitmodules
    - bash .gitlab/win32-init.sh
318 319
  after_script:
    - rd /s /q tmp
320
    - robocopy /np /nfl /ndl /e "%APPDATA%\cabal" cabal-cache
321
    - bash -c 'make clean || true'
322
  dependencies: []
323 324 325 326 327 328
  cache:
    paths:
      - cabal-cache
      - ghc-8.6.2
      - ghc-tarballs

329
validate-x86_64-windows-hadrian:
330
  extends: .validate-windows
331
  stage: full-build
Ben Gamari's avatar
Ben Gamari committed
332 333
  variables:
    GHC_VERSION: "8.6.2"
Ben Gamari's avatar
Ben Gamari committed
334
    LANG: "en_US.UTF-8"
Ben Gamari's avatar
Ben Gamari committed
335 336 337 338
  script:
    - |
      set MSYSTEM=MINGW64
      python boot
339
      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
340 341
      mkdir -p _build
      cp -R inplace/mingw _build/mingw
342 343 344 345 346
    - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --flavour=Quick"
    # FIXME: Bindist disabled due to #16073
    #- bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh binary-dist"
    # FIXME: Testsuite disabled due to #16156.
    #- bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
Ben Gamari's avatar
Ben Gamari committed
347
  cache:
348
    key: x86_64-windows
Ben Gamari's avatar
Ben Gamari committed
349 350 351
  tags:
    - x86_64-windows

352
validate-x86_64-windows:
353
  extends: .validate-windows
354
  stage: full-build
355 356
  # due to #16084
  allow_failure: true
357 358
  variables:
    GHC_VERSION: "8.6.2"
Ben Gamari's avatar
Ben Gamari committed
359
    LANG: "en_US.UTF-8"
360 361 362 363
  script:
    - |
      set MSYSTEM=MINGW64
      python boot
364
      bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex'
365
    - bash -c "echo include mk/flavours/quick.mk > mk/build.mk"
366
    - bash -c "PATH=`pwd`/toolchain/bin:$PATH make -j`mk/detect-cpu-count.sh`"
367 368 369
    - |
      bash -c "make binary-dist TAR_COMP_OPTS=-1"
      mv ghc-*.tar.xz ghc.tar.xz
370
    - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
371
  cache:
372
    key: x86_64-windows
373 374
  tags:
    - x86_64-windows
375 376 377 378 379 380 381
  artifacts:
    when: always
    reports:
      junit: junit.xml
    paths:
      - ghc.tar.xz
      - junit.xml
Ben Gamari's avatar
Ben Gamari committed
382

383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399
# Note [Cleanup on Windows]
# ~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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

# See Note [Cleanup on Windows]
cleanup-windows:
  stage: cleanup
  tags:
    - x86_64-windows
  when: always
400
  dependencies: []
401 402 403 404 405 406 407 408 409 410 411
  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
    - rmdir /S /Q %BUILD_DIR%/*
    - exit /b 0