[gjs: 3/4] CI: enable static code analysis



commit 8ec89e0c8903645d9691ec695510104068e2b8d5
Author: Claudio André <claudioandre br gmail com>
Date:   Thu Nov 2 20:00:54 2017 -0200

    CI: enable static code analysis

 .gitlab-ci.yml  |  4 +++-
 test/test-ci.sh | 21 +++++++++++++++++----
 2 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index adc3392..c12cbff 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -32,7 +32,7 @@ before_script:
        fi'
     - $(pwd)/test/test-ci.sh GJS
 
-    # Extra testing
+    # Run extra tests
     - 'if [[ $BUILD_OPTS == *"--enable-installed-tests"* ]]; then
          $(pwd)/test/test-ci.sh GJS_EXTRA;
        fi'
@@ -55,8 +55,10 @@ fedora_gcc:
     BASE: fedora
     OS: fedora:latest
     CC: gcc
+    CPPCHECK: "yes"
     BUILD_OPTS: "--enable-ubsan"
 
+# Failure routine
 on_failure:
   stage: failure
   script:
diff --git a/test/test-ci.sh b/test/test-ci.sh
index 4130f84..ab4c34e 100755
--- a/test/test-ci.sh
+++ b/test/test-ci.sh
@@ -35,7 +35,7 @@ function do_Install_Base_Dependencies(){
                                docbook docbook-xsl libtext-csv-perl \
                                zlib1g-dev \
                                libtool libicu-dev libnspr4-dev \
-                               policykit-1 \
+                               policykit-1 cppcheck \
                                apt-file > /dev/null
         apt-file update
 
@@ -46,7 +46,7 @@ function do_Install_Base_Dependencies(){
         dnf -y -q install @c-development @development-tools clang redhat-rpm-config gnome-common 
python-devel \
                           pygobject2 dbus-python perl-Text-CSV perl-XML-Parser gettext-devel gtk-doc 
ninja-build \
                           zlib-devel libffi-devel \
-                          libtool libicu-devel nspr-devel
+                          libtool libicu-devel nspr-devel cppcheck
     else
         echo
         echo '-- Error: invalid BASE code --'
@@ -256,19 +256,32 @@ elif [[ $1 == "GJS" ]]; then
 
     # Build and test the latest commit (merged or from a PR) of Javascript Bindings for GNOME
     echo
-    echo '-- gjs build --'
-    cp -r ../gjs ~/jhbuild/checkout/gjs
+    echo '-- gjs status --'
+    cp -r ./ ~/jhbuild/checkout/gjs
+    rm -rf ~/jhbuild/checkout/gjs/jhbuild
+    rm -rf ~/jhbuild/checkout/gjs/.cache
+
     cd ~/jhbuild/checkout/gjs
     git log --pretty=format:"%h %cd %s" -1
+
+    echo '-- gjs build --'
     echo
     jhbuild make --check
 
+    if [[ $CPPCHECK == "yes" ]]; then
+        echo
+        echo '-- Code analyzer --'
+        jhbuild run --in-builddir=gjs make cppcheck
+        echo
+    fi
+
 elif [[ $1 == "GJS_EXTRA" ]]; then
     # Extra testing. It doesn't build, just run the 'Installed Tests'
     echo
     echo '-- Installed GJS tests --'
     do_Set_Env
     PATH=$PATH:~/.local/bin
+
     xvfb-run jhbuild run dbus-run-session -- gnome-desktop-testing-runner gjs
 
 else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]