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
@@ -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:
@@ -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:
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
@@ -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
48 changes: 45 additions & 3 deletions .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
name: Test Python
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: Run Unit Tests Python
run: make test-unit-python-standalone
- name: Download Python packages
uses: actions/download-artifact@v4
with:
name: python-bindings
path: packages/python/
- name: Run Python Unit Tests
run: make ci-test-python ${{ format('test_python_version={0}', matrix.python-version) }}

Unchanged files with check annotations Beta

# Apache License 2.0
FROM ubuntu:20.04 as base

Check warning on line 3 in docker/development/Dockerfile

GitHub Actions / Build and Push and Tag Base Image with Version / Build Development Image

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
LABEL maintainer="lucas.bremond@gmail.com"
## Black
ARG OSTK_PYTHON_VERSION
ENV OSTK_PYTHON_VERSION 3.11

Check warning on line 196 in docker/development/Dockerfile

GitHub Actions / Build and Push and Tag Base Image with Version / Build Development Image

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
RUN python${OSTK_PYTHON_VERSION} -m pip install black black[jupyter]
# Environment
ENV LD_LIBRARY_PATH /usr/local/lib:${LD_LIBRARY_PATH}

Check warning on line 202 in docker/development/Dockerfile

GitHub Actions / Build and Push and Tag Base Image with Version / Build Development Image

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$LD_LIBRARY_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 202 in docker/development/Dockerfile

GitHub Actions / Build and Push and Tag Base Image with Version / Build Development Image

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
ENV PYTHONPATH /usr/local/lib:${PYTHONPATH}

Check warning on line 203 in docker/development/Dockerfile

GitHub Actions / Build and Push and Tag Base Image with Version / Build Development Image

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$PYTHONPATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 203 in docker/development/Dockerfile

GitHub Actions / Build and Push and Tag Base Image with Version / Build Development Image

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
RUN git config --global --add safe.directory /app
# Install development helpers
ARG VERSION
ENV VERSION ${VERSION}

Check warning on line 238 in docker/development/Dockerfile

GitHub Actions / Build and Push and Tag Base Image with Version / Build Development Image

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
LABEL VERSION="${VERSION}"