From ddf407eb10f6fbc07cb14b3edf34efa5df62be90 Mon Sep 17 00:00:00 2001 From: Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de> Date: Mon, 13 Jan 2025 13:51:36 +0100 Subject: [PATCH] ci: check whether all build artifacts are gitignored --- .gitlab-ci.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9f06b16f..54eabffd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -129,7 +129,7 @@ include: before_script: - set -euo pipefail - module purge - - module load gcc/11.2.0-gcc-11.2.0 + - module load git gcc/11.2.0-gcc-11.2.0 - | # Install libcheck if test ! -d "${LIBCHECK_ROOT}"; then @@ -165,6 +165,24 @@ include: exit 1 } rm -rf "${BUILD_LOG}" "${compiler_warnings}" + - | + # Check if there are untracked files + untracked_files=$( \ + git -C "${CI_PROJECT_DIR}" \ + -c core.excludesfile= \ + ls-files --others \ + --exclude-standard \ + --exclude="${LIBCHECK_ROOT#"${CI_PROJECT_DIR}"}" \ + --exclude="${INSTALL_PREFIX#"${CI_PROJECT_DIR}"}" \ + ) + test -z "${untracked_files}" || { + printf "${RED}The job produced unexpected files:\n${untracked_files}\n\ + If the files above are CI-specific, please, update the \ + '${CI_CONFIG_PATH}' file either to remove the files before running this \ + check or to exclude them from the check. Otherwise, update the \ + '.gitignore' file.\n${DEFAULT}" + exit 1 + } rules: - if: $CI_PIPELINE_SOURCE == "web" when: manual -- GitLab