doc: Commands tests use `test_frontend`
[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: &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: &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: &test_full_nitcs
124   stage: more_test
125   dependencies:
126     - build_tools
127   script:
128     - share/android-bdwgc/setup.sh
129     - cd tests
130     - ./testfull.sh | tee log.txt
131     - grep -v '=>' log.txt > ../status.txt || true
132   artifacts:
133     paths:
134       - tests/errlist
135       - tests/*.xml*
136       - tests/out/*.res
137       - tests/out/*.log
138     when: always
139     reports:
140       junit: tests/*.xml
141
142 test_full_niti:
143   stage: more_test
144   dependencies:
145     - build_tools
146   script:
147     - cd tests
148     - ./testfull.sh --engine niti | tee log.txt
149     - grep -v '=>' log.txt > ../status.txt || true
150   artifacts:
151     paths:
152       - tests/errlist
153       - tests/*.xml*
154       - tests/out/*.res
155       - tests/out/*.log
156     when: always
157     reports:
158       junit: tests/*.xml
159
160 test_full_nitcg:
161   stage: more_test
162   dependencies:
163     - build_tools
164   script:
165     - cd tests
166     - ./testfull.sh --engine nitcg | tee log.txt
167     - grep -v '=>' log.txt > ../status.txt || true
168   artifacts:
169     paths:
170       - tests/errlist
171       - tests/*.xml*
172       - tests/out/*.res
173       - tests/out/*.log
174     when: always
175     reports:
176       junit: tests/*.xml
177
178 test_full_nitce:
179   stage: more_test
180   dependencies:
181     - build_tools
182   script:
183     - cd tests
184     - ./testfull.sh --engine nitce | tee log.txt
185     - grep -v '=>' log.txt > ../status.txt || true
186   artifacts:
187     paths:
188       - tests/errlist
189       - tests/*.xml*
190       - tests/out/*.res
191       - tests/out/*.log
192     when: always
193     reports:
194       junit: tests/*.xml
195
196 test_full_nitcsg:
197   stage: more_test
198   dependencies:
199     - build_tools
200   script:
201     - cd tests
202     - ./testfull.sh --engine nitcsg | tee log.txt
203     - grep -v '=>' log.txt > ../status.txt || true
204   artifacts:
205     paths:
206       - tests/errlist
207       - tests/*.xml*
208       - tests/out/*.res
209       - tests/out/*.log
210     when: always
211     reports:
212       junit: tests/*.xml
213
214 # LIB, CONTRIB AND OOT ##############################################
215
216 nitunit_lib:
217   stage: more_test
218   dependencies:
219     - build_tools
220   script:
221     - nitls -Pp lib | grep -v -f tests/gitlab_ci.skip > list.txt || true # filter what is skipped by tests.sh
222     - xargs nitunit -v < list.txt| tee log.txt
223     - grep -e KO log.txt > status.txt || true
224     - tail -3 log.txt >> status.txt
225     - junit2html nitunit.xml
226   artifacts:
227     paths:
228       - nitunit.xml*
229     when: always
230     reports:
231       junit:
232         - nitunit.xml
233
234 nitunit_src:
235   stage: more_test
236   dependencies:
237     - build_tools
238   script:
239     - nitls -Pp src examples | grep -v -f tests/gitlab_ci.skip > list.txt || true # filter what is skipped by tests.sh
240     - xargs nitunit -v < list.txt| tee log.txt
241     - grep -e KO log.txt > status.txt || true
242     - tail -3 log.txt >> status.txt
243     - junit2html nitunit.xml
244   artifacts:
245     paths:
246       - nitunit.xml*
247     when: always
248     reports:
249       junit:
250         - nitunit.xml
251
252 test_contribs:
253   stage: more_test
254   dependencies:
255     - build_tools
256   script:
257     - misc/jenkins/check_contrib.sh all check
258     - grep 'error message' *.xml > status.txt || true
259     - test ! -s status.txt # no lines, no errors
260
261 test_contribs_android:
262   stage: more_test
263   dependencies:
264     - build_tools
265   script:
266     - misc/jenkins/check_contrib.sh android
267     - grep 'error message' *.xml > status.txt || true
268     - mkdir -p apk/debug
269     - find . -name '*.apk' -exec mv {} apk/debug/ ";"
270     - test ! -s status.txt # no lines, no errors
271     - misc/jenkins/check_contrib.sh android-release
272     - grep 'error message' *.xml > status.txt || true
273     - mkdir -p apk/release
274     - find . -name '*.apk' -exec mv {} apk/release ";"
275     - test ! -s status.txt # no lines, no errors
276   artifacts:
277     paths:
278       - "apk"
279     when: always
280
281 build_oot:
282   stage: more_test
283   dependencies:
284     - build_more_tools
285   script:
286     - cd contrib
287     - ./oot.sh all
288     - grep 'error message' *.xml > ../status.txt || true
289     # Errors are somewhat expected
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
318
319 # MORE TOOLS ########################################################
320
321 build_more_tools:
322   stage: test
323   dependencies:
324     - build_tools
325   script:
326     - make more
327     - make -C "contrib/nitcc"
328   artifacts:
329     paths:
330       - bin/*
331       - c_src/nitc
332       - src/version.nit
333       - src/nitc_0
334
335 valgrind:
336   stage: more_test
337   dependencies:
338     - build_more_tools
339   script:
340     - mkdir -p valgrind.out
341     - nitc src/nitc.nit # To warm-up the cache
342     - src/valgrind.sh --callgrind-out-file=valgrind.out/nitc.nitc.out nitc src/nitc.nit -vv
343     - callgrind_annotate valgrind.out/nitc.nitc.out > valgrind.out/nitc.nitc.txt
344     - src/valgrind.sh --callgrind-out-file=valgrind.out/niti.niti.out nit -- src/nit.nit tests/base_simple3.nit -vv
345     - callgrind_annotate valgrind.out/niti.niti.out > valgrind.out/niti.niti.txt
346   artifacts:
347     paths:
348       - valgrind.out
349
350 build_doc:
351   stage: more_test
352   dependencies:
353     - build_more_tools
354   script:
355     - nitls -r -t .
356     - nitdoc -d nitdoc.out --keep-going lib src
357   artifacts:
358     paths:
359       - nitdoc.out
360
361 nitmetrics:
362   stage: more_test
363   dependencies:
364     - build_more_tools
365   script:
366     - nitmetrics --all --log --log-dir nitmetrics.out --dir nitmetrics.out --keep-going lib src
367   artifacts:
368     paths:
369       - nitmetrics.out
370
371 build_catalog:
372   stage: more_test
373   dependencies:
374     - build_more_tools
375   script:
376     - misc/jenkins/check_contrib.sh pre-build
377     - cd contrib
378     - ./oot.sh update
379     - ./oot.sh pre-build
380     - cd ..
381     - nitcatalog -d catalog.out lib/ examples/ contrib/ contrib/oot/
382   dependencies:
383     - build_more_tools
384   artifacts:
385     paths:
386       - catalog.out
387
388 build_tools_macos:
389   <<: *build_tools
390   tags:
391     - macos
392
393 test_some_macos:
394   <<: *test_some
395   tags:
396     - macos
397   dependencies:
398     - build_tools_macos
399
400 test_full_nitcs_macos:
401   <<: *test_full_nitcs
402   tags:
403     - macos
404   dependencies:
405     - build_tools_macos