From e63c322893f48f867299841ddccdf2473e1c1c0b Mon Sep 17 00:00:00 2001
From: Thomas Kluyver <thomas.kluyver@xfel.eu>
Date: Thu, 2 Jan 2025 11:16:40 +0000
Subject: [PATCH] Replace deprecated 'only:' in CI with newer 'rules:'

---
 .gitlab-ci.yml | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 19822fd6e..fa0772649 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,3 +1,8 @@
+workflow:
+  rules:
+    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
+
 stages:
   - check
   - test
@@ -25,7 +30,8 @@ default:
 
 checks:
   stage: check
-  only: [merge_requests]
+  rules:
+    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
   allow_failure: true
   script:
     - export PATH=/home/gitlab-runner/.local/bin:$PATH
@@ -42,7 +48,6 @@ checks:
 
 pytest:
   stage: test
-  only: [merge_requests]
   script:
     - export LANG=C  # Hopefully detect anything relying on locale
     - python3 -m pip install ".[test]" --index-url https://git.xfel.eu/api/v4/groups/501/-/packages/pypi/simple
@@ -59,7 +64,6 @@ pytest:
 
 cython-editable-install-test:
   stage: test
-  only: [merge_requests]
   script:
     - python3 -m pip install -e ".[test]" --index-url https://git.xfel.eu/api/v4/groups/501/-/packages/pypi/simple
     - python3 -m pytest --color yes --verbose ./tests/test_cythonalgs.py
@@ -72,7 +76,8 @@ automated_test:
     PYENV_VERSION: "3.11"
     CAL_CAL_TOOLS_CALCAT: "{base-api-url='http://exflcalproxy:8080/api', use-oauth2=false}"
   stage: automated_test
-  only: [merge_requests]
+  rules:
+    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
   when: manual
   allow_failure: false
   tags:
-- 
GitLab