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