fix: use numpy density parameter (v2.0+) + remove version pin #112
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: build_and_publish | |
| on: | |
| push: | |
| tags: | |
| branches: | |
| pull_request: | |
| branches: | |
| repository_dispatch: | |
| types: build | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref_type }}-${{ github.event.pull_request.number || github.ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| run_cpp_tests: | |
| name: "Run C++ tests" | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: "Checkout code" | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| submodules: true | |
| - name: "Install dependencies" | |
| run: | | |
| export DEBIAN_FRONTEND=noninteractive | |
| sudo apt-get update -qq --yes >/dev/null | |
| sudo apt-get install -qq --yes build-essential gsl-bin libboost-all-dev libgsl-dev >/dev/null | |
| - name: "Build C++ tests" | |
| run: | | |
| make tests | |
| - name: "Run C++ tests" | |
| run: | | |
| make run-tests | |
| build_wheels: | |
| name: "Build wheel (${{ matrix.os }}, py${{ matrix.python-version }})" | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-24.04, macos-14, macos-15-intel ] | |
| python-version: [ 310, 311 ] | |
| steps: | |
| - name: "Checkout code" | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| submodules: true | |
| - name: "Build wheel (${{ matrix.os }}, py${{ matrix.python-version }})" | |
| uses: pypa/[email protected] | |
| with: | |
| config-file: cibuildwheel.toml | |
| env: | |
| CIBW_BUILD: "cp${{ matrix.python-version}}-*" | |
| # Override deployment target to 14.0 for all macOS runners | |
| MACOSX_DEPLOYMENT_TARGET: "14.0" | |
| # Build only native architecture on each runner (no cross-compilation) | |
| CIBW_ARCHS_MACOS: >- | |
| ${{ | |
| matrix.os == 'macos-14' && 'arm64' || | |
| matrix.os == 'macos-15-intel' && 'x86_64' || | |
| 'auto' | |
| }} | |
| - name: "Upload build artifacts (${{ matrix.os }}, py${{ matrix.python-version }})" | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-${{ matrix.os }}-py${{ matrix.python-version }} | |
| path: ./wheelhouse/*.whl | |
| make_sdist: | |
| name: "Make source distribution" | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: "Checkout code" | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| submodules: true | |
| - name: "Build sdist" | |
| run: | | |
| pip3 install pipx ppsetuptools | |
| pipx run build --sdist | |
| - name: "Upload build artifacts" | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: "dist-sdist" | |
| path: "dist/*.tar.gz" | |
| publish_to_pypi: | |
| name: "Publish to PyPI" | |
| if: startsWith(github.ref, 'refs/tags') | |
| needs: [ run_cpp_tests, build_wheels, make_sdist ] | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: true | |
| steps: | |
| - name: "Download build artifacts" | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: "artifacts" | |
| - name: "Collect all artifacts into dist folder" | |
| run: | | |
| mkdir -p dist | |
| find artifacts -type f \( -name '*.whl' -o -name '*.tar.gz' \) -exec cp {} dist/ \; | |
| - name: "Publish to PyPI" | |
| if: startsWith(github.ref, 'refs/tags') | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_API_TOKEN }} |