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