gitlab-ci: Set thread count properly on Windows
[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     - bash .circleci/prepare-system.sh
55     - if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
56     - ./boot
57     - ./configure $CONFIGURE_ARGS
58     - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh`
59   cache:
60     key: hadrian
61     paths:
62       - cabal-cache
63
64 validate-x86_64-linux-deb8-hadrian:
65   extends: .validate-hadrian
66   stage: build
67   image: ghcci/x86_64-linux-deb8:0.1
68   before_script:
69     # workaround for docker permissions
70     - sudo chown ghc:ghc -R .
71     - python3 .gitlab/fix-submodules.py
72     - git submodule sync --recursive
73     - git submodule update --init --recursive
74     - git checkout .gitmodules
75   tags:
76     - x86_64-linux
77
78 ############################################################
79 # Validation via Pipelines (make)
80 ############################################################
81
82 .validate:
83   variables:
84     TEST_TYPE: test
85   script:
86     - make clean || true
87     - ./boot
88     - ./configure $CONFIGURE_ARGS
89     - |
90       THREADS=`mk/detect-cpu-count.sh`
91       make V=0 -j$THREADS
92     - |
93       make binary-dist TAR_COMP_OPTS="-1"
94       mv ghc-*.tar.xz ghc.tar.xz
95     - |
96       THREADS=`mk/detect-cpu-count.sh`
97       make $TEST_TYPE THREADS=$THREADS JUNIT_FILE=../../junit.xml
98   artifacts:
99     reports:
100       junit: junit.xml
101     expire_in: 2 week
102     paths:
103       - ghc.tar.xz
104       - junit.xml
105
106 validate-x86_64-darwin:
107   extends: .validate
108   stage: full-build
109   allow_failure: true
110   tags:
111     - x86_64-darwin
112   variables:
113     GHC_VERSION: 8.6.3
114     MACOSX_DEPLOYMENT_TARGET: "10.7"
115     # Only Sierra and onwards supports clock_gettime. See #12858
116     ac_cv_func_clock_gettime: "no"
117     LANG: "en_US.UTF-8"
118   before_script:
119     - python .gitlab/fix-submodules.py
120     - git submodule sync --recursive
121     - git submodule update --init --recursive
122     - git checkout .gitmodules
123
124     - bash .gitlab/darwin-init.sh
125     - PATH="`pwd`/toolchain/bin:$PATH"
126       # Disable sphinx PDF output as MacTeX apparently doesn't provide xelatex
127     - echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
128     - echo "libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-intree-gmp" >> mk/build.mk
129   after_script:
130     - cp -Rf $HOME/.cabal cabal-cache
131   artifacts:
132     when: always
133     expire_in: 2 week
134   cache:
135     key: darwin
136     paths:
137       - cabal-cache
138       - toolchain
139
140 .validate-linux:
141   extends: .validate
142   tags:
143     - x86_64-linux
144   before_script:
145     - python3 .gitlab/fix-submodules.py
146     - git submodule sync --recursive
147     - git submodule update --init --recursive
148     - git checkout .gitmodules
149
150     - bash .circleci/prepare-system.sh
151     # workaround for docker permissions
152     - sudo chown ghc:ghc -R .
153   after_script:
154     - cp -Rf $HOME/.cabal cabal-cache
155   cache:
156     key: linux
157     paths:
158       - cabal-cache
159       - toolchain
160
161 validate-aarch64-linux-deb9:
162   extends: .validate-linux
163   stage: full-build
164   image: ghcci/aarch64-linux-deb9:0.1
165   allow_failure: true
166   artifacts:
167     when: always
168     expire_in: 2 week
169   cache:
170     key: linux-aarch64-deb9
171   tags:
172     - aarch64-linux
173
174 nightly-aarch64-linux-deb9:
175   extends: validate-aarch64-linux-deb9
176   stage: full-build
177   artifacts:
178     expire_in: 2 year
179   variables:
180     TEST_TYPE: slowtest
181   only:
182     variables:
183       - $NIGHTLY
184
185 validate-x86_64-linux-deb9:
186   extends: .validate-linux
187   stage: build
188   image: ghcci/x86_64-linux-deb9:0.2
189   artifacts:
190     when: always
191     expire_in: 2 week
192   cache:
193     key: linux-x86_64-deb9
194
195 nightly-x86_64-linux-deb9:
196   extends: validate-x86_64-linux-deb9
197   stage: build
198   artifacts:
199     expire_in: 2 year
200   variables:
201     TEST_TYPE: slowtest
202   only:
203     variables:
204       - $NIGHTLY
205
206 validate-x86_64-linux-deb9-llvm:
207   extends: .validate-linux
208   stage: full-build
209   allow_failure: true
210   image: ghcci/x86_64-linux-deb9:0.2
211   variables:
212     BUILD_FLAVOUR: perf-llvm
213   cache:
214     key: linux-x86_64-deb9
215
216 validate-x86_64-linux-deb8:
217   extends: .validate-linux
218   stage: full-build
219   image: ghcci/x86_64-linux-deb8:0.1
220   cache:
221     key: linux-x86_64-deb8
222   artifacts:
223     when: always
224     expire_in: 2 week
225
226 validate-x86_64-linux-fedora27:
227   extends: .validate-linux
228   stage: full-build
229   image: ghcci/x86_64-linux-fedora27:0.1
230   cache:
231     key: linux-x86_64-fedora27
232   artifacts:
233     when: always
234     expire_in: 2 week
235
236 validate-x86_64-linux-deb9-integer-simple:
237   extends: .validate-linux
238   stage: full-build
239   allow_failure: true
240   variables:
241     INTEGER_LIBRARY: integer-simple
242   image: ghcci/x86_64-linux-deb9:0.2
243   cache:
244     key: linux-x86_64-deb9
245
246 nightly-x86_64-linux-deb9-integer-simple:
247   extends: validate-x86_64-linux-deb9-integer-simple
248   stage: full-build
249   artifacts:
250     expire_in: 2 year
251   variables:
252     TEST_TYPE: slowtest
253   only:
254     variables:
255       - $NIGHTLY
256
257 validate-x86_64-linux-deb9-unreg:
258   extends: .validate-linux
259   stage: full-build
260   variables:
261     CONFIGURE_ARGS: --enable-unregisterised
262   image: ghcci/x86_64-linux-deb9:0.2
263   cache:
264     key: linux-x86_64-deb9
265
266 ############################################################
267 # Validation via Pipelines (Windows)
268 ############################################################
269
270 .validate-windows:
271   before_script:
272     - PATH=C:\msys64\usr\bin;%PATH%
273     - python .gitlab/fix-submodules.py
274     - git submodule sync --recursive
275     - git submodule update --init --recursive
276     - git checkout .gitmodules
277     - bash .gitlab/win32-init.sh
278   cache:
279     paths:
280       - cabal-cache
281       - ghc-8.6.2
282       - ghc-tarballs
283
284 validate-x86_64-windows-hadrian:
285   extends: .validate-windows
286   stage: full-build
287   variables:
288     GHC_VERSION: "8.6.2"
289   # due to #16073
290   allow_failure: true
291   script:
292     - |
293       set MSYSTEM=MINGW64
294       python boot
295       bash -c './configure --with-ghc=`pwd`/toolchain/bin/ghc --enable-tarballs-autodownload HappyCmd=`pwd`/toolchain/bin/happy AlexCmd=`pwd`/toolchain/bin/alex'
296       mkdir -p _build
297       cp -R inplace/mingw _build/mingw
298     # FIXME: --no-lint due to #15950
299     - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --flavour=Quick --no-lint"
300     - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh binary-dist"
301     - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
302     - cp -Rf $APPDATA/cabal cabal-cache
303   cache:
304     key: x86_64-windows
305   tags:
306     - x86_64-windows
307
308 validate-x86_64-windows:
309   extends: .validate-windows
310   stage: full-build
311   variables:
312     GHC_VERSION: "8.6.2"
313   script:
314     - |
315       set MSYSTEM=MINGW64
316       python boot
317       bash -c './configure --with-ghc=`pwd`/toolchain/bin/ghc --enable-tarballs-autodownload HappyCmd=`pwd`/toolchain/bin/happy AlexCmd=`pwd`/toolchain/bin/alex'
318     - bash -c "PATH=`pwd`/toolchain/bin:$PATH make -j`mk/detect-cpu-count.sh`"
319     - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
320     - cp -Rf $APPDATA/cabal cabal-cache
321   cache:
322     key: x86_64-windows
323   tags:
324     - x86_64-windows
325
326 ############################################################
327 # Validation via CircleCI
328 ############################################################
329
330 .circleci:
331   stage: build
332   image: ghcci/x86_64-linux-deb8:0.1
333   artifacts:
334     when: always
335     expire_in: 2 week
336     reports:
337       junit: junit.xml
338     paths:
339       - ghc.tar.xz
340       - junit.xml
341   tags:
342     - circleci
343
344 # All validation jobs keep the bindists and test results are artifacts,
345 # when we get far enough to generate them.
346 #
347 # This requires updating the maximum artifacts size limit in Gitlab to
348 # something like 200MB.
349
350 circleci-validate-x86_64-darwin:
351   extends: .circleci
352   script: ".gitlab/circle-ci-job.sh validate-x86_64-darwin"