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