tests.sh: run junit2html to render xml files
[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   - git config --add github.oauthtoken "$GITHUB_OAUTHTOKEN" # needed for github api rate limit
30   - pwd
31   - ccache -s
32   - ccache -M 500M
33   - du -sh .gradle || true
34   - type -a nitc nitdoc || true # is there some nit tools?
35   - "> status.txt"
36
37 after_script:
38   - export CCACHE_DIR=$PWD/.ccache
39   - ccache -s
40   - du -sh .gradle || true
41   - git status --ignored
42   - date
43   - tail status.txt
44
45 # BASIC JOBS ########################################################
46
47 sanity_checks:
48   stage: build
49   script:
50     - misc/jenkins/checkwhitespaces.sh | tee -a status.txt
51     - misc/jenkins/checksignedoffby.sh | tee -a status.txt
52     - misc/jenkins/checklicense.sh | tee -a status.txt
53
54 build_tools:
55   stage: build
56   script:
57     - make 2>> status.txt
58     - nitc --version
59     - misc/jenkins/check_manpages.sh
60   artifacts:
61     paths:
62       - bin/*
63       - c_src/nitc
64       - src/version.nit
65       - src/nitc_0
66     when: always
67
68 test_some:
69   stage: test
70   dependencies:
71     - build_tools
72   script:
73     - cd tests
74     - ./search_tests_git.sh origin/master HEAD > list
75     - ./testall.sh `cat list` | tee log.txt
76     - grep -v '=>' log.txt > ../status.txt || true
77   artifacts:
78     paths:
79       - tests/errlist
80       - tests/*.xml*
81     when: always
82     reports:
83       junit: tests/*.xml
84
85 nitunit_some:
86   stage: test
87   dependencies:
88     - build_tools
89   script:
90     - git diff --name-only origin/master..HEAD -- "*.nit" "*.res" "README.*" | grep -v "^tests/" > list0.txt || true
91     - xargs nitls -pP < list0.txt > list.txt
92     - xargs nitunit < list.txt
93     - junit2html nitunit.xml
94   artifacts:
95     paths:
96       - nitunit.xml*
97     when: always
98     reports:
99       junit:
100         - nitunit.xml
101
102 nitpick_full:
103   stage: test
104   dependencies:
105     - build_tools
106   script:
107     - nitls lib src examples contrib
108     - nitls -Pp lib src examples | grep -v -f tests/gitlab_ci.skip > list.txt || true # filter what is skipped by tests.sh
109     - xargs nitpick < list.txt
110
111 basic_android:
112   stage: test
113   dependencies:
114     - build_tools
115   script:
116     - make -C contrib/asteronits android
117   artifacts:
118     paths:
119       - contrib/asteronits/bin/*.apk
120
121 # TEST FULL #########################################################
122
123 test_full_nitcs:
124   stage: more_test
125   dependencies:
126     - build_tools
127   script:
128     - cd tests
129     - ./testfull.sh | tee log.txt
130     - grep -v '=>' log.txt > ../status.txt || true
131   artifacts:
132     paths:
133       - tests/errlist
134       - tests/*.xml*
135       - tests/out/*.res
136       - tests/out/*.log
137     when: always
138     reports:
139       junit: tests/*.xml
140
141 test_full_niti:
142   stage: more_test
143   dependencies:
144     - build_tools
145   script:
146     - cd tests
147     - ./testfull.sh --engine niti | tee log.txt
148     - grep -v '=>' log.txt > ../status.txt || true
149   artifacts:
150     paths:
151       - tests/errlist
152       - tests/*.xml*
153       - tests/out/*.res
154       - tests/out/*.log
155     when: always
156     reports:
157       junit: tests/*.xml
158
159 test_full_nitcg:
160   stage: more_test
161   dependencies:
162     - build_tools
163   script:
164     - cd tests
165     - ./testfull.sh --engine nitcg | tee log.txt
166     - grep -v '=>' log.txt > ../status.txt || true
167   artifacts:
168     paths:
169       - tests/errlist
170       - tests/*.xml*
171       - tests/out/*.res
172       - tests/out/*.log
173     when: always
174     reports:
175       junit: tests/*.xml
176
177 test_full_nitce:
178   stage: more_test
179   dependencies:
180     - build_tools
181   script:
182     - cd tests
183     - ./testfull.sh --engine nitce | tee log.txt
184     - grep -v '=>' log.txt > ../status.txt || true
185   artifacts:
186     paths:
187       - tests/errlist
188       - tests/*.xml*
189       - tests/out/*.res
190       - tests/out/*.log
191     when: always
192     reports:
193       junit: tests/*.xml
194
195 test_full_nitcsg:
196   stage: more_test
197   dependencies:
198     - build_tools
199   script:
200     - cd tests
201     - ./testfull.sh --engine nitcsg | tee log.txt
202     - grep -v '=>' log.txt > ../status.txt || true
203   artifacts:
204     paths:
205       - tests/errlist
206       - tests/*.xml*
207       - tests/out/*.res
208       - tests/out/*.log
209     when: always
210     reports:
211       junit: tests/*.xml
212
213 # LIB, CONTRIB AND OOT ##############################################
214
215 nitunit_lib:
216   stage: more_test
217   dependencies:
218     - build_tools
219   script:
220     - nitls -Pp lib | grep -v -f tests/gitlab_ci.skip > list.txt || true # filter what is skipped by tests.sh
221     - xargs nitunit -v < list.txt| tee log.txt
222     - grep -e KO log.txt > status.txt || true
223     - tail -3 log.txt >> status.txt
224     - junit2html nitunit.xml
225   artifacts:
226     paths:
227       - nitunit.xml*
228     when: always
229     reports:
230       junit:
231         - nitunit.xml
232
233 nitunit_src:
234   stage: more_test
235   dependencies:
236     - build_tools
237   script:
238     - nitls -Pp src examples | grep -v -f tests/gitlab_ci.skip > list.txt || true # filter what is skipped by tests.sh
239     - xargs nitunit -v < list.txt| tee log.txt
240     - grep -e KO log.txt > status.txt || true
241     - tail -3 log.txt >> status.txt
242     - junit2html nitunit.xml
243   artifacts:
244     paths:
245       - nitunit.xml*
246     when: always
247     reports:
248       junit:
249         - nitunit.xml
250
251 test_contribs:
252   stage: more_test
253   dependencies:
254     - build_tools
255   script:
256     - misc/jenkins/check_contrib.sh all check
257     - grep 'error message' *.xml > status.txt || true
258     - test ! -s status.txt # no lines, no errors
259
260 test_contribs_android:
261   stage: more_test
262   dependencies:
263     - build_tools
264   script:
265     - misc/jenkins/check_contrib.sh android
266     - grep 'error message' *.xml > status.txt || true
267     - mkdir -p apk/debug
268     - find . -name '*.apk' -exec mv {} apk/debug/ ";"
269     - test ! -s status.txt # no lines, no errors
270     - misc/jenkins/check_contrib.sh android-release
271     - grep 'error message' *.xml > status.txt || true
272     - mkdir -p apk/release
273     - find . -name '*.apk' -exec mv {} apk/release ";"
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     # Errors are somewhat expected
289
290 # MISC ##############################################################
291
292 bootstrap_full:
293   stage: more_test
294   dependencies:
295     - build_tools
296   script:
297     - cd src
298     - ./full_bootstrap
299     - ./ncall.sh
300
301 bench_fast:
302   stage: more_test
303   dependencies:
304     - build_tools
305   script:
306     - cd benchmarks
307     - ./bench_engines.sh --fast --fast --html options
308     - grep -B1 'error message' *.xml | grep testcase > ../status.txt || true
309   artifacts:
310     paths:
311       - benchmarks/*.html
312       - benchmarks/*.png
313       - benchmarks/*.dat
314       - benchmarks/*.gnu
315     when: always
316
317
318 # MORE TOOLS ########################################################
319
320 build_more_tools:
321   stage: test
322   dependencies:
323     - build_tools
324   script:
325     - make more
326     - make -C "contrib/nitcc"
327   artifacts:
328     paths:
329       - bin/*
330       - c_src/nitc
331       - src/version.nit
332       - src/nitc_0
333
334 valgrind:
335   stage: more_test
336   dependencies:
337     - build_more_tools
338   script:
339     - mkdir -p valgrind.out
340     - nitc src/nitc.nit # To warm-up the cache
341     - src/valgrind.sh --callgrind-out-file=valgrind.out/nitc.nitc.out nitc src/nitc.nit -vv
342     - callgrind_annotate valgrind.out/nitc.nitc.out > valgrind.out/nitc.nitc.txt
343     - src/valgrind.sh --callgrind-out-file=valgrind.out/niti.niti.out nit -- src/nit.nit tests/base_simple3.nit -vv
344     - callgrind_annotate valgrind.out/niti.niti.out > valgrind.out/niti.niti.txt
345   artifacts:
346     paths:
347       - valgrind.out
348
349 build_doc:
350   stage: more_test
351   dependencies:
352     - build_more_tools
353   script:
354     - nitls -r -t .
355     - nitdoc -d nitdoc.out --keep-going lib src
356   artifacts:
357     paths:
358       - nitdoc.out
359
360 nitmetrics:
361   stage: more_test
362   dependencies:
363     - build_more_tools
364   script:
365     - nitmetrics --all --log --log-dir nitmetrics.out --dir nitmetrics.out --keep-going lib src
366   artifacts:
367     paths:
368       - nitmetrics.out
369
370 build_catalog:
371   stage: more_test
372   dependencies:
373     - build_more_tools
374   script:
375     - misc/jenkins/check_contrib.sh pre-build
376     - cd contrib
377     - ./oot.sh update
378     - ./oot.sh pre-build
379     - cd ..
380     - nitcatalog -d catalog.out lib/ examples/ contrib/ contrib/oot/
381   dependencies:
382     - build_more_tools
383   artifacts:
384     paths:
385       - catalog.out
386
387 .test_macos:
388   script:
389     - uname
390     - pwd
391     - ls /
392   stage: build
393   tags:
394     - macos