name: pip packaging osx on: release: types: [published] env: MACOSX_DEPLOYMENT_TARGET: 12.0 _PYTHON_HOST_PLATFORM: macosx-12.0-universal2 ARCHFLAGS: "-arch arm64 -arch x86_64" jobs: # Python 3.8 specific case where NumPy 2.x will not be supported wheels_3_8: # Should use macos-latest, but python 3.8 and 3.9 is no more available from macos-14 runs-on: macos-13 name: Build wheels for Python 3.8 steps: - uses: actions/checkout@v4 with: submodules: true - uses: actions/setup-python@v5 with: python-version: 3.8 architecture: x64 # NumPy packages for osx x86 and arm are only available from 1.21.2, but stable for both versions from 1.21.4 and python 3.8+ # numpy~=1.21.4 means any numpy=1.21.*, but also numpy>=1.21.4 (numpy~=1.21 do not work as it means any numpy==1.*) - name: Install dependencies run: | brew update || true brew install boost eigen gmp mpfr cgal || true python -m pip install --user numpy~=1.21.4 python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt python -m pip install --user twine delocate ./scripts/build_osx_universal_gmpfr.sh # Now the universal libs are in $PWD/deps-uni/lib - name: Build python wheel run: | export GMP_LIB_DIR=$PWD/deps-uni/lib export GMPXX_LIB_DIR=$PWD/deps-uni/lib export MPFR_LIB_DIR=$PWD/deps-uni/lib python --version mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release .. cd src/python python -m build -n -w - name: Install and test python wheel run: | python -m pip install --user numpy --upgrade python -m pip install --user pytest build/src/python/dist/*.whl python -c "import gudhi; print(gudhi.__version__)" python -m pytest -v src/python/test/test_alpha_complex.py python -m pytest -v src/python/test/test_delaunay_complex.py python -m pytest -v src/python/test/test_bottleneck_distance.py python -m pytest -v src/python/test/test_cubical_complex.py python -m pytest -v src/python/test/test_rips_complex.py - name: Publish on PyPi env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | mkdir wheelhouse export PATH="$PATH:`python -m site --user-base`/bin" delocate-listdeps build/src/python/dist/*.whl delocate-wheel --require-archs universal2 -w wheelhouse build/src/python/dist/*.whl python -m twine upload wheelhouse/*.whl # Python 3.9+ specific case where NumPy 2.x will be supported # NumPy packages for osx x86 and arm are only available from 1.21.2, but stable for both versions from 1.21.4 and python 3.8+ wheels: # Should use macos-latest, but python 3.8 and 3.9 is no more available from macos-14 runs-on: macos-13 strategy: max-parallel: 4 matrix: python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] include: - python-version: "3.9" numpy-version: "1.21.4" - python-version: "3.10" numpy-version: "1.21.6" - python-version: "3.11" numpy-version: "1.23.2" - python-version: "3.12" numpy-version: "1.26.0" - python-version: "3.13" numpy-version: "2.1.0" name: Build wheels for Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v4 with: submodules: true - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} architecture: x64 # For python >=3.9, numpy >= 2.0 for package build and ABI compatibility with numpy 1.X and 2.X # cf. https://numpy.org/doc/stable/dev/depending_on_numpy.html#numpy-2-0-specific-advice - name: Install dependencies run: | brew update || true brew install boost eigen gmp mpfr cgal || true python -m pip install --user numpy>=2.0 python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt python -m pip install --user twine delocate ./scripts/build_osx_universal_gmpfr.sh # Now the universal libs are in $PWD/deps-uni/lib - name: Build python wheel run: | export GMP_LIB_DIR=$PWD/deps-uni/lib export GMPXX_LIB_DIR=$PWD/deps-uni/lib export MPFR_LIB_DIR=$PWD/deps-uni/lib python --version mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release .. cd src/python python -m build -n -w # Test ABI compatibility with numpy 1.X - name: Install and test python wheel run: | python -m pip install --user numpy~=${{ matrix.numpy-version }} python -m pip install --user pytest build/src/python/dist/*.whl python -c "import gudhi; print(gudhi.__version__)" python -m pytest -v src/python/test/test_alpha_complex.py python -m pytest -v src/python/test/test_delaunay_complex.py python -m pytest -v src/python/test/test_bottleneck_distance.py python -m pytest -v src/python/test/test_cubical_complex.py python -m pytest -v src/python/test/test_rips_complex.py - name: Publish on PyPi env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | mkdir wheelhouse export PATH="$PATH:`python -m site --user-base`/bin" delocate-listdeps build/src/python/dist/*.whl delocate-wheel --require-archs universal2 -w wheelhouse build/src/python/dist/*.whl python -m twine upload wheelhouse/*.whl