gitlab-ci: Drop CircleCI jobs
[ghc.git] / .gitlab-ci.yml
1 variables:
2   GIT_SSL_NO_VERIFY: "1"
3
4 before_script:
5   - python3 .gitlab/fix-submodules.py
6   - git submodule sync --recursive
7   - git submodule update --init --recursive
8   - git checkout .gitmodules
9
10 stages:
11   - lint
12   - build
13   - full-build
14   - cleanup # See Note [Cleanup on Windows]
15
16 ############################################################
17 # Runner Tags
18 ############################################################
19 #
20 # * x86_64-linux: Any Docker-capable x86_64 Linux machine
21 # * aarch64-linux: Any Docker-capable AArch64 Linux machine
22 # * x86_64-windows: A x86_64 Windows machine
23 # * lint: Any Docker-capable x86_64 Linux machine; distinct from
24 #         x86_64-linux to ensure low-latency availability.
25 #
26
27
28 ############################################################
29 # Linting
30 ############################################################
31
32 ghc-linters:
33   stage: lint
34   image: ghcci/linters:0.1
35   script:
36     - |
37       if [ -n "$CI_MERGE_REQUEST_ID" ]; then
38         base="$(git merge-base $CI_MERGE_REQUEST_BRANCH_NAME HEAD)"
39         validate-commit-msg .git $(git rev-list $base..$CI_COMMIT_SHA)
40         submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA)
41         validate-whitespace .git $(git rev-list $base..$CI_COMMIT_SHA)
42         .gitlab/linters/check-makefiles.py $base $CI_COMMIT_SHA
43         .gitlab/linters/check-cpp.py $base $CI_COMMIT_SHA
44       fi
45   tags:
46     - lint
47
48 ############################################################
49 # Validation via Pipelines (hadrian)
50 ############################################################
51
52 .validate-hadrian:
53   allow_failure: true
54   script:
55     - git clean -xdf && git submodule foreach git clean -xdf
56     - bash .circleci/prepare-system.sh
57     - if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
58     - ./boot
59     - ./configure $CONFIGURE_ARGS
60     - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh`
61   cache:
62     key: hadrian
63     paths:
64       - cabal-cache
65
66 validate-x86_64-linux-deb8-hadrian:
67   extends: .validate-hadrian
68   stage: build
69   image: ghcci/x86_64-linux-deb8:0.1
70   before_script:
71     # workaround for docker permissions
72     - sudo chown ghc:ghc -R .
73     - python3 .gitlab/fix-submodules.py
74     - git submodule sync --recursive
75     - git submodule update --init --recursive
76     - git checkout .gitmodules
77   tags:
78     - x86_64-linux
79
80 ############################################################
81 # Validation via Pipelines (make)
82 ############################################################
83
84 .validate:
85   variables:
86     TEST_TYPE: test
87   before_script:
88     - git clean -xdf && git submodule foreach git clean -xdf
89   script:
90     - ./boot
91     - ./configure $CONFIGURE_ARGS
92     - |
93       THREADS=`mk/detect-cpu-count.sh`
94       make V=0 -j$THREADS
95     - |
96       make binary-dist TAR_COMP_OPTS="-1"
97       mv ghc-*.tar.xz ghc.tar.xz
98     - |
99       THREADS=`mk/detect-cpu-count.sh`
100       make $TEST_TYPE THREADS=$THREADS JUNIT_FILE=../../junit.xml
101   artifacts:
102     reports:
103       junit: junit.xml
104     expire_in: 2 week
105     paths:
106       - ghc.tar.xz
107       - junit.xml
108
109 validate-x86_64-darwin:
110   extends: .validate
111   stage: full-build
112   tags:
113     - x86_64-darwin
114   variables:
115     GHC_VERSION: 8.6.3
116     MACOSX_DEPLOYMENT_TARGET: "10.7"
117     # Only Sierra and onwards supports clock_gettime. See #12858
118     ac_cv_func_clock_gettime: "no"
119     LANG: "en_US.UTF-8"
120     CONFIGURE_ARGS: --with-intree-gmp
121   before_script:
122     - git clean -xdf && git submodule foreach git clean -xdf
123     - python3 .gitlab/fix-submodules.py
124     - git submodule sync --recursive
125     - git submodule update --init --recursive
126     - git checkout .gitmodules
127
128     - bash .gitlab/darwin-init.sh
129     - PATH="`pwd`/toolchain/bin:$PATH"
130   after_script:
131     - cp -Rf $HOME/.cabal cabal-cache
132   artifacts:
133     when: always
134     expire_in: 2 week
135   cache:
136     key: darwin
137     paths:
138       - cabal-cache
139       - toolchain
140
141 .validate-linux:
142   extends: .validate
143   tags:
144     - x86_64-linux
145   before_script:
146     - git clean -xdf && git submodule foreach git clean -xdf
147     - python3 .gitlab/fix-submodules.py
148     - git submodule sync --recursive
149     - git submodule update --init --recursive
150     - git checkout .gitmodules
151
152     - bash .circleci/prepare-system.sh
153     # workaround for docker permissions
154     - sudo chown ghc:ghc -R .
155   after_script:
156     - cp -Rf $HOME/.cabal cabal-cache
157   cache:
158     key: linux
159     paths:
160       - cabal-cache
161       - toolchain
162
163 validate-aarch64-linux-deb9:
164   extends: .validate-linux
165   stage: full-build
166   image: ghcci/aarch64-linux-deb9:0.1
167   allow_failure: true
168   artifacts:
169     when: always
170     expire_in: 2 week
171   cache:
172     key: linux-aarch64-deb9
173   tags:
174     - aarch64-linux
175
176 nightly-aarch64-linux-deb9:
177   extends: validate-aarch64-linux-deb9
178   stage: full-build
179   artifacts:
180     expire_in: 2 year
181   variables:
182     TEST_TYPE: slowtest
183   only:
184     variables:
185       - $NIGHTLY
186
187 validate-i386-linux-deb9:
188   extends: .validate-linux
189   stage: full-build
190   image: ghcci/i386-linux-deb9:0.1
191   allow_failure: true
192   artifacts:
193     when: always
194     expire_in: 2 week
195   cache:
196     key: linux-i386-deb9
197
198 nightly-i386-linux-deb9:
199   extends: .validate-linux
200   stage: full-build
201   image: ghcci/i386-linux-deb9:0.1
202   allow_failure: true
203   variables:
204     TEST_TYPE: slowtest
205   artifacts:
206     when: always
207     expire_in: 2 week
208   only:
209     variables:
210       - $NIGHTLY
211   cache:
212     key: linux-i386-deb9
213
214 validate-x86_64-linux-deb9:
215   extends: .validate-linux
216   stage: build
217   image: ghcci/x86_64-linux-deb9:0.2
218   artifacts:
219     when: always
220     expire_in: 2 week
221   cache:
222     key: linux-x86_64-deb9
223
224 nightly-x86_64-linux-deb9:
225   extends: validate-x86_64-linux-deb9
226   stage: build
227   artifacts:
228     expire_in: 2 year
229   variables:
230     TEST_TYPE: slowtest
231   only:
232     variables:
233       - $NIGHTLY
234
235 validate-x86_64-linux-deb9-llvm:
236   extends: .validate-linux
237   stage: full-build
238   allow_failure: true
239   image: ghcci/x86_64-linux-deb9:0.2
240   variables:
241     BUILD_FLAVOUR: perf-llvm
242   cache:
243     key: linux-x86_64-deb9
244
245 validate-x86_64-linux-deb8:
246   extends: .validate-linux
247   stage: full-build
248   image: ghcci/x86_64-linux-deb8:0.1
249   cache:
250     key: linux-x86_64-deb8
251   artifacts:
252     when: always
253     expire_in: 2 week
254
255 validate-x86_64-linux-fedora27:
256   extends: .validate-linux
257   stage: full-build
258   image: ghcci/x86_64-linux-fedora27:0.1
259   cache:
260     key: linux-x86_64-fedora27
261   artifacts:
262     when: always
263     expire_in: 2 week
264
265 validate-x86_64-linux-deb9-integer-simple:
266   extends: .validate-linux
267   stage: full-build
268   variables:
269     INTEGER_LIBRARY: integer-simple
270   image: ghcci/x86_64-linux-deb9:0.2
271   cache:
272     key: linux-x86_64-deb9
273
274 nightly-x86_64-linux-deb9-integer-simple:
275   extends: validate-x86_64-linux-deb9-integer-simple
276   stage: full-build
277   artifacts:
278     expire_in: 2 year
279   variables:
280     TEST_TYPE: slowtest
281   only:
282     variables:
283       - $NIGHTLY
284
285 validate-x86_64-linux-deb9-unreg:
286   extends: .validate-linux
287   stage: full-build
288   variables:
289     CONFIGURE_ARGS: --enable-unregisterised
290   image: ghcci/x86_64-linux-deb9:0.2
291   cache:
292     key: linux-x86_64-deb9
293
294 ############################################################
295 # Validation via Pipelines (Windows)
296 ############################################################
297
298 .validate-windows:
299   before_script:
300     - git clean -xdf
301     - git submodule foreach git clean -xdf
302
303     # Use a local temporary directory to ensure that concurrent builds don't
304     # interfere with one another
305     - |
306       mkdir tmp
307       set TMP=%cd%\tmp
308       set TEMP=%cd%\tmp
309
310     - set PATH=C:\msys64\usr\bin;%PATH%
311     - python .gitlab/fix-submodules.py
312     - git submodule sync --recursive
313     - git submodule update --init --recursive
314     - git checkout .gitmodules
315     - bash .gitlab/win32-init.sh
316   after_script:
317     - rd /s /q tmp
318     - robocopy /np /nfl /ndl /e "%APPDATA%\cabal" cabal-cache
319     - bash -c 'make clean || true'
320   cache:
321     paths:
322       - cabal-cache
323       - ghc-8.6.2
324       - ghc-tarballs
325
326 validate-x86_64-windows-hadrian:
327   extends: .validate-windows
328   stage: full-build
329   variables:
330     GHC_VERSION: "8.6.2"
331     LANG: "en_US.UTF-8"
332   script:
333     - |
334       set MSYSTEM=MINGW64
335       python boot
336       bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex'
337       mkdir -p _build
338       cp -R inplace/mingw _build/mingw
339     - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --flavour=Quick"
340     # FIXME: Bindist disabled due to #16073
341     #- bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh binary-dist"
342     # FIXME: Testsuite disabled due to #16156.
343     #- bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
344   cache:
345     key: x86_64-windows
346   tags:
347     - x86_64-windows
348
349 validate-x86_64-windows:
350   extends: .validate-windows
351   stage: full-build
352   # due to #16084
353   allow_failure: true
354   variables:
355     GHC_VERSION: "8.6.2"
356     LANG: "en_US.UTF-8"
357   script:
358     - |
359       set MSYSTEM=MINGW64
360       python boot
361       bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex'
362     - bash -c "echo include mk/flavours/quick.mk > mk/build.mk"
363     - bash -c "PATH=`pwd`/toolchain/bin:$PATH make -j`mk/detect-cpu-count.sh`"
364     - |
365       bash -c "make binary-dist TAR_COMP_OPTS=-1"
366       mv ghc-*.tar.xz ghc.tar.xz
367     - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
368   cache:
369     key: x86_64-windows
370   tags:
371     - x86_64-windows
372   artifacts:
373     when: always
374     reports:
375       junit: junit.xml
376     paths:
377       - ghc.tar.xz
378       - junit.xml
379
380 # Note [Cleanup on Windows]
381 # ~~~~~~~~~~~~~~~~~~~~~~~~~
382 #
383 # As noted in [1], gitlab-runner's shell executor doesn't clean up its working
384 # directory after builds. Unfortunately, we are forced to use the shell executor
385 # on Windows. To avoid running out of disk space we add a stage at the end of
386 # the build to remove the \GitLabRunner\builds directory. Since we only run a
387 # single build at a time on Windows this should be safe.
388 #
389 # [1] https://gitlab.com/gitlab-org/gitlab-runner/issues/3856
390
391 # See Note [Cleanup on Windows]
392 cleanup-windows:
393   stage: cleanup
394   tags:
395     - x86_64-windows
396   when: always
397   before_script:
398     - echo "Time to clean up"
399   script:
400     - echo "Let's go"
401   after_script:
402     - set "BUILD_DIR=%CI_PROJECT_DIR%"
403     - set "BUILD_DIR=%BUILD_DIR:/=\%"
404     - echo "Cleaning %BUILD_DIR%"
405     - cd \GitLabRunner
406     - rmdir /S /Q %BUILD_DIR%/*
407     - exit /b 0