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