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