Support numpy 2 #143
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Test Python Lib" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - devel | |
| - deploy | |
| pull_request: | |
| release: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python: ['3.11', '3.12', '3.13', '3.14'] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Install build dependencies | |
| run: | | |
| pip install setuptools | |
| pip install 'Cython>=0.29' | |
| pip install 'numpy>=2,<3' | |
| - name: Install lib | |
| run: | | |
| python -m pip install --editable . | |
| - name: Install test dependencies | |
| run: | | |
| pip install matplotlib pytest | |
| - name: pytest | |
| run: | | |
| pytest GPy/testing | |
| build: | |
| if: github.event_name == 'release' | |
| strategy: | |
| matrix: | |
| os: [windows-latest, macos-latest] | |
| python: ['3.11', '3.12', '3.13', '3.14'] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Build lib | |
| run: | | |
| pip install setuptools | |
| pip install wheel | |
| pip install 'Cython>=0.29' | |
| pip install 'numpy>=2,<3' | |
| python -m pip install --editable . | |
| python setup.py bdist_wheel | |
| - name: Build sdist (Windows only) | |
| if: runner.os == 'Windows' | |
| run: python setup.py sdist | |
| - name: List contents of dist | |
| run: ls -R dist | |
| - name: Archive build artifacts | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: dist-artifacts-${{ matrix.os }}-${{ matrix.python }} | |
| path: dist | |
| build-linux: | |
| if: github.event_name == 'release' | |
| strategy: | |
| matrix: | |
| python: ['cp311-cp311', 'cp312-cp312', 'cp313-cp313', 'cp314-cp314'] | |
| runs-on: ubuntu-latest | |
| container: quay.io/pypa/manylinux2014_x86_64 | |
| steps: | |
| - uses: actions/checkout@v1 | |
| - name: Compile c headers | |
| run: | | |
| /opt/python/${{ matrix.python }}/bin/python -m pip install 'Cython>=0.29' 'numpy>=2,<3' | |
| /opt/python/${{ matrix.python }}/bin/python -m pip install --editable . | |
| - name: Build wheel files | |
| run: | | |
| /opt/python/${{ matrix.python }}/bin/python setup.py bdist_wheel | |
| - name: Install auditwheel | |
| run: | | |
| /opt/python/${{ matrix.python }}/bin/python -m pip install auditwheel | |
| - name: Repair wheel files | |
| run: | | |
| /opt/python/${{ matrix.python }}/bin/python -m auditwheel repair dist/*${{ matrix.python }}-linux_x86_64.whl | |
| - name: List contents of dist | |
| run: ls -R dist | |
| - name: List contests of wheelhouse | |
| run: ls -R wheelhouse | |
| - name: Move wheelhouse wheel files to dist | |
| run: | | |
| rm dist/* | |
| mv wheelhouse/* dist/ | |
| rmdir wheelhouse | |
| - name: List contents of dist | |
| run: ls -R dist | |
| - name: Get the name of the wheel file | |
| id: get-wheel-name | |
| run: echo "::set-output name=wheel-name::$(ls dist/*.whl)" | |
| - name: Archive build artifacts | |
| uses: actions/upload-artifact@v1 | |
| with: | |
| name: dist-artifacts-manylinux-${{ matrix.python }} | |
| path: ${{ steps.get-wheel-name.outputs.wheel-name }} | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: [test, build-linux, build] | |
| if: github.event_name == 'release' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install twine | |
| run: | | |
| pip install --upgrade pip | |
| pip install twine | |
| - name: Download all artifacts to a specific directory | |
| uses: actions/download-artifact@v3 | |
| with: | |
| path: dist | |
| - name: Create dist directory | |
| run: mkdir -p dist | |
| - name: Move files from subdirectories | |
| run: | | |
| for subdirectory in dist/*/; do | |
| dir_name=$(basename "$subdirectory") | |
| mv "$subdirectory"* dist/ | |
| rm -r "$subdirectory" | |
| echo "Moved files from '$dir_name' to 'dist/'" | |
| done | |
| - name: Inspect wheel files | |
| run: | | |
| ls -R dist | |
| - name: Upload to PyPI using twine | |
| run: twine upload --skip-existing dist/* | |
| env: | |
| TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
| TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |