diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c4dc128..5dfd4d8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -110,29 +110,69 @@ jobs: # 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 - - test-unit-python-container: - name: Run Python Unit Tests in Container + + 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 + 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-python: + name: Test Python runs-on: ubuntu-latest - container: - image: openspacecollective/${{ inputs.project_name }}-development:${{ inputs.project_version }} ## !! - credentials: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - volumes: - - ${{ github.workspace }}:/app:delegated - - /app/build - options: --user root - steps: - - name: TMP install lfs - run: apt-get update && apt-get install -y --no-install-recommends git-lfs + needs: + - build-python + strategy: + matrix: + python-version: ${{ fromJson(needs.build-python.outputs.python_versions) }} + steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - - name: Try to install ostk - run: cd /app/build && ostk-build && ostk-install + - 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: 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) }} + + # test-unit-python-matrix: # name: Run Python Unit Tests With Multiple Python Versions