4c2f2a4942698da3b9d02a2883ff95d853cb66eb
[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
15 ############################################################
16 # Tags
17 ############################################################
18 #
19 # * x86_64-linux: Any Docker-capable x86_64 Linux machine
20 # * aarch64-linux: Any Docker-capable AArch64 Linux machine
21 # * x86_64-windows: A x86_64 Windows machine
22 # * lint: Any Docker-capable x86_64 Linux machine; distinct from
23 #         x86_64-linux to ensure low-latency availability.
24 #
25
26
27 ############################################################
28 # Linting
29 ############################################################
30
31 ghc-linters:
32   stage: lint
33   image: ghcci/linters:0.1
34   script:
35     - |
36       if [ -n "$CI_MERGE_REQUEST_ID" ]; then
37         base="$(git merge-base $CI_MERGE_REQUEST_BRANCH_NAME HEAD)"
38         validate-commit-msg .git $(git rev-list $base..$CI_COMMIT_SHA)
39         submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA)
40         validate-whitespace .git $(git rev-list $base..$CI_COMMIT_SHA)
41         .gitlab/linters/check-makefiles.py $base $CI_COMMIT_SHA
42         .gitlab/linters/check-cpp.py $base $CI_COMMIT_SHA
43       fi
44   tags:
45     - lint
46
47 ############################################################
48 # Validation via Pipelines (hadrian)
49 ############################################################
50
51 .validate-hadrian:
52   allow_failure: true
53   script:
54     - git clean -xdf && git submodule foreach git clean -xdf
55     - bash .circleci/prepare-system.sh
56     - if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
57     - ./boot
58     - ./configure $CONFIGURE_ARGS
59     - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh`
60   cache:
61     key: hadrian
62     paths:
63       - cabal-cache
64
65 validate-x86_64-linux-deb8-hadrian:
66   extends: .validate-hadrian
67   stage: build
68   image: ghcci/x86_64-linux-deb8:0.1
69   before_script:
70     # workaround for docker permissions
71     - sudo chown ghc:ghc -R .
72     - python3 .gitlab/fix-submodules.py
73     - git submodule sync --recursive
74     - git submodule update --init --recursive
75     - git checkout .gitmodules
76   tags:
77     - x86_64-linux
78
79 ############################################################
80 # Validation via Pipelines (make)
81 ############################################################
82
83 .validate:
84   variables:
85     TEST_TYPE: test
86   before_script:
87     - git clean -xdf && git submodule foreach git clean -xdf
88   script:
89     - ./boot
90     - ./configure $CONFIGURE_ARGS
91     - |
92       THREADS=`mk/detect-cpu-count.sh`
93       make V=0 -j$THREADS
94     - |
95       make binary-dist TAR_COMP_OPTS="-1"
96       mv ghc-*.tar.xz ghc.tar.xz
97     - |
98       THREADS=`mk/detect-cpu-count.sh`
99       make $TEST_TYPE THREADS=$THREADS JUNIT_FILE=../../junit.xml
100   artifacts:
101     reports:
102       junit: junit.xml
103     expire_in: 2 week
104     paths:
105       - ghc.tar.xz
106       - junit.xml
107
108 validate-x86_64-darwin:
109   extends: .validate
110   stage: full-build
111   allow_failure: true
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   before_script:
121     - git clean -xdf && git submodule foreach git clean -xdf
122     - python .gitlab/fix-submodules.py
123     - git submodule sync --recursive
124     - git submodule update --init --recursive
125     - git checkout .gitmodules
126
127     - bash .gitlab/darwin-init.sh
128     - PATH="`pwd`/toolchain/bin:$PATH"
129       # Disable sphinx PDF output as MacTeX apparently doesn't provide xelatex
130     - echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
131     - echo "libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-intree-gmp" >> mk/build.mk
132   after_script:
133     - cp -Rf $HOME/.cabal cabal-cache
134   artifacts:
135     when: always
136     expire_in: 2 week
137   cache:
138     key: darwin
139     paths:
140       - cabal-cache
141       - toolchain
142
143 .validate-linux:
144   extends: .validate
145   tags:
146     - x86_64-linux
147   before_script:
148     - git clean -xdf && git submodule foreach git clean -xdf
149     - python3 .gitlab/fix-submodules.py
150     - git submodule sync --recursive
151     - git submodule update --init --recursive
152     - git checkout .gitmodules
153
154     - bash .circleci/prepare-system.sh
155     # workaround for docker permissions
156     - sudo chown ghc:ghc -R .
157   after_script:
158     - cp -Rf $HOME/.cabal cabal-cache
159   cache:
160     key: linux
161     paths:
162       - cabal-cache
163       - toolchain
164
165 validate-aarch64-linux-deb9:
166   extends: .validate-linux
167   stage: full-build
168   image: ghcci/aarch64-linux-deb9:0.1
169   allow_failure: true
170   artifacts:
171     when: always
172     expire_in: 2 week
173   cache:
174     key: linux-aarch64-deb9
175   tags:
176     - aarch64-linux
177
178 nightly-aarch64-linux-deb9:
179   extends: validate-aarch64-linux-deb9
180   stage: full-build
181   artifacts:
182     expire_in: 2 year
183   variables:
184     TEST_TYPE: slowtest
185   only:
186     variables:
187       - $NIGHTLY
188
189 validate-i386-linux-deb9:
190   extends: .validate-linux
191   stage: full-build
192   image: ghcci/i386-linux-deb9:0.1
193   allow_failure: true
194   artifacts:
195     when: always
196     expire_in: 2 week
197   cache:
198     key: linux-i386-deb9
199
200 nightly-i386-linux-deb9:
201   extends: .validate-linux
202   stage: full-build
203   image: ghcci/i386-linux-deb9:0.1
204   allow_failure: true
205   variables:
206     TEST_TYPE: slowtest
207   artifacts:
208     when: always
209     expire_in: 2 week
210   only:
211     variables:
212       - $NIGHTLY
213   cache:
214     key: linux-i386-deb9
215
216 validate-x86_64-linux-deb9:
217   extends: .validate-linux
218   stage: build
219   image: ghcci/x86_64-linux-deb9:0.2
220   artifacts:
221     when: always
222     expire_in: 2 week
223   cache:
224     key: linux-x86_64-deb9
225
226 nightly-x86_64-linux-deb9:
227   extends: validate-x86_64-linux-deb9
228   stage: build
229   artifacts:
230     expire_in: 2 year
231   variables:
232     TEST_TYPE: slowtest
233   only:
234     variables:
235       - $NIGHTLY
236
237 validate-x86_64-linux-deb9-llvm:
238   extends: .validate-linux
239   stage: full-build
240   allow_failure: true
241   image: ghcci/x86_64-linux-deb9:0.2
242   variables:
243     BUILD_FLAVOUR: perf-llvm
244   cache:
245     key: linux-x86_64-deb9
246
247 validate-x86_64-linux-deb8:
248   extends: .validate-linux
249   stage: full-build
250   image: ghcci/x86_64-linux-deb8:0.1
251   cache:
252     key: linux-x86_64-deb8
253   artifacts:
254     when: always
255     expire_in: 2 week
256
257 validate-x86_64-linux-fedora27:
258   extends: .validate-linux
259   stage: full-build
260   image: ghcci/x86_64-linux-fedora27:0.1
261   cache:
262     key: linux-x86_64-fedora27
263   artifacts:
264     when: always
265     expire_in: 2 week
266
267 validate-x86_64-linux-deb9-integer-simple:
268   extends: .validate-linux
269   stage: full-build
270   allow_failure: true
271   variables:
272     INTEGER_LIBRARY: integer-simple
273   image: ghcci/x86_64-linux-deb9:0.2
274   cache:
275     key: linux-x86_64-deb9
276
277 nightly-x86_64-linux-deb9-integer-simple:
278   extends: validate-x86_64-linux-deb9-integer-simple
279   stage: full-build
280   artifacts:
281     expire_in: 2 year
282   variables:
283     TEST_TYPE: slowtest
284   only:
285     variables:
286       - $NIGHTLY
287
288 validate-x86_64-linux-deb9-unreg:
289   extends: .validate-linux
290   stage: full-build
291   variables:
292     CONFIGURE_ARGS: --enable-unregisterised
293   image: ghcci/x86_64-linux-deb9:0.2
294   cache:
295     key: linux-x86_64-deb9
296
297 ############################################################
298 # Validation via Pipelines (Windows)
299 ############################################################
300
301 .validate-windows:
302   before_script:
303     - git clean -xdf
304     - git submodule foreach git clean -xdf
305     - PATH=C:\msys64\usr\bin;%PATH%
306     - python .gitlab/fix-submodules.py
307     - git submodule sync --recursive
308     - git submodule update --init --recursive
309     - git checkout .gitmodules
310     - bash .gitlab/win32-init.sh
311   cache:
312     paths:
313       - cabal-cache
314       - ghc-8.6.2
315       - ghc-tarballs
316
317 validate-x86_64-windows-hadrian:
318   extends: .validate-windows
319   stage: full-build
320   variables:
321     GHC_VERSION: "8.6.2"
322     LANG: "en_US.UTF-8"
323   # due to #16073
324   allow_failure: true
325   script:
326     - |
327       set MSYSTEM=MINGW64
328       python boot
329       bash -c './configure --with-ghc=`pwd`/toolchain/bin/ghc --enable-tarballs-autodownload HappyCmd=`pwd`/toolchain/bin/happy AlexCmd=`pwd`/toolchain/bin/alex'
330       mkdir -p _build
331       cp -R inplace/mingw _build/mingw
332     # FIXME: --no-lint due to #15950
333     - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --flavour=Quick --no-lint"
334     - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh binary-dist"
335     - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
336     - cp -Rf $APPDATA/cabal cabal-cache
337   cache:
338     key: x86_64-windows
339   tags:
340     - x86_64-windows
341
342 validate-x86_64-windows:
343   extends: .validate-windows
344   stage: full-build
345   variables:
346     GHC_VERSION: "8.6.2"
347     LANG: "en_US.UTF-8"
348   script:
349     - |
350       set MSYSTEM=MINGW64
351       python boot
352       bash -c './configure --with-ghc=`pwd`/toolchain/bin/ghc --enable-tarballs-autodownload HappyCmd=`pwd`/toolchain/bin/happy AlexCmd=`pwd`/toolchain/bin/alex'
353     - bash -c "PATH=`pwd`/toolchain/bin:$PATH make -j`mk/detect-cpu-count.sh`"
354     - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
355     - cp -Rf $APPDATA/cabal cabal-cache
356   cache:
357     key: x86_64-windows
358   tags:
359     - x86_64-windows
360
361 ############################################################
362 # Validation via CircleCI
363 ############################################################
364
365 .circleci:
366   stage: build
367   image: ghcci/x86_64-linux-deb8:0.1
368   artifacts:
369     when: always
370     expire_in: 2 week
371     reports:
372       junit: junit.xml
373     paths:
374       - ghc.tar.xz
375       - junit.xml
376   tags:
377     - circleci
378
379 # All validation jobs keep the bindists and test results are artifacts,
380 # when we get far enough to generate them.
381 #
382 # This requires updating the maximum artifacts size limit in Gitlab to
383 # something like 200MB.
384
385 circleci-validate-x86_64-darwin:
386   extends: .circleci
387   stage: full-build
388   allow_failure: true
389   script: ".gitlab/circle-ci-job.sh validate-x86_64-darwin"