ci: tests for macOS on Gitlab CI
[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: &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: &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: &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
257 test_contribs_android:
258   stage: more_test
259   dependencies:
260     - build_tools
261   script:
262     - misc/jenkins/check_contrib.sh android
263     - grep 'error message' *.xml > status.txt || true
264     - mkdir -p apk/debug
265     - find . -name '*.apk' -exec mv {} apk/debug/ ";"
266     - test ! -s status.txt # no lines, no errors
267     - misc/jenkins/check_contrib.sh android-release
268     - grep 'error message' *.xml > status.txt || true
269     - mkdir -p apk/release
270     - find . -name '*.apk' -exec mv {} apk/release ";"
271     - test ! -s status.txt # no lines, no errors
272   artifacts:
273     paths:
274       - "apk"
275     when: always
276
277 build_oot:
278   stage: more_test
279   dependencies:
280     - build_more_tools
281   script:
282     - cd contrib
283     - ./oot.sh all
284     - grep 'error message' *.xml > ../status.txt || true
285     # Errors are somewhat expected
286
287 # MISC ##############################################################
288
289 bootstrap_full:
290   stage: more_test
291   dependencies:
292     - build_tools
293   script:
294     - cd src
295     - ./full_bootstrap
296     - ./ncall.sh
297
298 bench_fast:
299   stage: more_test
300   dependencies:
301     - build_tools
302   script:
303     - cd benchmarks
304     - ./bench_engines.sh --fast --fast --html options
305     - grep -B1 'error message' *.xml | grep testcase > ../status.txt || true
306   artifacts:
307     paths:
308       - benchmarks/*.html
309       - benchmarks/*.png
310       - benchmarks/*.dat
311       - benchmarks/*.gnu
312     when: always
313
314
315 # MORE TOOLS ########################################################
316
317 build_more_tools:
318   stage: test
319   dependencies:
320     - build_tools
321   script:
322     - make more
323     - make -C "contrib/nitcc"
324   artifacts:
325     paths:
326       - bin/*
327       - c_src/nitc
328       - src/version.nit
329       - src/nitc_0
330
331 build_doc:
332   stage: more_test
333   dependencies:
334     - build_more_tools
335   script:
336     - nitls -r -t .
337     - nitdoc -d nitdoc.out --keep-going lib src
338   artifacts:
339     paths:
340       - nitdoc.out
341
342 build_catalog:
343   stage: more_test
344   dependencies:
345     - build_more_tools
346   script:
347     - misc/jenkins/check_contrib.sh pre-build
348     - cd contrib
349     - ./oot.sh update
350     - ./oot.sh pre-build
351     - cd ..
352     - nitcatalog -d catalog.out lib/ examples/ contrib/ contrib/oot/
353   dependencies:
354     - build_more_tools
355   artifacts:
356     paths:
357       - catalog.out
358
359 build_tools_macos:
360   <<: *build_tools
361   tags:
362     - macos
363
364 test_some_macos:
365   <<: *test_some
366   tags:
367     - macos
368   dependencies:
369     - build_tools_macos
370
371 test_full_nitcs_macos:
372   <<: *test_full_nitcs
373   tags:
374     - macos
375   dependencies:
376     - build_tools_macos