ci: Use rules to control when to run images build

This commit is contained in:
Marco Trevisan (Treviño)
2025-02-12 19:33:00 +01:00
committed by Marco Trevisan
parent 042365dbec
commit d3035d5703

View File

@@ -57,11 +57,16 @@ image: $FEDORA_IMAGE
script: script:
- ./.ci/check-abi ${LAST_ABI_BREAK} $(git rev-parse HEAD) - ./.ci/check-abi ${LAST_ABI_BREAK} $(git rev-parse HEAD)
.standard_job:
rules:
- when: on_success
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
build: build:
stage: build stage: build
except: extends:
variables: - .standard_job
- $CI_PIPELINE_SOURCE == "schedule"
variables: variables:
driver: virtual_image driver: virtual_image
<<: *build_one_driver <<: *build_one_driver
@@ -76,9 +81,8 @@ build:
test: test:
stage: test stage: test
except: extends:
variables: - .standard_job
- $CI_PIPELINE_SOURCE == "schedule"
script: script:
- meson setup _build --werror -Ddrivers=all -Db_coverage=true - meson setup _build --werror -Ddrivers=all -Db_coverage=true
- meson test -C _build --print-errorlogs --no-stdsplit --timeout-multiplier 3 - meson test -C _build --print-errorlogs --no-stdsplit --timeout-multiplier 3
@@ -100,9 +104,8 @@ test:
test_valgrind: test_valgrind:
stage: test stage: test
except: extends:
variables: - .standard_job
- $CI_PIPELINE_SOURCE == "schedule"
script: script:
- meson setup _build -Ddrivers=all - meson setup _build -Ddrivers=all
- meson compile -C _build - meson compile -C _build
@@ -119,9 +122,8 @@ test_valgrind:
test_installed: test_installed:
stage: test stage: test
except: extends:
variables: - .standard_job
- $CI_PIPELINE_SOURCE == "schedule"
script: script:
- meson setup _build --prefix=/usr -Ddrivers=all - meson setup _build --prefix=/usr -Ddrivers=all
- meson install -C _build - meson install -C _build
@@ -143,9 +145,8 @@ test_installed:
test_scan_build: test_scan_build:
stage: test stage: test
except: extends:
variables: - .standard_job
- $CI_PIPELINE_SOURCE == "schedule"
allow_failure: true allow_failure: true
script: script:
- meson setup _build -Ddrivers=all - meson setup _build -Ddrivers=all
@@ -160,9 +161,8 @@ test_scan_build:
test_indent: test_indent:
stage: check-source stage: check-source
except: extends:
variables: - .standard_job
- $CI_PIPELINE_SOURCE == "schedule"
script: script:
- scripts/uncrustify.sh - scripts/uncrustify.sh
- git diff - git diff
@@ -170,9 +170,8 @@ test_indent:
test_unsupported_list: test_unsupported_list:
stage: check-source stage: check-source
except: extends:
variables: - .standard_job
- $CI_PIPELINE_SOURCE == "schedule"
allow_failure: true allow_failure: true
script: script:
- tests/hwdb-check-unsupported.py - tests/hwdb-check-unsupported.py
@@ -192,7 +191,7 @@ flatpak:
- if: '$CI_PROJECT_PATH != "libfprint/libfprint"' - if: '$CI_PROJECT_PATH != "libfprint/libfprint"'
when: manual when: manual
allow_failure: true allow_failure: true
- if: '$CI_PIPELINE_SOURCE == "schedule"' - if: $CI_PIPELINE_SOURCE == "schedule"
when: never when: never
- if: '$CI_COMMIT_BRANCH == "master"' - if: '$CI_COMMIT_BRANCH == "master"'
allow_failure: true allow_failure: true
@@ -213,9 +212,6 @@ flatpak:
.container_fedora_build_base: .container_fedora_build_base:
extends: .fdo.container-build@fedora extends: .fdo.container-build@fedora
stage: image-build stage: image-build
only:
variables:
- $CI_PIPELINE_SOURCE == "never"
variables: variables:
GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image
# a list of packages to install # a list of packages to install
@@ -226,6 +222,8 @@ flatpak:
libudev-devel libudev-devel
FDO_DISTRIBUTION_EXEC: | FDO_DISTRIBUTION_EXEC: |
$LIBFPRINT_EXEC $LIBFPRINT_EXEC
rules:
- when: never
.container_fedora_build_forced: .container_fedora_build_forced:
variables: variables:
@@ -235,28 +233,27 @@ container_fedora_build_schedule:
extends: extends:
- .container_fedora_build_base - .container_fedora_build_base
- .container_fedora_build_forced - .container_fedora_build_forced
only: rules:
variables: - if: $CI_PIPELINE_SOURCE == "schedule" && $CRON_TASK == "BUILD_CI_IMAGES"
- $CI_PIPELINE_SOURCE == "schedule" && $CRON_TASK == "BUILD_CI_IMAGES" when: always
container_fedora_build_manual: container_fedora_build_manual:
extends: extends:
- .container_fedora_build_base - .container_fedora_build_base
- .container_fedora_build_forced - .container_fedora_build_forced
only: rules:
variables: - if: $LIBFPRINT_CI_ACTION == "build-image"
- $LIBFPRINT_CI_ACTION == "build-image" when: always
container_fedora_build_on_deps_changed: container_fedora_build_on_deps_changed:
extends: .container_fedora_build_base extends: .container_fedora_build_base
only: rules:
variables: - if: $CI_PROJECT_NAMESPACE == "libfprint" && $CI_PIPELINE_SOURCE != "schedule"
- $CI_PROJECT_NAMESPACE == "libfprint" && $CI_PIPELINE_SOURCE != "schedule" changes:
refs: compare_to: 'refs/heads/master'
- branches paths:
- merge_requests - '.gitlab-ci/libfprint-image-variables.yaml'
changes: - '.gitlab-ci/libfprint-templates.yaml'
- .gitlab-ci/libfprint-image-variables.yaml
pages: pages:
image: alpine:latest image: alpine:latest