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