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