Skip to content

Commit

Permalink
Add github actions for python wheels and sdist
Browse files Browse the repository at this point in the history
  • Loading branch information
cjw85 committed Aug 15, 2024
1 parent 7f241a4 commit c38e52e
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build

on: [push, pull_request]

# doing as cibuildwheel docs says leads to frankenstein arm builds on macos
# so lets be more explicit, no linux arm build as not available on github

jobs:
build_wheels:
name: Wheel ${{ matrix.python }}-${{ matrix.buildplat[1] }}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-latest, manylinux_x86_64, auto]
- [macos-13, macosx_x86_64, x86_64]
- [macos-14, macosx_arm64, arm64]
python: ["cp38", "cp39", "cp310", "cp311", "cp312"]

steps:
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/cibuildwheel@v2.20.0
env:
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.python }}-${{ matrix.buildplat[1] }}
path: ./wheelhouse/*.whl


build-sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Build sdist
run: python setup.py sdist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ class LibMM2Build(build_ext):
# distributed on PyPI).
def run(self):
def compile_libminimap2(*args, **kwargs):
cmd = ['make', 'libminimap2.a'] + list(args) + ["python=1"]
cmd = ['make', 'libminimap2.a'] + list(args)
subprocess.check_call(cmd)
options = []
options = ["python=1"]
if platform.machine() in ["aarch64", "arm64"]:
options = ["arm_neon=1", "aarch64=1"]
options += ["arm_neon=1", "aarch64=1"]
self.execute(
compile_libminimap2, options,
'Compiling libminimap2 using Makefile')
f'Compiling libminimap2 using Makefile with options: {options}')
build_ext.run(self)


Expand Down

0 comments on commit c38e52e

Please sign in to comment.