From d3035d57036fa852616ccbb865652aae2a77d38c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 12 Feb 2025 19:33:00 +0100 Subject: [PATCH] ci: Use rules to control when to run images build --- .gitlab-ci.yml | 75 ++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 39 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3d36552a..2fbbc41d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -57,11 +57,16 @@ image: $FEDORA_IMAGE script: - ./.ci/check-abi ${LAST_ABI_BREAK} $(git rev-parse HEAD) +.standard_job: + rules: + - when: on_success + - if: $CI_PIPELINE_SOURCE == "schedule" + when: never + build: stage: build - except: - variables: - - $CI_PIPELINE_SOURCE == "schedule" + extends: + - .standard_job variables: driver: virtual_image <<: *build_one_driver @@ -76,9 +81,8 @@ build: test: stage: test - except: - variables: - - $CI_PIPELINE_SOURCE == "schedule" + extends: + - .standard_job script: - meson setup _build --werror -Ddrivers=all -Db_coverage=true - meson test -C _build --print-errorlogs --no-stdsplit --timeout-multiplier 3 @@ -100,9 +104,8 @@ test: test_valgrind: stage: test - except: - variables: - - $CI_PIPELINE_SOURCE == "schedule" + extends: + - .standard_job script: - meson setup _build -Ddrivers=all - meson compile -C _build @@ -119,9 +122,8 @@ test_valgrind: test_installed: stage: test - except: - variables: - - $CI_PIPELINE_SOURCE == "schedule" + extends: + - .standard_job script: - meson setup _build --prefix=/usr -Ddrivers=all - meson install -C _build @@ -143,9 +145,8 @@ test_installed: test_scan_build: stage: test - except: - variables: - - $CI_PIPELINE_SOURCE == "schedule" + extends: + - .standard_job allow_failure: true script: - meson setup _build -Ddrivers=all @@ -160,9 +161,8 @@ test_scan_build: test_indent: stage: check-source - except: - variables: - - $CI_PIPELINE_SOURCE == "schedule" + extends: + - .standard_job script: - scripts/uncrustify.sh - git diff @@ -170,9 +170,8 @@ test_indent: test_unsupported_list: stage: check-source - except: - variables: - - $CI_PIPELINE_SOURCE == "schedule" + extends: + - .standard_job allow_failure: true script: - tests/hwdb-check-unsupported.py @@ -192,7 +191,7 @@ flatpak: - if: '$CI_PROJECT_PATH != "libfprint/libfprint"' when: manual allow_failure: true - - if: '$CI_PIPELINE_SOURCE == "schedule"' + - if: $CI_PIPELINE_SOURCE == "schedule" when: never - if: '$CI_COMMIT_BRANCH == "master"' allow_failure: true @@ -213,9 +212,6 @@ flatpak: .container_fedora_build_base: extends: .fdo.container-build@fedora stage: image-build - only: - variables: - - $CI_PIPELINE_SOURCE == "never" variables: GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image # a list of packages to install @@ -226,6 +222,8 @@ flatpak: libudev-devel FDO_DISTRIBUTION_EXEC: | $LIBFPRINT_EXEC + rules: + - when: never .container_fedora_build_forced: variables: @@ -235,28 +233,27 @@ container_fedora_build_schedule: extends: - .container_fedora_build_base - .container_fedora_build_forced - only: - variables: - - $CI_PIPELINE_SOURCE == "schedule" && $CRON_TASK == "BUILD_CI_IMAGES" + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" && $CRON_TASK == "BUILD_CI_IMAGES" + when: always container_fedora_build_manual: extends: - .container_fedora_build_base - .container_fedora_build_forced - only: - variables: - - $LIBFPRINT_CI_ACTION == "build-image" + rules: + - if: $LIBFPRINT_CI_ACTION == "build-image" + when: always container_fedora_build_on_deps_changed: extends: .container_fedora_build_base - only: - variables: - - $CI_PROJECT_NAMESPACE == "libfprint" && $CI_PIPELINE_SOURCE != "schedule" - refs: - - branches - - merge_requests - changes: - - .gitlab-ci/libfprint-image-variables.yaml + rules: + - if: $CI_PROJECT_NAMESPACE == "libfprint" && $CI_PIPELINE_SOURCE != "schedule" + changes: + compare_to: 'refs/heads/master' + paths: + - '.gitlab-ci/libfprint-image-variables.yaml' + - '.gitlab-ci/libfprint-templates.yaml' pages: image: alpine:latest