Merge: doc: fixed some typos and other misc. corrections
[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   POSTGRES_HOST_AUTH_METHOD: trust
11
12 cache:
13   paths:
14     - .ccache
15     - .gradle/caches
16     - .gradle/wrapper
17   key: "$CI_JOB_NAME"
18
19 stages:
20   - build
21   - test
22   - more_test
23   - deploy
24
25 before_script:
26   - date
27   - export CCACHE_DIR=$PWD/.ccache
28   - export GRADLE_USER_HOME=$PWD/.gradle
29   - export PATH=$PWD/bin:$PATH
30   - git config --add github.oauthtoken "$GITHUB_OAUTHTOKEN" # needed for github api rate limit
31   - pwd
32   - ccache -s
33   - ccache -z
34   - ccache -M 500M
35   - du -sh .gradle || true
36   - type -a nitc nitdoc || true # is there some nit tools?
37   - "> status.txt"
38
39 after_script:
40   - export CCACHE_DIR=$PWD/.ccache
41   - ccache -s
42   - du -sh .gradle || true
43   - git status --ignored || true
44   - date
45   - tail status.txt
46
47 # BASIC JOBS ########################################################
48
49 sanity_checks:
50   stage: build
51   script:
52     - misc/jenkins/checkwhitespaces.sh | tee -a status.txt
53     - misc/jenkins/checksignedoffby.sh | tee -a status.txt
54     - misc/jenkins/checklicense.sh | tee -a status.txt
55
56 build_tools: &build_tools
57   stage: build
58   script:
59     - make 2>> status.txt
60     - nitc --version
61     - misc/jenkins/check_manpages.sh
62   artifacts:
63     paths:
64       - bin/*
65       - c_src/nitc
66       - src/version.nit
67       - src/nitc_0
68     when: always
69
70 test_some: &test_some
71   stage: test
72   dependencies:
73     - build_tools
74   script:
75     - cd tests
76     - ./search_tests_git.sh origin/master HEAD > list
77     - ./testall.sh `cat list` | tee log.txt
78     - grep -v '=>' log.txt > ../status.txt || true
79   artifacts:
80     paths:
81       - tests/errlist
82       - tests/*.xml*
83     when: always
84     reports:
85       junit: tests/*.xml
86
87 nitunit_some:
88   stage: test
89   dependencies:
90     - build_tools
91   script:
92     - git diff --name-only origin/master..HEAD -- "*.nit" "*.res" "README.*" | grep -v "^tests/\|contrib/" > list0.txt || true
93     - xargs nitls -pP < list0.txt > list.txt
94     - test -s list.txt || exit 0
95     - xargs nitunit < list.txt
96     - junit2html nitunit.xml
97   artifacts:
98     paths:
99       - nitunit.xml*
100     when: always
101     reports:
102       junit:
103         - nitunit.xml
104
105 nitpick_full:
106   stage: test
107   dependencies:
108     - build_tools
109   script:
110     - nitls lib src examples contrib
111     - nitls -Pp lib src examples | grep -v -f tests/gitlab_ci.skip > list.txt || true # filter what is skipped by tests.sh
112     - xargs nitpick < list.txt
113
114 basic_android:
115   stage: test
116   dependencies:
117     - build_tools
118   script:
119     - make -C contrib/asteronits android
120   artifacts:
121     paths:
122       - contrib/asteronits/bin/*.apk
123
124 # TEST FULL #########################################################
125
126 test_full_nitcs: &test_full_nitcs
127   stage: more_test
128   dependencies:
129     - build_tools
130   script:
131     - share/android-bdwgc/setup.sh
132     - cd tests
133     - ./testfull.sh | 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_niti:
146   stage: more_test
147   dependencies:
148     - build_tools
149   script:
150     - cd tests
151     - ./testfull.sh --engine niti | 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_nitcg:
164   stage: more_test
165   dependencies:
166     - build_tools
167   script:
168     - cd tests
169     - ./testfull.sh --engine nitcg | 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_nitce:
182   stage: more_test
183   dependencies:
184     - build_tools
185   script:
186     - cd tests
187     - ./testfull.sh --engine nitce | 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 test_full_nitcsg:
200   stage: more_test
201   dependencies:
202     - build_tools
203   script:
204     - cd tests
205     - ./testfull.sh --engine nitcsg | tee log.txt
206     - grep -v '=>' log.txt > ../status.txt || true
207   artifacts:
208     paths:
209       - tests/errlist
210       - tests/*.xml*
211       - tests/out/*.res
212       - tests/out/*.log
213     when: always
214     reports:
215       junit: tests/*.xml
216
217 # LIB, CONTRIB AND OOT ##############################################
218
219 nitunit_lib:
220   stage: more_test
221   dependencies:
222     - build_tools
223   script:
224     - nitls -Pp lib | grep -v -f tests/gitlab_ci.skip > list.txt || true # 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     - junit2html nitunit.xml
229   artifacts:
230     paths:
231       - nitunit.xml*
232     when: always
233     reports:
234       junit:
235         - nitunit.xml
236
237 nitunit_src:
238   stage: more_test
239   dependencies:
240     - build_tools
241   script:
242     - nitls -Pp src examples | grep -v -f tests/gitlab_ci.skip > list.txt || true # filter what is skipped by tests.sh
243     - xargs nitunit -v < list.txt| tee log.txt
244     - grep -e KO log.txt > status.txt || true
245     - tail -3 log.txt >> status.txt
246     - junit2html nitunit.xml
247   artifacts:
248     paths:
249       - nitunit.xml*
250     when: always
251     reports:
252       junit:
253         - nitunit.xml
254
255 test_contribs:
256   stage: more_test
257   dependencies:
258     - build_tools
259   script:
260     - misc/jenkins/check_contrib.sh all check
261     - grep 'error message' *.xml > status.txt || true
262     - test ! -s status.txt # no lines, no errors
263
264 test_contribs_android:
265   stage: more_test
266   dependencies:
267     - build_tools
268   script:
269     - misc/jenkins/check_contrib.sh android
270     - grep 'error message' *.xml > status.txt || true
271     - mkdir -p apk/debug
272     - find . -name '*.apk' -exec mv {} apk/debug/ ";"
273     - test ! -s status.txt # no lines, no errors
274     - misc/jenkins/check_contrib.sh android-release
275     - grep 'error message' *.xml > status.txt || true
276     - mkdir -p apk/release
277     - find . -name '*.apk' -exec mv {} apk/release ";"
278     - test ! -s status.txt # no lines, no errors
279   artifacts:
280     paths:
281       - "apk"
282     when: always
283
284 build_oot:
285   stage: more_test
286   dependencies:
287     - build_more_tools
288   script:
289     - cd contrib
290     - ./oot.sh all
291     - grep 'error message' *.xml > ../status.txt || true
292     # Errors are somewhat expected
293
294 # MISC ##############################################################
295
296 check_requirments:
297   stage: more_test
298   image: debian:buster
299   before_script:
300     - date # cancel the default `before_script`, an empty list does nothing
301   script: # from the README
302     - apt-get update && apt-get install --yes --no-install-recommends build-essential ccache libgc-dev libunwind-dev pkg-config
303     - make
304     - bin/nitc examples/hello_world.nit
305     - ./hello_world
306     - . misc/nit_env.sh install
307     - nitc examples/hello_world.nit
308     - ./hello_world
309     - apt-get update && apt-get install --yes --no-install-recommends graphviz libcurl4-openssl-dev libevent-dev libmongoc-dev
310     - make more
311
312 bootstrap_full:
313   stage: more_test
314   dependencies:
315     - build_tools
316   script:
317     - cd src
318     - ./full_bootstrap
319     - ./ncall.sh
320
321 bench_fast:
322   stage: more_test
323   dependencies:
324     - build_tools
325   script:
326     - cd benchmarks
327     - ./bench_engines.sh --fast --fast --html options
328     - grep -B1 'error message' *.xml | grep testcase > ../status.txt || true
329   artifacts:
330     paths:
331       - benchmarks/*.html
332       - benchmarks/*.png
333       - benchmarks/*.dat
334       - benchmarks/*.gnu
335     when: always
336
337 nitunit_manual:
338   stage: more_test
339   dependencies:
340     - build_tools
341   script:
342     - nitunit doc/manual/*.nit
343     - junit2html nitunit.xml
344   artifacts:
345     paths:
346       - nitunit.xml*
347     when: always
348     reports:
349       junit:
350         - nitunit.xml
351
352 # MORE TOOLS ########################################################
353
354 build_more_tools:
355   stage: test
356   dependencies:
357     - build_tools
358   script:
359     - make more
360     - make -C "contrib/nitcc"
361   artifacts:
362     paths:
363       - bin/*
364       - c_src/nitc
365       - src/version.nit
366       - src/nitc_0
367
368 valgrind:
369   stage: more_test
370   dependencies:
371     - build_more_tools
372   script:
373     - mkdir -p valgrind.out
374     - nitc src/nitc.nit # To warm-up the cache
375     - src/valgrind.sh --callgrind-out-file=valgrind.out/nitc.nitc.out nitc src/nitc.nit -vv
376     - callgrind_annotate valgrind.out/nitc.nitc.out > valgrind.out/nitc.nitc.txt
377     - src/valgrind.sh --callgrind-out-file=valgrind.out/niti.niti.out nit -- src/nit.nit tests/base_simple3.nit -vv
378     - callgrind_annotate valgrind.out/niti.niti.out > valgrind.out/niti.niti.txt
379   artifacts:
380     paths:
381       - valgrind.out
382
383 build_doc:
384   stage: more_test
385   dependencies:
386     - build_more_tools
387   script:
388     - nitls -r -t .
389     - nitdoc -d nitdoc.out --keep-going lib src
390   artifacts:
391     paths:
392       - nitdoc.out
393
394 build_manual:
395   stage: more_test
396   script:
397     - apt-get update && apt-get install --yes --no-install-recommends pandoc texlive texlive-latex-extra lmodern
398     - make -C doc/manual
399   artifacts:
400     paths:
401       - doc/manual/*.pdf
402       - doc/manual/*.epub
403
404 nitmetrics:
405   stage: more_test
406   dependencies:
407     - build_more_tools
408   script:
409     - mkdir -p nitmetrics.out
410     - nitmetrics --all --log --log-dir nitmetrics.out --dir nitmetrics.out --keep-going lib src | tee nitmetrics.out/metrics.txt
411   artifacts:
412     paths:
413       - nitmetrics.out
414
415 build_catalog:
416   stage: more_test
417   dependencies:
418     - build_more_tools
419   script:
420     - misc/jenkins/check_contrib.sh pre-build
421     - cd contrib
422     - ./oot.sh update
423     - ./oot.sh pre-build
424     - cd ..
425     - nitcatalog -d catalog.out lib/ examples/ contrib/ contrib/oot/
426   artifacts:
427     paths:
428       - catalog.out
429
430 build_tools_macos:
431   <<: *build_tools
432   tags:
433     - macos
434
435 test_some_macos:
436   <<: *test_some
437   tags:
438     - macos
439   dependencies:
440     - build_tools_macos
441
442 test_full_nitcs_macos:
443   <<: *test_full_nitcs
444   tags:
445     - macos
446   dependencies:
447     - build_tools_macos
448
449 bench_old:
450   stage: more_test
451   tags:
452     - perf
453   dependencies:
454     - build_tools
455   script:
456     - benchmarks/bench_old.sh
457   allow_failure: true # time is unreliable. manual check required
458   services: []
459
460 build_tools_windows:
461   stage: build
462   before_script:
463     - date
464   after_script:
465     - date
466   tags:
467     - windows
468   script:
469     - $project_dir = "$CI_PROJECT_DIR" -replace "\\", "\\\"
470     - $converted_project_dir = $(c:\msys64\usr\bin\bash -l -c "cygpath -u $project_dir")
471     - c:\msys64\usr\bin\env MSYSTEM=MINGW64 c:\msys64\usr\bin\bash -l -c "cd $converted_project_dir; make"