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