gitlabci: no auth for postgress in tests
[nit.git] / .gitlab-ci.yml
index 0d94fd3..398ed14 100644 (file)
@@ -7,6 +7,7 @@ services:
 
 variables:
   NEO4J_AUTH: none
+  POSTGRES_HOST_AUTH_METHOD: trust
 
 cache:
   paths:
@@ -29,6 +30,7 @@ before_script:
   - git config --add github.oauthtoken "$GITHUB_OAUTHTOKEN" # needed for github api rate limit
   - pwd
   - ccache -s
+  - ccache -z
   - ccache -M 500M
   - du -sh .gradle || true
   - type -a nitc nitdoc || true # is there some nit tools?
@@ -38,7 +40,7 @@ after_script:
   - export CCACHE_DIR=$PWD/.ccache
   - ccache -s
   - du -sh .gradle || true
-  - git status --ignored
+  - git status --ignored || true
   - date
   - tail status.txt
 
@@ -51,7 +53,7 @@ sanity_checks:
     - misc/jenkins/checksignedoffby.sh | tee -a status.txt
     - misc/jenkins/checklicense.sh | tee -a status.txt
 
-build_tools:
+build_tools: &build_tools
   stage: build
   script:
     - make 2>> status.txt
@@ -65,7 +67,7 @@ build_tools:
       - src/nitc_0
     when: always
 
-test_some:
+test_some: &test_some
   stage: test
   dependencies:
     - build_tools
@@ -77,7 +79,7 @@ test_some:
   artifacts:
     paths:
       - tests/errlist
-      - tests/*.xml
+      - tests/*.xml*
     when: always
     reports:
       junit: tests/*.xml
@@ -87,9 +89,11 @@ nitunit_some:
   dependencies:
     - build_tools
   script:
-    - git diff --name-only origin/master..HEAD -- "*.nit" "*.res" "README.*" | grep -v "^tests/" > list0.txt || true
+    - git diff --name-only origin/master..HEAD -- "*.nit" "*.res" "README.*" | grep -v "^tests/\|contrib/" > list0.txt || true
     - xargs nitls -pP < list0.txt > list.txt
+    - test -s list.txt || exit 0
     - xargs nitunit < list.txt
+    - junit2html nitunit.xml
   artifacts:
     paths:
       - nitunit.xml*
@@ -119,11 +123,12 @@ basic_android:
 
 # TEST FULL #########################################################
 
-test_full_nitcs:
+test_full_nitcs: &test_full_nitcs
   stage: more_test
   dependencies:
     - build_tools
   script:
+    - share/android-bdwgc/setup.sh
     - cd tests
     - ./testfull.sh | tee log.txt
     - grep -v '=>' log.txt > ../status.txt || true
@@ -220,6 +225,7 @@ nitunit_lib:
     - xargs nitunit -v < list.txt| tee log.txt
     - grep -e KO log.txt > status.txt || true
     - tail -3 log.txt >> status.txt
+    - junit2html nitunit.xml
   artifacts:
     paths:
       - nitunit.xml*
@@ -237,6 +243,7 @@ nitunit_src:
     - xargs nitunit -v < list.txt| tee log.txt
     - grep -e KO log.txt > status.txt || true
     - tail -3 log.txt >> status.txt
+    - junit2html nitunit.xml
   artifacts:
     paths:
       - nitunit.xml*
@@ -253,7 +260,6 @@ test_contribs:
     - misc/jenkins/check_contrib.sh all check
     - grep 'error message' *.xml > status.txt || true
     - test ! -s status.txt # no lines, no errors
-  allow_failure: true
 
 test_contribs_android:
   stage: more_test
@@ -262,8 +268,13 @@ test_contribs_android:
   script:
     - misc/jenkins/check_contrib.sh android
     - grep 'error message' *.xml > status.txt || true
-    - mkdir -p apk
-    - find . -name '*.apk' -exec cp {} apk/ ";"
+    - mkdir -p apk/debug
+    - find . -name '*.apk' -exec mv {} apk/debug/ ";"
+    - test ! -s status.txt # no lines, no errors
+    - misc/jenkins/check_contrib.sh android-release
+    - grep 'error message' *.xml > status.txt || true
+    - mkdir -p apk/release
+    - find . -name '*.apk' -exec mv {} apk/release ";"
     - test ! -s status.txt # no lines, no errors
   artifacts:
     paths:
@@ -278,11 +289,26 @@ build_oot:
     - cd contrib
     - ./oot.sh all
     - grep 'error message' *.xml > ../status.txt || true
-    - test ! -s ../status.txt # no lines, no errors
-  allow_failure: true
+    # Errors are somewhat expected
 
 # MISC ##############################################################
 
+check_requirments:
+  stage: more_test
+  image: debian:buster
+  before_script:
+    - date # cancel the default `before_script`, an empty list does nothing
+  script: # from the README
+    - apt-get update && apt-get install --yes --no-install-recommends build-essential ccache libgc-dev libunwind-dev pkg-config
+    - make
+    - bin/nitc examples/hello_world.nit
+    - ./hello_world
+    - . misc/nit_env.sh install
+    - nitc examples/hello_world.nit
+    - ./hello_world
+    - apt-get update && apt-get install --yes --no-install-recommends graphviz libcurl4-openssl-dev libevent-dev libmongoc-dev
+    - make more
+
 bootstrap_full:
   stage: more_test
   dependencies:
@@ -308,6 +334,20 @@ bench_fast:
       - benchmarks/*.gnu
     when: always
 
+nitunit_manual:
+  stage: more_test
+  dependencies:
+    - build_tools
+  script:
+    - nitunit doc/manual/*.nit
+    - junit2html nitunit.xml
+  artifacts:
+    paths:
+      - nitunit.xml*
+    when: always
+    reports:
+      junit:
+        - nitunit.xml
 
 # MORE TOOLS ########################################################
 
@@ -325,6 +365,21 @@ build_more_tools:
       - src/version.nit
       - src/nitc_0
 
+valgrind:
+  stage: more_test
+  dependencies:
+    - build_more_tools
+  script:
+    - mkdir -p valgrind.out
+    - nitc src/nitc.nit # To warm-up the cache
+    - src/valgrind.sh --callgrind-out-file=valgrind.out/nitc.nitc.out nitc src/nitc.nit -vv
+    - callgrind_annotate valgrind.out/nitc.nitc.out > valgrind.out/nitc.nitc.txt
+    - src/valgrind.sh --callgrind-out-file=valgrind.out/niti.niti.out nit -- src/nit.nit tests/base_simple3.nit -vv
+    - callgrind_annotate valgrind.out/niti.niti.out > valgrind.out/niti.niti.txt
+  artifacts:
+    paths:
+      - valgrind.out
+
 build_doc:
   stage: more_test
   dependencies:
@@ -336,6 +391,27 @@ build_doc:
     paths:
       - nitdoc.out
 
+build_manual:
+  stage: more_test
+  script:
+    - apt-get update && apt-get install --yes --no-install-recommends pandoc texlive texlive-latex-extra lmodern
+    - make -C doc/manual
+  artifacts:
+    paths:
+      - doc/manual/*.pdf
+      - doc/manual/*.epub
+
+nitmetrics:
+  stage: more_test
+  dependencies:
+    - build_more_tools
+  script:
+    - mkdir -p nitmetrics.out
+    - nitmetrics --all --log --log-dir nitmetrics.out --dir nitmetrics.out --keep-going lib src | tee nitmetrics.out/metrics.txt
+  artifacts:
+    paths:
+      - nitmetrics.out
+
 build_catalog:
   stage: more_test
   dependencies:
@@ -347,17 +423,49 @@ build_catalog:
     - ./oot.sh pre-build
     - cd ..
     - nitcatalog -d catalog.out lib/ examples/ contrib/ contrib/oot/
-  dependencies:
-    - build_more_tools
   artifacts:
     paths:
       - catalog.out
 
-.test_macos:
+build_tools_macos:
+  <<: *build_tools
+  tags:
+    - macos
+
+test_some_macos:
+  <<: *test_some
+  tags:
+    - macos
+  dependencies:
+    - build_tools_macos
+
+test_full_nitcs_macos:
+  <<: *test_full_nitcs
+  tags:
+    - macos
+  dependencies:
+    - build_tools_macos
+
+bench_old:
+  stage: more_test
+  tags:
+    - perf
+  dependencies:
+    - build_tools
   script:
-    - uname
-    - pwd
-    - ls /
+    - benchmarks/bench_old.sh
+  allow_failure: true # time is unreliable. manual check required
+  services: []
+
+build_tools_windows:
   stage: build
+  before_script:
+    - date
+  after_script:
+    - date
   tags:
-    - macos
+    - windows
+  script:
+    - $project_dir = "$CI_PROJECT_DIR" -replace "\\", "\\\"
+    - $converted_project_dir = $(c:\msys64\usr\bin\bash -l -c "cygpath -u $project_dir")
+    - c:\msys64\usr\bin\env MSYSTEM=MINGW64 c:\msys64\usr\bin\bash -l -c "cd $converted_project_dir; make"