| 1 |
--- |
| 2 |
name: Build sdist and wheels |
| 3 |
|
| 4 |
on: |
| 5 |
push: |
| 6 |
pull_request: |
| 7 |
release: |
| 8 |
types: |
| 9 |
- published |
| 10 |
jobs: |
| 11 |
build_sdist: |
| 12 |
runs-on: ubuntu-latest |
| 13 |
steps: |
| 14 |
- name: Checkout source |
| 15 |
uses: actions/checkout@v4 |
| 16 |
|
| 17 |
- name: Create sdist |
| 18 |
shell: bash -l {0} |
| 19 |
run: | |
| 20 |
python -m pip install -q build |
| 21 |
python -m build -s |
| 22 |
|
| 23 |
- name: Upload sdist to build artifacts |
| 24 |
uses: actions/upload-artifact@v4 |
| 25 |
with: |
| 26 |
name: sdist |
| 27 |
path: dist/*.tar.gz |
| 28 |
|
| 29 |
build_wheels: |
| 30 |
name: "Build wheels on ${{ matrix.os }} ${{ matrix.cibw_archs }}" |
| 31 |
runs-on: ${{ matrix.os }} |
| 32 |
strategy: |
| 33 |
fail-fast: false |
| 34 |
matrix: |
| 35 |
include: |
| 36 |
- os: windows-latest |
| 37 |
cibw_archs: "AMD64" |
| 38 |
- os: windows-latest |
| 39 |
cibw_archs: "ARM64" |
| 40 |
- os: macos-13 |
| 41 |
cibw_archs: "x86_64" |
| 42 |
deploy_target: "13" |
| 43 |
- os: macos-14 |
| 44 |
cibw_archs: "arm64" |
| 45 |
deploy_target: "14" |
| 46 |
- os: ubuntu-24.04-arm |
| 47 |
cibw_archs: "aarch64" |
| 48 |
- os: ubuntu-22.04 |
| 49 |
cibw_archs: "x86_64" |
| 50 |
|
| 51 |
steps: |
| 52 |
- uses: actions/checkout@v4 |
| 53 |
- run: | |
| 54 |
git fetch --prune --unshallow |
| 55 |
|
| 56 |
- name: Build wheels |
| 57 |
uses: pypa/[email protected] |
| 58 |
env: |
| 59 |
CIBW_SKIP: "cp38-* *i686 *-musllinux_aarch64" |
| 60 |
CIBW_ARCHS: "${{ matrix.cibw_archs }}" |
| 61 |
CIBW_TEST_COMMAND: "pytest -v --pyargs pykdtree" |
| 62 |
CIBW_TEST_REQUIRES: "pytest mypy" |
| 63 |
CIBW_TEST_SKIP: "*-win_arm64" |
| 64 |
CIBW_BUILD_VERBOSITY: 1 |
| 65 |
|
| 66 |
|
| 67 |
CIBW_ENVIRONMENT_MACOS: "MACOSX_DEPLOYMENT_TARGET=${{ matrix.deploy_target }}" |
| 68 |
CIBW_BEFORE_BUILD_MACOS: "brew install libomp" |
| 69 |
|
| 70 |
- name: Upload wheel(s) as build artifacts |
| 71 |
uses: actions/upload-artifact@v4 |
| 72 |
with: |
| 73 |
name: "wheels-${{ matrix.os }}-${{ matrix.cibw_archs }}" |
| 74 |
path: ./wheelhouse/*.whl |
| 75 |
|
| 76 |
upload_pypi: |
| 77 |
needs: [build_sdist, build_wheels] |
| 78 |
runs-on: ubuntu-latest |
| 79 |
steps: |
| 80 |
- name: Download sdist artifact |
| 81 |
uses: actions/download-artifact@v4 |
| 82 |
with: |
| 83 |
name: sdist |
| 84 |
path: dist |
| 85 |
- name: Download wheels artifacts |
| 86 |
uses: actions/download-artifact@v4 |
| 87 |
with: |
| 88 |
pattern: wheels-* |
| 89 |
merge-multiple: true |
| 90 |
path: dist |
| 91 |
- name: Publish package to PyPI |
| 92 |
if: github.event.action == 'published' |
| 93 |
uses: pypa/[email protected] |
| 94 |
with: |
| 95 |
user: ${{ secrets.pypi_username }} |
| 96 |
password: ${{ secrets.pypi_password }} |
| 97 |
skip-existing: true |