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