gitlab-ci: Only run nightly-i386-linux-deb9 when NIGHTLY is set
[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   script:
87     - git clean -xdf && git submodule foreach git clean -xdf
88     - ./boot
89     - ./configure $CONFIGURE_ARGS
90     - |
91       THREADS=`mk/detect-cpu-count.sh`
92       make V=0 -j$THREADS
93     - |
94       make binary-dist TAR_COMP_OPTS="-1"
95       mv ghc-*.tar.xz ghc.tar.xz
96     - |
97       THREADS=`mk/detect-cpu-count.sh`
98       make $TEST_TYPE THREADS=$THREADS JUNIT_FILE=../../junit.xml
99   artifacts:
100     reports:
101       junit: junit.xml
102     expire_in: 2 week
103     paths:
104       - ghc.tar.xz
105       - junit.xml
106
107 validate-x86_64-darwin:
108   extends: .validate
109   stage: full-build
110   allow_failure: true
111   tags:
112     - x86_64-darwin
113   variables:
114     GHC_VERSION: 8.6.3
115     MACOSX_DEPLOYMENT_TARGET: "10.7"
116     # Only Sierra and onwards supports clock_gettime. See #12858
117     ac_cv_func_clock_gettime: "no"
118     LANG: "en_US.UTF-8"
119   before_script:
120     - python .gitlab/fix-submodules.py
121     - git submodule sync --recursive
122     - git submodule update --init --recursive
123     - git checkout .gitmodules
124
125     - bash .gitlab/darwin-init.sh
126     - PATH="`pwd`/toolchain/bin:$PATH"
127       # Disable sphinx PDF output as MacTeX apparently doesn't provide xelatex
128     - echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
129     - echo "libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-intree-gmp" >> mk/build.mk
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     - python3 .gitlab/fix-submodules.py
147     - git submodule sync --recursive
148     - git submodule update --init --recursive
149     - git checkout .gitmodules
150
151     - bash .circleci/prepare-system.sh
152     # workaround for docker permissions
153     - sudo chown ghc:ghc -R .
154   after_script:
155     - cp -Rf $HOME/.cabal cabal-cache
156   cache:
157     key: linux
158     paths:
159       - cabal-cache
160       - toolchain
161
162 validate-aarch64-linux-deb9:
163   extends: .validate-linux
164   stage: full-build
165   image: ghcci/aarch64-linux-deb9:0.1
166   allow_failure: true
167   artifacts:
168     when: always
169     expire_in: 2 week
170   cache:
171     key: linux-aarch64-deb9
172   tags:
173     - aarch64-linux
174
175 nightly-aarch64-linux-deb9:
176   extends: validate-aarch64-linux-deb9
177   stage: full-build
178   artifacts:
179     expire_in: 2 year
180   variables:
181     TEST_TYPE: slowtest
182   only:
183     variables:
184       - $NIGHTLY
185
186 validate-i386-linux-deb9:
187   extends: .validate-linux
188   stage: full-build
189   image: ghcci/i386-linux-deb9:0.1
190   allow_failure: true
191   artifacts:
192     when: always
193     expire_in: 2 week
194   cache:
195     key: linux-i386-deb9
196
197 nightly-i386-linux-deb9:
198   extends: .validate-linux
199   stage: full-build
200   image: ghcci/i386-linux-deb9:0.1
201   allow_failure: true
202   variables:
203     TEST_TYPE: slowtest
204   artifacts:
205     when: always
206     expire_in: 2 week
207   only:
208     variables:
209       - $NIGHTLY
210   cache:
211     key: linux-i386-deb9
212
213 validate-x86_64-linux-deb9:
214   extends: .validate-linux
215   stage: build
216   image: ghcci/x86_64-linux-deb9:0.2
217   artifacts:
218     when: always
219     expire_in: 2 week
220   cache:
221     key: linux-x86_64-deb9
222
223 nightly-x86_64-linux-deb9:
224   extends: validate-x86_64-linux-deb9
225   stage: build
226   artifacts:
227     expire_in: 2 year
228   variables:
229     TEST_TYPE: slowtest
230   only:
231     variables:
232       - $NIGHTLY
233
234 validate-x86_64-linux-deb9-llvm:
235   extends: .validate-linux
236   stage: full-build
237   allow_failure: true
238   image: ghcci/x86_64-linux-deb9:0.2
239   variables:
240     BUILD_FLAVOUR: perf-llvm
241   cache:
242     key: linux-x86_64-deb9
243
244 validate-x86_64-linux-deb8:
245   extends: .validate-linux
246   stage: full-build
247   image: ghcci/x86_64-linux-deb8:0.1
248   cache:
249     key: linux-x86_64-deb8
250   artifacts:
251     when: always
252     expire_in: 2 week
253
254 validate-x86_64-linux-fedora27:
255   extends: .validate-linux
256   stage: full-build
257   image: ghcci/x86_64-linux-fedora27:0.1
258   cache:
259     key: linux-x86_64-fedora27
260   artifacts:
261     when: always
262     expire_in: 2 week
263
264 validate-x86_64-linux-deb9-integer-simple:
265   extends: .validate-linux
266   stage: full-build
267   allow_failure: true
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     - PATH=C:\msys64\usr\bin;%PATH%
303     - python .gitlab/fix-submodules.py
304     - git submodule sync --recursive
305     - git submodule update --init --recursive
306     - git checkout .gitmodules
307     - bash .gitlab/win32-init.sh
308   cache:
309     paths:
310       - cabal-cache
311       - ghc-8.6.2
312       - ghc-tarballs
313
314 validate-x86_64-windows-hadrian:
315   extends: .validate-windows
316   stage: full-build
317   variables:
318     GHC_VERSION: "8.6.2"
319     LANG: "en_US.UTF-8"
320   # due to #16073
321   allow_failure: true
322   script:
323     - |
324       set MSYSTEM=MINGW64
325       python boot
326       bash -c './configure --with-ghc=`pwd`/toolchain/bin/ghc --enable-tarballs-autodownload HappyCmd=`pwd`/toolchain/bin/happy AlexCmd=`pwd`/toolchain/bin/alex'
327       mkdir -p _build
328       cp -R inplace/mingw _build/mingw
329     # FIXME: --no-lint due to #15950
330     - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --flavour=Quick --no-lint"
331     - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh binary-dist"
332     - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
333     - cp -Rf $APPDATA/cabal cabal-cache
334   cache:
335     key: x86_64-windows
336   tags:
337     - x86_64-windows
338
339 validate-x86_64-windows:
340   extends: .validate-windows
341   stage: full-build
342   variables:
343     GHC_VERSION: "8.6.2"
344     LANG: "en_US.UTF-8"
345   script:
346     - |
347       set MSYSTEM=MINGW64
348       python boot
349       bash -c './configure --with-ghc=`pwd`/toolchain/bin/ghc --enable-tarballs-autodownload HappyCmd=`pwd`/toolchain/bin/happy AlexCmd=`pwd`/toolchain/bin/alex'
350     - bash -c "PATH=`pwd`/toolchain/bin:$PATH make -j`mk/detect-cpu-count.sh`"
351     - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
352     - cp -Rf $APPDATA/cabal cabal-cache
353   cache:
354     key: x86_64-windows
355   tags:
356     - x86_64-windows
357
358 ############################################################
359 # Validation via CircleCI
360 ############################################################
361
362 .circleci:
363   stage: build
364   image: ghcci/x86_64-linux-deb8:0.1
365   artifacts:
366     when: always
367     expire_in: 2 week
368     reports:
369       junit: junit.xml
370     paths:
371       - ghc.tar.xz
372       - junit.xml
373   tags:
374     - circleci
375
376 # All validation jobs keep the bindists and test results are artifacts,
377 # when we get far enough to generate them.
378 #
379 # This requires updating the maximum artifacts size limit in Gitlab to
380 # something like 200MB.
381
382 circleci-validate-x86_64-darwin:
383   extends: .circleci
384   stage: full-build
385   script: ".gitlab/circle-ci-job.sh validate-x86_64-darwin"