diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml new file mode 100644 index 0000000..d5381aa --- /dev/null +++ b/.github/workflows/pypi-publish.yml @@ -0,0 +1,86 @@ +name: PyPI publish + +on: + release: + types: + - published + +permissions: + contents: read + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.setup.os }} + runs-on: ${{ matrix.setup.os }} + strategy: + matrix: + setup: + - { os: ubuntu-latest, build:, "*manylinux*" } + - { os: ubuntu-latest, build:, "*musllinux*" } + - { os: macos-latest, build:, "*macosx*" } + - { os: windows-latest, build:, "*win*" } + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.15.0 + env: + CIBW_BUILD: ${{ matrix.setup.build }} + CIBW_SKIP: cp36* pp* + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + path: ./wheelhouse/*.whl + + build_sdist: + name: Build sdist and upload to PyPI + needs: build_wheels + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install dependencies + run: | + python -m pip install pip + python -m pip install -r requirements.txt + + - name: Build and install Python extension + run: | + python -m pip install -e . + + - name: Download wheels + uses: actions/download-artifact@v4 + with: + path: ./wheels + + - name: Build sdist + run: | + python setup.py sdist + ls -l dist + tar tvfz dist/balltree-*.tar.gz + + - name: Copy wheels + run: | + echo ls -l wheels + ls -l wheels + echo ls -l wheels/artifact + ls -l wheels/artifact + cp wheels/artifact/*.whl dist + echo ls -l dist + ls -l dist + + - name: Publish package + uses: pypa/gh-action-pypi-publish@v1.8 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/python-extension-ci.yml b/.github/workflows/python-ci.yml similarity index 75% rename from .github/workflows/python-extension-ci.yml rename to .github/workflows/python-ci.yml index 57cda51..592e457 100644 --- a/.github/workflows/python-extension-ci.yml +++ b/.github/workflows/python-ci.yml @@ -1,4 +1,4 @@ -name: Python Extension CI +name: Python CI on: push: @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] + version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout code @@ -27,11 +27,12 @@ jobs: with: python-version: "${{ matrix.version }}" - - name: Install test dependencies + - name: Install dependencies run: | + python -m pip install pip python -m pip install -r requirements.txt - - name: Build Python extension + - name: Build and install Python extension run: | python -m pip install -e . diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml deleted file mode 100644 index 32b0b3e..0000000 --- a/.github/workflows/python-publish.yml +++ /dev/null @@ -1,127 +0,0 @@ -# This workflow will upload a Python Package using Twine when a release is created -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Build wheels and sdist and upload to PyPI - -on: - release: - types: [published] - -permissions: - contents: read - -jobs: - build_linux_wheels: - name: Build wheels on standard linux - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Build wheels - uses: pypa/cibuildwheel@v2.9.0 - env: - CIBW_BUILD: "*manylinux*" - CIBW_SKIP: cp36* pp* - - - uses: actions/upload-artifact@v3 - with: - path: ./wheelhouse/*.whl - - build_musl_wheels: - name: Build wheels on musl linux - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Build wheels - uses: pypa/cibuildwheel@v2.9.0 - env: - CIBW_BUILD: "*musllinux*" - CIBW_SKIP: cp36* pp* - - - uses: actions/upload-artifact@v3 - with: - path: ./wheelhouse/*.whl - - build_macosx_wheels: - name: Build wheels on macosx - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - - name: Build wheels - uses: pypa/cibuildwheel@v2.9.0 - env: - CIBW_BUILD: "*macosx*" - CIBW_SKIP: cp36* pp* - - - uses: actions/upload-artifact@v3 - with: - path: ./wheelhouse/*.whl - - build_windows_wheels: - name: Build wheels on windows - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - - name: Build wheels - uses: pypa/cibuildwheel@v2.9.0 - env: - CIBW_BUILD: "*win*" - CIBW_SKIP: cp36* pp* - - - uses: actions/upload-artifact@v3 - with: - path: ./wheelhouse/*.whl - - build_sdist: - name: Build sdist and upload to PyPI - needs: [build_linux_wheels, build_musl_wheels, build_macosx_wheels, build_windows_wheels] - # Just need to build sdist on a single machine - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v3 - with: - python-version: "3.11" - - - name: Install dependencies - run: | - python -m pip install -U pip - pip install -U numpy setuptools - pip install -U . - - - name: Download wheels - uses: actions/download-artifact@v3 - with: - path: ./wheels - - - name: Build sdist - run: | - python setup.py sdist - ls -l dist - tar tvfz dist/balltree-*.tar.gz - - - name: Copy wheels - run: | - echo ls -l wheels - ls -l wheels - echo ls -l wheels/artifact - ls -l wheels/artifact - cp wheels/artifact/*.whl dist - echo ls -l dist - ls -l dist - - - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }}