[gjs: 7/15] CI: Switch cppcheck job to a ready-made Docker image



commit 20b82639f801fa2535a9b8d5d934ffc4e76f0c28
Author: Philip Chimento <philip chimento gmail com>
Date:   Sat Sep 7 20:38:06 2019 -0700

    CI: Switch cppcheck job to a ready-made Docker image
    
    Similar to the eslint image, there is also a cppcheck image on DockerHub
    that we can use for this job.

 .gitlab-ci.yml                               | 16 +++++++++-------
 test/extra/Dockerfile.fedora.static-analysis |  2 +-
 test/test-ci.sh                              | 17 -----------------
 3 files changed, 10 insertions(+), 25 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 35c2f698..10bc25d5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -190,15 +190,17 @@ pages:
 #              Static Analyzers             #
 #############################################
 cppcheck:
-  <<: *build
+  when: on_success
+  image: uilianries/docker-cppcheck
   stage: source_check
-  image: registry.gitlab.gnome.org/gnome/gjs:fedora.static-analysis
-  variables:
-    TASK_ID: "cppcheck"
-    CODECHECK: "CPPCHECK"
+  script:
+    - cppcheck . -v -f -q --error-exitcode=1 --inline-suppr --enable=warning,performance,portability
   except:
-    - schedules
-    - tags
+    refs:
+      - schedules
+      - tags
+    variables:
+      - $CI_COMMIT_MESSAGE =~ /\[skip cppcheck\]/
 
 cpplint:
   <<: *build
diff --git a/test/extra/Dockerfile.fedora.static-analysis b/test/extra/Dockerfile.fedora.static-analysis
index 7beeefca..05b3d60a 100644
--- a/test/extra/Dockerfile.fedora.static-analysis
+++ b/test/extra/Dockerfile.fedora.static-analysis
@@ -6,7 +6,7 @@ LABEL version="1.0"
 LABEL description="Docker image to run CI for GNOME GJS (JavaScript bindings for GNOME)."
 
 RUN dnf -y --nogpgcheck upgrade && \
-    dnf -y install git cppcheck python-devel && \
+    dnf -y install git python-devel && \
     mkdir -p /cwd && \
     pip install cpplint && \
     dnf -y clean all && \
diff --git a/test/test-ci.sh b/test/test-ci.sh
index d18b321e..3ae47a39 100755
--- a/test/test-ci.sh
+++ b/test/test-ci.sh
@@ -231,23 +231,6 @@ elif [[ $1 == "GJS_COVERAGE" ]]; then
     sed -e 's/<[^>]*>//g' "$save_dir"/coverage/index.html | tr -d ' \t' | grep -A3 -P '^Lines:$'  | tr '\n' 
' '; echo
     echo '-----------------------------------------'
 
-elif [[ $1 == "CPPCHECK" && "$log_message" != *'[skip cppcheck]'* ]]; then
-    do_Print_Labels 'Static code analyzer report '
-
-    cppcheck --inline-suppr --enable=warning,performance,portability,information,missingInclude --force -q . 
2>&1 | \
-        tee "$save_dir"/analysis/current-report.txt | sed -E 's/:[0-9]+]/:LINE]/g' > /cwd/current-report.txt
-    cat "$save_dir"/analysis/current-report.txt
-    echo
-
-    # Get the code committed at upstream master
-    do_Get_Upstream_Master "cppCheck"
-    cppcheck --inline-suppr --enable=warning,performance,portability,information,missingInclude --force -q . 
2>&1 | \
-        tee "$save_dir"/analysis/master-report.txt | sed -E 's/:[0-9]+]/:LINE]/g' > /cwd/master-report.txt
-    echo
-
-    # Compare the report with master and fail if new warnings are found
-    do_Compare_With_Upstream_Master "cppCheck"
-
 elif [[ $1 == "CPPLINT"  && "$log_message" != *'[skip cpplint]'* ]]; then
     do_Print_Labels 'C/C++ Linter report '
 


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