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