Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add test matrix for multiple python versions #144

Merged
merged 15 commits into from
Jan 14, 2025
44 changes: 43 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -87,9 +87,46 @@ jobs:
- name: Check Python Format
run: make format-check-python-standalone

build-python:
name: Build Python bindings
runs-on: ubuntu-latest
outputs:
python_versions: ${{ steps.python-versions.outputs.value }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Pull Development Image
run: docker pull ${{ env.DOCKER_REGISTRY_PATH }}/${{ inputs.project_name }}-development:${{ inputs.project_version }}
- name: Build Python Bindings
run: make build-packages-python-standalone
- name: Upload Python Bindings
uses: actions/upload-artifact@v4
with:
name: python-bindings # TBM: use a different namespace than in build-packages for now.
path: packages/python/
- id: python-versions
name: Export Python Versions to Environment
run: |
python_versions=$(echo -n "["; find packages/python -name "*.whl" | grep -o "py[0-9]\{2,3\}" | sed 's/py\([0-9]\)\([0-9][0-9]\?\)/\1.\2/' | sed "s/\([0-9.]*\)/'\1'/" | tr '\n' ',' | sed 's/,$//'; echo "]")
echo "Python versions: ${python_versions}"
echo "value=${python_versions}" >> $GITHUB_OUTPUT

test-unit-python:
name: Run Python Unit Tests
runs-on: ubuntu-latest
needs:
- build-python
strategy:
matrix:
python-version: ${{ fromJson(needs.build-python.outputs.python_versions) }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
@@ -103,5 +140,10 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Pull Development Image
run: docker pull ${{ env.DOCKER_REGISTRY_PATH }}/${{ inputs.project_name }}-development:${{ inputs.project_version }}
- name: Download Python packages
uses: actions/download-artifact@v4
with:
name: python-bindings
path: packages/python/
- name: Run Unit Tests Python
run: make test-unit-python-standalone
run: make ci-test-python ${{ format('test_python_version={0}', matrix.python-version) }}
Loading