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