changeset 52151:0de1895c2218 stable

ci: build a wheel and use it to run c tests First step into building and testing wheel automatically.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 27 Oct 2024 23:34:50 +0100
parents c99cbb02a82e
children de4b9ea2fa34 a81d2cafdbcc
files contrib/heptapod-ci.yml
diffstat 1 files changed, 51 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/heptapod-ci.yml	Sun Oct 27 14:10:45 2024 +0100
+++ b/contrib/heptapod-ci.yml	Sun Oct 27 23:34:50 2024 +0100
@@ -39,6 +39,35 @@
   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
@@ -54,7 +83,19 @@
       - 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
@@ -73,12 +114,20 @@
     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: