diff contrib/heptapod-ci.yml @ 52152:de4b9ea2fa34 default tip

branching: merge stable into default
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 29 Oct 2024 09:38:48 +0100
parents 0de1895c2218
children
line wrap: on
line diff
--- a/contrib/heptapod-ci.yml	Mon Oct 28 16:31:49 2024 +0100
+++ b/contrib/heptapod-ci.yml	Tue Oct 29 09:38:48 2024 +0100
@@ -20,7 +20,12 @@
       when: always
 
 stages:
+  - build
+  - checks
   - tests
+  - platform-compat
+  - py-version-compat
+
 
 image: registry.heptapod.net/mercurial/ci-images/mercurial-core:$HG_CI_IMAGE_TAG
 
@@ -32,7 +37,37 @@
 
 .all_template: &all
   when: on_success
+  needs: []
 
+# TODO: we should use an image based on manylinux instead "all-in-one" image
+# used for all test so far.
+.build-wheel: &wheel
+    <<: *all
+    stage: build
+    variables:
+      WHEEL_TYPE: ""
+      FLAVOR: ""
+    before_script:
+      - echo "python used, $PYTHON"
+      - $PYTHON --version
+      - echo $WHEEL_TYPE
+      - test -n "$WHEEL_TYPE"
+      - echo $FLAVOR
+      - mkdir -p wheels/$WHEEL_TYPE
+    script:
+      - $PYTHON setup.py bdist_wheel $FLAVOR --dist-dir wheels/$WHEEL_TYPE
+    artifacts:
+      paths:
+        - wheels/$WHEEL_TYPE
+      expire_in: 1 week
+
+build-c-wheel:
+    <<: *wheel
+    variables:
+      WHEEL_TYPE: "c"
+
+# TODO: We should select the wheel compatible with the python (and plateform)
+# we use. This is necessary to build multiple wheel.
 .runtests_template: &runtests
     <<: *all
     stage: tests
@@ -48,10 +83,23 @@
       - ls -1 tests/test-check-*.* > /tmp/check-tests.txt
     script:
         - echo "$RUNTEST_ARGS"
-        - HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" "$PYTHON" tests/run-tests.py --color=always $RUNTEST_ARGS
+        - echo "$WHEEL_TYPE"
+        - WHEEL=""
+        - if test -n "$WHEEL_TYPE"; then
+             WHEEL="`ls -1 $CI_PROJECT_DIR/wheels/$WHEEL_TYPE/*.whl`";
+             test -n "$WHEEL";
+          fi
+        - if test -n "$WHEEL"; then
+            echo installing from $WHEEL;
+            HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" "$PYTHON" tests/run-tests.py --hg-wheel $WHEEL --color=always $RUNTEST_ARGS;
+          else
+            echo installing from source;
+            HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" "$PYTHON" tests/run-tests.py --color=always $RUNTEST_ARGS;
+          fi
 
 checks:
     <<: *runtests
+    stage: checks
     variables:
         SHOW_VERSION_OF: "$PYTHON black clang-format"
         RUNTEST_ARGS: "--time --test-list /tmp/check-tests.txt"
@@ -59,19 +107,27 @@
 
 rust-cargo-test:
     <<: *all
-    stage: tests
+    stage: checks
     script:
         - make rust-tests
         - make cargo-clippy
     variables:
         CI_CLEVER_CLOUD_FLAVOR: S
 
-test-c: &test_c
+.test-c: &test_c
     <<: *runtests
     variables:
         RUNTEST_ARGS: " --no-rust --blacklist /tmp/check-tests.txt"
         TEST_HGTESTS_ALLOW_NETIO: "1"
 
+test-c:
+    <<: *test_c
+    needs: [build-c-wheel]
+    variables:
+        WHEEL_TYPE: "c"
+        RUNTEST_ARGS: "--blacklist /tmp/check-tests.txt"
+        TEST_HGTESTS_ALLOW_NETIO: "1"
+
 test-pure:
     <<: *runtests
     variables:
@@ -99,36 +155,42 @@
 # version (and 3.12 have been giving us various troubles)
 test-3.8-c:
     <<: *test_c
+    stage: py-version-compat
     when: manual  # avoid overloading the CI by default
     variables:
         PYTHON: python3.8
 
 test-3.12-c:
     <<: *test_c
+    stage: py-version-compat
     when: manual  # avoid overloading the CI by default
     variables:
         PYTHON: python3.12
 
 test-3.12-rust:
     <<: *test_rust
+    stage: py-version-compat
     when: manual  # avoid overloading the CI by default
     variables:
         PYTHON: python3.12
 
 test-3.13-c:
     <<: *test_c
+    stage: py-version-compat
     when: manual  # avoid overloading the CI by default
     variables:
         PYTHON: python3.13
 
 test-3.13-rust:
     <<: *test_rust
+    stage: py-version-compat
     when: manual  # avoid overloading the CI by default
     variables:
         PYTHON: python3.13
 
 check-pytype:
-    extends: .runtests_template
+    <<: *test_rust
+    stage: checks
     before_script:
       - export PATH="/home/ci-runner/vendor/pyenv/pyenv-2.4.7-adf3c2bccf09cdb81febcfd15b186711a33ac7a8/shims:/home/ci-runner/vendor/pyenv/pyenv-2.4.7-adf3c2bccf09cdb81febcfd15b186711a33ac7a8/bin:$PATH"
       - echo "PATH, $PATH"
@@ -149,7 +211,7 @@
 .window_runtests_template: &windows_runtests
     <<: *all
     when: manual  # we don't have any Windows runners anymore at the moment
-    stage: tests
+    stage: platform-compat
     before_script:
       - C:/MinGW/msys/1.0/bin/sh.exe --login -c 'cd "$OLDPWD" && ls -1 tests/test-check-*.* > C:/Temp/check-tests.txt'
       # TODO: find/install cvs, bzr, perforce, gpg, sqlite3
@@ -183,6 +245,7 @@
 
 macos:
     <<: *test_c
+    stage: platform-compat
     when: manual  # avoid overloading the CI by default
     tags:
       - macos