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