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
Merged
4 changes: 2 additions & 2 deletions .github/workflows/build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
if: matrix.architecture != 'linux/arm64' || github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'published')
uses: actions/upload-artifact@v4
with:
name: cpp-package
name: cpp-package-${{ matrix.architecture }}
path: packages/cpp/

build-package-python:
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
if: matrix.architecture != 'linux/arm64' || github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'published')
uses: actions/upload-artifact@v4
with:
name: python-package
name: python-package-${{ matrix.architecture }}
path: packages/python/

build-documentation:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ jobs:
- name: Download C++ Package
uses: actions/download-artifact@v4
with:
name: cpp-package
pattern: cpp-package-*
merge-multiple: true
path: packages/cpp/
- name: Release C++ Package
uses: softprops/action-gh-release@v1
Expand All @@ -63,7 +64,8 @@ jobs:
- name: Download Python Package
uses: actions/download-artifact@v4
with:
name: python-package
pattern: python-package-*
merge-multiple: true
path: packages/python/
- name: Deploy Python Package
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
44 changes: 43 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
vishwa2710 marked this conversation as resolved.
Show resolved Hide resolved
vishwa2710 marked this conversation as resolved.
Show resolved Hide resolved

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) }}
vishwa2710 marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand All @@ -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