Merge branch 'wip/pwithnall/coverity' into 'master'

CI support for Coverity Scan

See merge request GNOME/glib!1593
This commit is contained in:
Sebastian Dröge 2020-08-17 11:57:24 +00:00
commit fb6da5677b
34 changed files with 113 additions and 1 deletions

View File

@ -11,6 +11,7 @@ cache:
variables:
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v9"
COVERITY_IMAGE: "registry.gitlab.gnome.org/gnome/glib/coverity:v1"
DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v6"
ANDROID_IMAGE: "registry.gitlab.gnome.org/gnome/glib/android-ndk:v3"
MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v2"
@ -470,6 +471,37 @@ scan-build:
paths:
- "_scan_build/meson-logs/scanbuild"
coverity:
extends: .build-only-schedules
image: $COVERITY_IMAGE
stage: analysis
needs: []
variables:
# cov-build doesnt like GLIB_DEPRECATED_ENUMERATOR
CFLAGS: '-DGLIB_DISABLE_DEPRECATION_WARNINGS'
script:
- meson ${MESON_COMMON_OPTIONS}
--werror
--default-library=both
--prefix=$HOME/glib-installed
--libdir=lib
-Dsystemtap=true
-Ddtrace=true
-Dfam=true
-Dinstalled_tests=true
_coverity_build
- $HOME/cov-analysis-linux64-*/bin/cov-build --dir cov-int ninja -C _coverity_build
- tar cfz cov-int.tar.gz cov-int
- curl https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
--form token=$COVERITY_SCAN_TOKEN --form email=$GITLAB_USER_EMAIL
--form file=@cov-int.tar.gz --form version="$CI_COMMIT_SHA"
--form description="$CI_COMMIT_SHA / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID"
artifacts:
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- "cov-int/build-log.txt"
pages:
stage: deploy
only:

View File

@ -8,7 +8,10 @@ GitLab CI jobs run in a Docker image, defined here. To update that image
1. Edit `.gitlab-ci/Dockerfile` with the changes you want
1. Run `.gitlab-ci/run-docker.sh build --base=debian-stable --base-version=1` to
build the new image (bump the version from the latest listed for that `base`
on https://gitlab.gnome.org/GNOME/glib/container_registry)
on https://gitlab.gnome.org/GNOME/glib/container_registry). If rebuilding the
`coverity.Dockerfile` image, youll need to have access to [Coverity Scan][cs]
and will need to specify your project name and access token as the environment
variables `COVERITY_SCAN_PROJECT_NAME` and `COVERITY_SCAN_TOKEN`.
1. Run `.gitlab-ci/run-docker.sh push --base=debian-stable --base-version=1` to
upload the new image to the GNOME GitLab Docker registry
* If this is the first time you're doing this, you'll need to log into the
@ -21,3 +24,4 @@ GitLab CI jobs run in a Docker image, defined here. To update that image
image
[pat]: https://gitlab.gnome.org/profile/personal_access_tokens
[cs]: https://scan.coverity.com/

View File

@ -0,0 +1,11 @@
FROM registry.gitlab.gnome.org/gnome/glib/fedora:v9
ARG COVERITY_SCAN_PROJECT_NAME
ARG COVERITY_SCAN_TOKEN
RUN curl https://scan.coverity.com/download/linux64 \
-o /tmp/cov-analysis-linux64.tgz \
--form project="${COVERITY_SCAN_PROJECT_NAME}" \
--form token="${COVERITY_SCAN_TOKEN}" \
&& tar xfz /tmp/cov-analysis-linux64.tgz \
&& rm /tmp/cov-analysis-linux64.tgz

View File

@ -103,6 +103,8 @@ if [ $build == 1 ]; then
echo -e "\e[1;32mBUILDING\e[0m: ${base} as ${TAG}"
$SUDO_CMD docker build \
--build-arg HOST_USER_ID="$UID" \
--build-arg COVERITY_SCAN_PROJECT_NAME="${COVERITY_SCAN_PROJECT_NAME}" \
--build-arg COVERITY_SCAN_TOKEN="${COVERITY_SCAN_TOKEN}" \
--tag "${TAG}" \
--file "${base}.Dockerfile" .
exit $?

View File

@ -26,7 +26,9 @@
/* For the #GDesktopAppInfoLookup macros; since macro deprecation is implemented
* in the preprocessor, we need to define this before including glib.h*/
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <errno.h>
#include <string.h>

View File

@ -22,7 +22,9 @@
/* For the #GDesktopAppInfoLookup macros; since macro deprecation is implemented
* in the preprocessor, we need to define this before including glib.h*/
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <string.h>

View File

@ -16,7 +16,9 @@
#include "config.h"
/* we know we are deprecated here, no need for warnings */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include "gallocator.h"

View File

@ -29,7 +29,9 @@
#include "config.h"
/* we know we are deprecated here, no need for warnings */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include "gcache.h"

View File

@ -29,7 +29,9 @@
#include "config.h"
/* we know we are deprecated here, no need for warnings */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include "gcompletion.h"

View File

@ -30,7 +30,9 @@
#include "config.h"
/* we know we are deprecated here, no need for warnings */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include "grel.h"

View File

@ -22,7 +22,9 @@
#include "config.h"
/* we know we are deprecated here, no need for warnings */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include "gmessages.h"
#include "gslice.h"

View File

@ -25,7 +25,9 @@
#include "config.h"
/* we know we are deprecated here, no need for warnings */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include "gtrashstack.h"

View File

@ -10,7 +10,9 @@
* See the included COPYING file for more information.
*/
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <glib.h>

View File

@ -21,7 +21,9 @@
*/
/* We are testing some deprecated APIs here */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <glib.h>

View File

@ -15,7 +15,9 @@
*/
/* We are testing some deprecated APIs here */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <glib.h>

View File

@ -21,7 +21,9 @@
*/
/* We are testing some deprecated APIs here */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <glib.h>

View File

@ -2,7 +2,9 @@
#undef G_LOG_DOMAIN
/* We are testing some deprecated APIs here */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include "config.h"

View File

@ -24,7 +24,9 @@
#include <errno.h>
/* We are testing some deprecated APIs here */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <glib.h>

View File

@ -1,4 +1,6 @@
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <glib.h>
#include <string.h>

View File

@ -21,7 +21,9 @@
*/
/* We are testing some deprecated APIs here */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <glib.h>

View File

@ -21,7 +21,9 @@
*/
/* We are testing some deprecated APIs here */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <glib.h>

View File

@ -21,7 +21,9 @@
*/
/* We are testing some deprecated APIs here */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <glib.h>

View File

@ -21,7 +21,9 @@
*/
/* We are testing some deprecated APIs here */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <glib.h>

View File

@ -19,7 +19,9 @@
* if advised of the possibility of such damage.
*/
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#define _XOPEN_SOURCE 600
#include <ctype.h>

View File

@ -20,7 +20,9 @@
*/
/* We are testing some deprecated APIs here */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <stdio.h>
#include <string.h>

View File

@ -26,7 +26,9 @@
#undef G_LOG_DOMAIN
/* We are testing some deprecated APIs here */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <stdio.h>
#include <string.h>

View File

@ -23,7 +23,9 @@
*/
/* We are testing some deprecated APIs here */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <locale.h>

View File

@ -21,7 +21,9 @@
* Author: Matthias Clasen
*/
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include "glib.h"
#include "glib-private.h"

View File

@ -20,7 +20,9 @@
#include <string.h>
/* for GValueArray */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include "gboxed.h"
#include "gclosure.h"

View File

@ -24,7 +24,9 @@
#include <string.h>
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include "gparamspecs.h"
#include "gtype-private.h"

View File

@ -1,4 +1,6 @@
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <glib-object.h>

View File

@ -1,4 +1,7 @@
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <glib-object.h>
#include <stdlib.h>

View File

@ -1,5 +1,7 @@
/* We are testing some deprecated APIs here */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <glib-object.h>

View File

@ -19,7 +19,11 @@
* otherwise) arising in any way out of the use of this software, even
* if advised of the possibility of such damage.
*/
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include <glib.h>
#include <glib-object.h>