From 332b6898ef662b3228a15871c7889d52198a9fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 23 Oct 2025 22:10:48 +0200 Subject: [PATCH 1/3] ci: Do not use anymore only/except deprecated syntax These keywords are deprecated [1] for a while, and they are breaking the usage of more complex `rules:` when mixed, so let's rewrite the CI jobs rules to use non-deprecated syntax [1] https://docs.gitlab.com/ci/yaml/deprecated_keywords/#only--except --- .gitlab-ci.yml | 70 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8776d40c5..ff726d27c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,42 +34,50 @@ variables: # # Don’t execute the pipeline when a merge request is merged into `origin/main`, # as it will have already been tested +.only-default-filter-rules: + rules: + - if: $CI_COMMIT_TAG + when: never + - if: $CI_PIPELINE_SOURCE == "push" && + $CI_PROJECT_NAMESPACE == "GNOME" && + $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + when: never + .only-default: - only: - - branches - except: - refs: - - tags - variables: - - $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PROJECT_NAMESPACE == "GNOME" + rules: + - !reference [.only-default-filter-rules, rules] + - if: $CI_COMMIT_BRANCH + when: on_success # As above, but does get executed on merge into `origin/main`. For use with # updating code coverage results and docs builds. .only-default-and-merges: - only: - - branches - except: - refs: - - tags + rules: + - if: $CI_COMMIT_TAG + when: never + - if: $CI_COMMIT_BRANCH + when: on_success # Some jobs run on CI runners which don’t have good isolation between CI jobs, # and don’t have much available resource. Limit those jobs to only ones on the # origin repository (GNOME/glib), rather than people’s forks. Code in the origin # repository can be trusted. .only-origin: - only: - - branches@GNOME/glib - except: - - tags + rules: + - if: $CI_COMMIT_TAG + when: never + - if: $CI_PROJECT_PATH == "GNOME/glib" && $CI_COMMIT_BRANCH + when: on_success + - when: never # Some jobs take a long time and are unlikely to find failures (or will find # failures which are not merge-blockers to fix), so they’re executed on a weekly # schedule in order to save CI resources and speed up branch pipelines. .only-schedules: - only: - - schedules - except: - - tags + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" + when: always + - when: never # Some jobs take a long time and are unlikely to find failures (or will find # failures which are not merge-blockers to fix), so they’re executed on a weekly @@ -162,7 +170,7 @@ style-check-advisory: sh-and-py-check: extends: - - .only-default + - .only-default-filter-rules - .with-git image: "${DEBIAN_IMAGE}" stage: style-check @@ -175,10 +183,13 @@ sh-and-py-check: - test -z "$failed" variables: LINT_WARNINGS_ARE_ERRORS: '1' - only: - changes: - - "**/*.py" - - "**/*.sh" + rules: + - !reference [.only-default-filter-rules, rules] + - if: $CI_COMMIT_BRANCH + changes: + - "**/*.py" + - "**/*.sh" + when: on_success style-check-mandatory: extends: @@ -986,9 +997,12 @@ dist-job: - !reference [".build-linux", "before_script"] - !reference [".with-git", "before_script"] - !reference [".build-gobject-introspection", "before_script"] - only: - - schedules - - tags + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" + when: always + - if: $CI_COMMIT_TAG + when: on_success + - when: never script: - meson setup ${MESON_COMMON_OPTIONS} --buildtype release From 773815f72741f2d7ae756391f6564a60e4bfc5af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 23 Oct 2025 23:10:15 +0200 Subject: [PATCH 2/3] ci: Apply GNOME templates default rules Re-use rules from https://gitlab.gnome.org/GNOME/citemplates/ default-rules template, but without importing them to ensure that changes in the citemplates project won't affect us directly So we have some basic control on what should trigger a workflow, auto-retry and auto-replace on subsequent pushes --- .gitlab-ci.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ff726d27c..3c03038b8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,26 @@ include: dist-job-name: "dist-job" tarball-artifact-path: "${TARBALL_ARTIFACT_PATH}" +# This is based on GNOME/citemplates default-rules, but we only apply the +# settings that make sense for glib +default: + interruptible: true + # Auto-retry jobs in case of infra failures + retry: + max: 1 + when: + - "runner_system_failure" + - "stuck_or_timeout_failure" + - "scheduler_failure" + - "api_failure" + +workflow: + rules: + - if: $CI_PIPELINE_SOURCE == "web" + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + - if: $CI_COMMIT_TAG + - if: $CI_COMMIT_BRANCH + stages: - style-check - build From 7d3ae117a1ffae4dfaf429e03b6d1cbf2b3b7414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 27 Oct 2025 17:24:29 +0100 Subject: [PATCH 3/3] ci: Only run C style checks on c files changes Also remove the dependency of pages job on it since none of the results seem to be used there --- .gitlab-ci.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3c03038b8..a106f07ed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -177,7 +177,7 @@ variables: style-check-advisory: extends: - - .only-default + - .only-default-filter-rules - .with-git image: "${DEBIAN_IMAGE}" stage: style-check @@ -187,6 +187,14 @@ style-check-advisory: - .gitlab-ci/run-style-check-diff.sh || failed=1 - .gitlab-ci/run-check-todos.sh || failed=1 - test -z "$failed" + rules: + - !reference [.only-default-filter-rules, rules] + - if: $CI_COMMIT_BRANCH + changes: + - "**/*.c" + - "**/*.cpp" + - "**/*.h" + when: on_success sh-and-py-check: extends: @@ -998,7 +1006,7 @@ scan-build: pages: extends: .only-schedules stage: deploy - needs: ['coverage', 'style-check-advisory'] + needs: ['coverage'] script: - mv _coverage/ public/ artifacts: