From 5b5a2a87792c3f20a9d4637428a72ed301e27167 Mon Sep 17 00:00:00 2001 From: Deeptanshu Sekhri Date: Tue, 22 Jul 2025 10:55:06 +0100 Subject: [PATCH] ci: Add `test-python-api` job to run the Python API test suite Signed-off-by: Deeptanshu Sekhri --- .gitlab-ci.yml | 55 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c5e9400..10ef71a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -59,6 +59,26 @@ stages: - stuck_or_timeout_failure - runner_system_failure +# Template for test jobs +.test-template: &test-template + extends: + - .standard-rules + - .base-job + stage: test + needs: + - job: build + artifacts: false + timeout: 15m + parallel: + matrix: *ci-build-and-test-matrix + image: $IMAGE + tags: *runner-tags + cache: + <<: *global_cache + key: "$CI_PIPELINE_ID" + paths: + - dist/*.whl + policy: pull # Lint Step lint: @@ -102,24 +122,7 @@ build: # Test stage: run CLI tests test-cli: - extends: - - .standard-rules - - .base-job - stage: test - needs: - - job: build - artifacts: false - timeout: 15m - parallel: - matrix: *ci-build-and-test-matrix - image: $IMAGE - tags: *runner-tags - cache: - <<: *global_cache - key: "$CI_PIPELINE_ID" - paths: - - dist/*.whl - policy: pull + <<: *test-template script: - 'echo "Running Test-CLI Stage: installing wheel and running tests on OS = $OS"' - python -m pip install dist/*.whl @@ -132,3 +135,19 @@ test-cli: junit: junit-cli-${OS}.xml paths: - junit-cli-${OS}.xml + +# Python API tests +test-python-api: + <<: *test-template + script: + - 'echo "Running Test-Python-API Stage: installing wheel and running tests on OS = $OS"' + - python -m pip install dist/*.whl + - echo "Executing pytest" + - python -m pytest tests/test_python_api.py -v --log-cli-level=DEBUG --junit-xml=junit-python-api-${OS}.xml + artifacts: + when: always + expire_in: 7 days + reports: + junit: junit-python-api-${OS}.xml + paths: + - junit-python-api-${OS}.xml -- GitLab