From 2dfd9518e1184d32a240ac351a7fbc76fdecfda7 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 3 Apr 2024 23:21:31 +0100 Subject: [PATCH] ci: Exclude tests from scan-build analysis runs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They cause too much noise at the moment. I want to make scan-build messages fatal, and with 66 of 238 reports coming from the tests, that’s not currently feasible. Signed-off-by: Philip Withnall Helps: #1767 --- .gitlab-ci.yml | 12 +++++++++++- .gitlab-ci/scan-build.sh | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 .gitlab-ci/scan-build.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f8dc428c3..767c156e0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -725,6 +725,16 @@ scan-build: image: $FEDORA_IMAGE stage: analysis needs: [] + variables: + # FIXME: Eventually we want static analysis on the tests, for code quality, + # but for the moment it’s just busywork. + SCAN_BUILD_FLAGS: >- + --exclude gio/tests/ + --exclude girepository/tests/ + --exclude glib/tests/ + --exclude gmodule/tests/ + --exclude gobject/tests/ + --exclude gthread/tests/ script: - meson setup ${MESON_COMMON_OPTIONS} --werror @@ -737,7 +747,7 @@ scan-build: -Dinstalled_tests=true -Dintrospection=enabled _scan_build - - ninja -C _scan_build scan-build + - SCANBUILD="$(pwd)/.gitlab-ci/scan-build.sh" ninja -C _scan_build scan-build artifacts: name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}" when: always diff --git a/.gitlab-ci/scan-build.sh b/.gitlab-ci/scan-build.sh new file mode 100755 index 000000000..23fc3b979 --- /dev/null +++ b/.gitlab-ci/scan-build.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# +# Copyright 2024 GNOME Foundation, Inc. +# +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# Original author: Philip Withnall + +set -eu + +# This script just exists so that we can set the scan-build flags in +# .gitlab-ci.yml and pass them into Meson’s `scan-build` target. + +# shellcheck disable=SC2086 +exec scan-build ${SCAN_BUILD_FLAGS:-} "$@" \ No newline at end of file