Merge: Ci: move services to specific hostnames
[nit.git] / .gitlab-ci.yml
1 image: nitlang/nit-ci
2
3 services:
4   - mongo
5   - neo4j:2.3
6   - postgres
7
8 variables:
9   NEO4J_AUTH: none
10
11 cache:
12   paths:
13     - .ccache
14     - .gradle/caches
15     - .gradle/wrapper
16   key: "$CI_JOB_NAME"
17
18 stages:
19   - build
20   - test
21   - more_test
22   - deploy
23
24 before_script:
25   - date
26   - export CCACHE_DIR=$PWD/.ccache
27   - export GRADLE_USER_HOME=$PWD/.gradle
28   - export PATH=$PWD/bin:$PATH
29   - pwd
30   - ccache -s
31   - ccache -M 500M
32   - du -sh .gradle || true
33   - type -a nitc nitdoc || true # is there some nit tools?
34   - "> status.txt"
35
36 after_script:
37   - export CCACHE_DIR=$PWD/.ccache
38   - ccache -s
39   - du -sh .gradle || true
40   - git status --ignored
41   - date
42   - tail status.txt
43
44 # BASIC JOBS ########################################################
45
46 sanity_checks:
47   stage: build
48   script:
49     - misc/jenkins/checkwhitespaces.sh | tee -a status.txt
50     - misc/jenkins/checksignedoffby.sh | tee -a status.txt
51     - misc/jenkins/checklicense.sh | tee -a status.txt
52
53 build_tools:
54   stage: build
55   script:
56     - make 2>> status.txt
57     - nitc --version
58     - misc/jenkins/check_manpages.sh
59     - "{ cd tests && ./tests.sh base_sim*.nit ../src/nitlight.nit; }"
60     - nitunit -v lib/core
61   artifacts:
62     paths:
63       - bin/*
64       - c_src/nitc
65       - src/version.nit
66       - src/nitc_0
67       - nitunit.xml*
68       - tests/*.xml*
69     when: always
70     reports:
71       junit:
72         - tests/*.xml
73         - nitunit.xml
74
75 test_some:
76   stage: test
77   dependencies:
78     - build_tools
79   script:
80     - cd tests
81     - ./search_tests_git.sh origin/master HEAD > list
82     - ./testall.sh `cat list` | tee log.txt
83     - grep -v '=>' log.txt > ../status.txt || true
84   artifacts:
85     paths:
86       - tests/errlist
87       - tests/*.xml
88     when: always
89     reports:
90       junit: tests/*.xml
91
92 nitunit_some:
93   stage: test
94   dependencies:
95     - build_tools
96   script:
97     - git diff --name-only origin/master..HEAD -- "*.nit" "*.res" "README.*" | grep -v "^tests/" > list0.txt || true
98     - xargs nitls -pP < list0.txt > list.txt
99     - xargs nitunit < list.txt
100   artifacts:
101     paths:
102       - nitunit.xml*
103     when: always
104     reports:
105       junit:
106         - nitunit.xml
107
108 nitpick_full:
109   stage: test
110   dependencies:
111     - build_tools
112   script:
113     - nitls lib src examples contrib
114     - nitls -Pp lib src examples | grep -v -f tests/gitlab_ci.skip > list.txt || true # filter what is skipped by tests.sh
115     - xargs nitpick < list.txt
116
117 basic_android:
118   stage: test
119   dependencies:
120     - build_tools
121   script:
122     - make -C contrib/asteronits android
123   artifacts:
124     paths:
125       - contrib/asteronits/bin/*.apk
126
127 # TEST FULL #########################################################
128
129 test_full_nitcs:
130   stage: more_test
131   dependencies:
132     - build_tools
133   script:
134     - cd tests
135     - ./testfull.sh | tee log.txt
136     - grep -v '=>' log.txt > ../status.txt || true
137   artifacts:
138     paths:
139       - tests/errlist
140       - tests/*.xml*
141       - tests/out/*.res
142       - tests/out/*.log
143     when: always
144     reports:
145       junit: tests/*.xml
146
147 test_full_niti:
148   stage: more_test
149   dependencies:
150     - build_tools
151   script:
152     - cd tests
153     - ./testfull.sh --engine niti | tee log.txt
154     - grep -v '=>' log.txt > ../status.txt || true
155   artifacts:
156     paths:
157       - tests/errlist
158       - tests/*.xml*
159       - tests/out/*.res
160       - tests/out/*.log
161     when: always
162     reports:
163       junit: tests/*.xml
164
165 test_full_nitcg:
166   stage: more_test
167   dependencies:
168     - build_tools
169   script:
170     - cd tests
171     - ./testfull.sh --engine nitcg | tee log.txt
172     - grep -v '=>' log.txt > ../status.txt || true
173   artifacts:
174     paths:
175       - tests/errlist
176       - tests/*.xml*
177       - tests/out/*.res
178       - tests/out/*.log
179     when: always
180     reports:
181       junit: tests/*.xml
182
183 test_full_nitce:
184   stage: more_test
185   dependencies:
186     - build_tools
187   script:
188     - cd tests
189     - ./testfull.sh --engine nitce | tee log.txt
190     - grep -v '=>' log.txt > ../status.txt || true
191   artifacts:
192     paths:
193       - tests/errlist
194       - tests/*.xml*
195       - tests/out/*.res
196       - tests/out/*.log
197     when: always
198     reports:
199       junit: tests/*.xml
200
201 test_full_nitcsg:
202   stage: more_test
203   dependencies:
204     - build_tools
205   script:
206     - cd tests
207     - ./testfull.sh --engine nitcsg | tee log.txt
208     - grep -v '=>' log.txt > ../status.txt || true
209   artifacts:
210     paths:
211       - tests/errlist
212       - tests/*.xml*
213       - tests/out/*.res
214       - tests/out/*.log
215     when: always
216     reports:
217       junit: tests/*.xml
218
219 # LIB, CONTRIB AND OOT ##############################################
220
221 nitunit_lib:
222   stage: more_test
223   dependencies:
224     - build_tools
225   script:
226     - nitls -Pp lib | grep -v -f tests/gitlab_ci.skip > list.txt || true # filter what is skipped by tests.sh
227     - xargs nitunit -v < list.txt| tee log.txt
228     - grep -e KO log.txt > status.txt || true
229     - tail -3 log.txt >> status.txt
230   artifacts:
231     paths:
232       - nitunit.xml*
233     when: always
234     reports:
235       junit:
236         - nitunit.xml
237
238 nitunit_src:
239   stage: more_test
240   dependencies:
241     - build_tools
242   script:
243     - nitls -Pp src examples | grep -v -f tests/gitlab_ci.skip > list.txt || true # filter what is skipped by tests.sh
244     - xargs nitunit -v < list.txt| tee log.txt
245     - grep -e KO log.txt > status.txt || true
246     - tail -3 log.txt >> status.txt
247   artifacts:
248     paths:
249       - nitunit.xml*
250     when: always
251     reports:
252       junit:
253         - nitunit.xml
254
255 test_contribs:
256   stage: more_test
257   dependencies:
258     - build_tools
259   script:
260     - misc/jenkins/check_contrib.sh all check
261     - grep 'error message' *.xml > status.txt || true
262     - test ! -s status.txt # no lines, no errors
263   allow_failure: true
264
265 test_contribs_android:
266   stage: more_test
267   dependencies:
268     - build_tools
269   script:
270     - misc/jenkins/check_contrib.sh android
271     - grep 'error message' *.xml > status.txt || true
272     - mkdir -p apk
273     - find . -name '*.apk' -exec cp {} apk/ ";"
274     - test ! -s status.txt # no lines, no errors
275   artifacts:
276     paths:
277       - "apk"
278     when: always
279
280 build_oot:
281   stage: more_test
282   dependencies:
283     - build_more_tools
284   script:
285     - cd contrib
286     - ./oot.sh all
287     - grep 'error message' *.xml > ../status.txt || true
288     - test ! -s ../status.txt # no lines, no errors
289   allow_failure: true
290
291 # MISC ##############################################################
292
293 bootstrap_full:
294   stage: more_test
295   dependencies:
296     - build_tools
297   script:
298     - cd src
299     - ./full_bootstrap
300     - ./ncall.sh
301
302 bench_fast:
303   stage: more_test
304   dependencies:
305     - build_tools
306   script:
307     - cd benchmarks
308     - ./bench_engines.sh --fast --fast --html options
309     - grep -B1 'error message' *.xml | grep testcase > ../status.txt || true
310   artifacts:
311     paths:
312       - benchmarks/*.html
313       - benchmarks/*.png
314       - benchmarks/*.dat
315       - benchmarks/*.gnu
316     when: always
317   allow_failure: true
318
319
320 # MORE TOOLS ########################################################
321
322 build_more_tools:
323   stage: test
324   dependencies:
325     - build_tools
326   script:
327     - make more
328     - make -C "contrib/nitcc"
329   artifacts:
330     paths:
331       - bin/*
332       - c_src/nitc
333       - src/version.nit
334       - src/nitc_0
335
336 build_doc:
337   stage: more_test
338   dependencies:
339     - build_more_tools
340   script:
341     - nitls -r -t .
342     - nitdoc -d nitdoc.out --keep-going lib src
343   artifacts:
344     paths:
345       - nitdoc.out
346
347 build_catalog:
348   stage: more_test
349   dependencies:
350     - build_more_tools
351   script:
352     - misc/jenkins/check_contrib.sh pre-build
353     - cd contrib
354     - ./oot.sh update
355     - ./oot.sh pre-build
356     - cd ..
357     - nitcatalog -d catalog.out lib/ examples/ contrib/ contrib/oot/
358   dependencies:
359     - build_more_tools
360   artifacts:
361     paths:
362       - catalog.out
363
364 .test_macos:
365   script:
366     - uname
367     - pwd
368     - ls /
369   stage: build
370   tags:
371     - macos