Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(py): Build and publish arm64 wheels #442

Merged
merged 4 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .craft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ targets:
- name: github
requireNames:
- /^symbolic-.*-py2.py3-none-macosx_10_15_x86_64.whl$/
- /^symbolic-.*-py2.py3-none-macosx_11_0_arm64.whl$/
- /^symbolic-.*-py2\.py3-none-.*manylinux2010_i686.*\.whl$/
- /^symbolic-.*-py2\.py3-none-.*manylinux2010_x86_64\.whl$/
- /^symbolic-.*-py2\.py3-none-.*manylinux2014_aarch64\.whl$/
- /^symbolic-.*.zip$/
35 changes: 26 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@ on:

jobs:
python-wheel-mac:
name: Python macOS
runs-on: macos-10.15
strategy:
fail-fast: false
matrix:
include:
- macos-version: "10.15"
target: x86_64-apple-darwin
py-platform: macosx-10_15_x86_64
- macos-version: "11.0"
target: aarch64-apple-darwin
py-platform: macosx-11_0_arm64

name: Python macOS ${{ matrix.py-platform }}
runs-on: macos-${{ matrix.macos-version }}

steps:
- uses: actions/checkout@v2
Expand All @@ -18,14 +29,18 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
profile: minimal
override: true

- uses: actions/setup-python@v2
with:
python-version: 3.6

- run: make wheel
- run: make wheel PLATFORM=${{ matrix.py-platform }}
env:
# consumed by cargo and setup.py to obtain the target dir
CARGO_BUILD_TARGET: ${{ matrix.target }}

- uses: actions/upload-artifact@v2
with:
Expand All @@ -36,7 +51,10 @@ jobs:
strategy:
fail-fast: false
matrix:
build-arch: [i686, x86_64]
build-arch:
- manylinux2010_i686
- manylinux2010_x86_64
- manylinux2014_aarch64

name: Python Linux ${{ matrix.build-arch }}
runs-on: ubuntu-latest
Expand All @@ -46,14 +64,13 @@ jobs:
with:
submodules: recursive

- uses: actions-rs/toolchain@v1
- if: matrix.build-arch == 'manylinux2014_aarch64'
uses: docker/setup-qemu-action@v1
with:
toolchain: stable
profile: minimal
override: true
platforms: arm64

- name: Build in Docker
run: make wheel-manylinux IMAGE=quay.io/pypa/manylinux2010_${{ matrix.build-arch }}
run: make wheel-manylinux IMAGE=quay.io/pypa/${{ matrix.build-arch }}

- uses: actions/upload-artifact@v2
with:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

**Features**:

- Build and publish binary wheels for `arm64` / `aarch64` on macOS and Linux. ([#442](https://github.com/getsentry/symbolic/pull/442))

## 8.3.1

**Fixes**:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ sdist: .venv/bin/python
.PHONY: sdist

wheel: .venv/bin/python
cd py && ../.venv/bin/pip install -U wheel && ../.venv/bin/python setup.py bdist_wheel
cd py && ../.venv/bin/pip install -U wheel && ../.venv/bin/python setup.py bdist_wheel -p=$(PLATFORM)
.PHONY: wheel

wheel-manylinux:
Expand Down
10 changes: 9 additions & 1 deletion py/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,20 @@ def delete_scratchpad():
print("running `%s` (%s target)" % (" ".join(cmd), target))
build = spec.add_external_build(cmd=cmd, path=rust_path)

def find_dylib():
cargo_target = os.environ.get("CARGO_BUILD_TARGET")
if cargo_target:
in_path = "target/%s/%s" % (cargo_target, target)
else:
in_path = "target/%s" % target
return build.find_dylib("symbolic_cabi", in_path=in_path)

rtld_flags = ["NOW"]
if sys.platform == "darwin":
rtld_flags.append("NODELETE")
spec.add_cffi_module(
module_path="symbolic._lowlevel",
dylib=lambda: build.find_dylib("symbolic_cabi", in_path="target/%s" % target),
dylib=find_dylib,
header_filename=lambda: build.find_header(
"symbolic.h", in_path="symbolic-cabi/include"
),
Expand Down