ci: for branches, use a single trigger stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 15 Nov 2024 00:01:34 +0100
branchstable
changeset 52258 b65f11f49375
parent 52257 3f7c7a855af0
child 52259 074bc2b135f3
ci: for branches, use a single trigger This trigger will unlock all the job necessary to build wheels and upload nightly build. This should make the nightly build process more pratical. In practice right now, only run pipeline for branch by creating them explicitly on the web. So we could just run everything without trigger, but this is a decision for later. This changeset only focus on making the nightly build process somewhat manageable.
contrib/heptapod-ci.yml
--- a/contrib/heptapod-ci.yml	Thu Nov 14 22:44:25 2024 +0100
+++ b/contrib/heptapod-ci.yml	Fri Nov 15 00:01:34 2024 +0100
@@ -20,6 +20,7 @@
       when: always
 
 stages:
+  - nightly-trigger
   - build
   - checks
   - tests
@@ -79,6 +80,17 @@
     - .dummy
   when: manual
 
+
+trigger-nightly-build:
+  extends: .trigger
+  stage: nightly-trigger
+  rules:
+    - if: $CI_COMMIT_BRANCH =~ $RE_BRANCH
+      when: manual
+      allow_failure: true
+    - if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
+      when: never
+
 .build-wheel:
   extends: .all
   image: "registry.heptapod.net/mercurial/ci-images/core-wheel-x86_64-c:v3.0"
@@ -100,6 +112,7 @@
       - wheels/
     expire_in: 1 week
 
+
 build-c-wheel:
   extends: .build-wheel
   variables:
@@ -239,12 +252,18 @@
 trigger-pycompat:
   extends: .trigger
   stage: py-version-compat
+  rules:
+  - if: $CI_COMMIT_BRANCH =~ $RE_BRANCH
+    when: on_success
+    needs:
+      - trigger-nightly-build
+  - if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
+    when: manual
+    allow_failure: true
 
 .test-c-pycompat:
     extends: .test-c
     stage: py-version-compat
-    needs:
-      - trigger-pycompat
     variables:
         WHEEL_TYPE: "c"
 
@@ -256,6 +275,7 @@
     variables:
         PYTHON: python3.8
     needs:
+      - job: trigger-pycompat
       - job: build-c-wheel
         parallel:
           matrix:
@@ -266,6 +286,7 @@
     variables:
         PYTHON: python3.12
     needs:
+      - job: trigger-pycompat
       - job: build-c-wheel
         parallel:
           matrix:
@@ -284,6 +305,7 @@
     variables:
         PYTHON: python3.13
     needs:
+      - job: trigger-pycompat
       - job: build-c-wheel
         parallel:
           matrix:
@@ -333,6 +355,12 @@
 trigger-wheel-windows:
   extends: .trigger
   stage: build
+  rules:
+  - if: $CI_COMMIT_BRANCH =~ $RE_BRANCH
+    when: never
+  - if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
+    when: manual
+    allow_failure: true
 
 build-c-wheel-windows:
     extends: .windows
@@ -340,7 +368,13 @@
     # wait for someone to click on "trigger-wheel-windows"
     when: on_success
     needs:
-      - "trigger-wheel-windows"
+    rules:
+    - if: $CI_COMMIT_BRANCH =~ $RE_BRANCH
+      needs:
+        - trigger-nightly-build
+    - if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
+      needs:
+        - "trigger-wheel-windows"
     variables:
       MERCURIAL_SETUP_FORCE_TRANSLATIONS: "1"
     script:
@@ -458,7 +492,13 @@
 # The weird directory structure match the one we use for Linux to deal with the
 # multiple jobs. (all this might be unnecessary)
 build-c-wheel-macos:
-    when: manual  # avoid overloading the CI by default
+    rules:
+    - if: $CI_COMMIT_BRANCH =~ $RE_BRANCH
+      needs:
+        - trigger-nightly-build
+    - if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
+      when: manual  # avoid overloading the CI by default
+      allow_failure: true
     stage: build
     tags:
       - macos
@@ -494,9 +534,6 @@
       when: on_success
     - if: '$CI_COMMIT_BRANCH =~ $RE_TOPIC'
       when: never
-      # if you need to test this, make it
-      # when: manual
-      # allow_failure: true
 
 # a dummy job that gather greatly parallel object into one.
 #
@@ -505,10 +542,10 @@
 #
 .sink:
   extends:
-    - .nightly_build_sink
+    - .nightly_build_step
     - .dummy
 
-linux-test-result:
+test-result-linux:
   extends: .sink
   needs:
     - test-c
@@ -516,12 +553,12 @@
     - test-3.12-c
     - test-3.13-c
 
-macos-test-result:
+test-result-macos:
   extends: .sink
   needs:
     - macos
 
-windows-test-result:
+test-result-windows:
   extends: .sink
   needs:
     - windows
@@ -544,9 +581,9 @@
     - build-c-wheel
     - build-c-wheel-macos
     - build-c-wheel-windows
-    - linux-test-result
-    - macos-test-result
-    - windows-test-result
+    - test-result-linux
+    - test-result-macos
+    - test-result-windows
   # It would be nice to be able to restrict that a bit to protected branch only
   variables:
     TWINE_USERNAME: gitlab-ci-token