Skip to content

Commit

Permalink
fix(build): improve Linux ARM64 cross-compilation setup
Browse files Browse the repository at this point in the history
This commit enhances the Linux build process with better cross-compilation:

- Add proper QEMU and Docker Buildx setup for ARM64
- Install cross-compilation tools for aarch64
- Set explicit container platform for ARM64 builds
- Split artifacts by architecture for better organization
- Update release job to handle all wheel types

These changes provide a more robust cross-compilation setup by:
1. Using proper emulation and cross-compilation tools
2. Setting explicit platform targets for containers
3. Organizing artifacts by architecture
4. Ensuring all wheels are properly published to PyPI
  • Loading branch information
dirvine committed Nov 28, 2024
1 parent bf02794 commit de8f1e0
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
name: wheels-x86_64
path: dist/*.whl
if-no-files-found: error

Expand All @@ -109,11 +109,19 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
- name: Install cross-compilation tools
run: |
sudo apt-get update
sudo apt-get install -y crossbuild-essential-arm64
python -m pip install --upgrade pip
python -m pip install cffi
python -m pip install patchelf
Expand All @@ -124,6 +132,7 @@ jobs:
manylinux: "2014"
args: --release --out dist --compatibility manylinux2014
target-features: +crt-static
container-options: --platform linux/arm64
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v3
Expand All @@ -148,28 +157,36 @@ jobs:
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
name: sdist
path: dist/*.tar.gz
if-no-files-found: error

release:
name: Release
runs-on: ubuntu-latest
needs: [macos, windows, linux-x86, linux-aarch64, sdist]
# Keep existing permissions
permissions:
id-token: write
contents: read
contents: write
steps:
- uses: actions/download-artifact@v3
with:
name: wheels-x86_64
path: dist
- uses: actions/download-artifact@v3
with:
name: wheels-aarch64
path: dist
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- name: Display structure of downloaded files
run: ls -R dist
- uses: actions/download-artifact@v3
with:
name: sdist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
verbose: true
print-hash: true
skip-existing: true
verbose: true

0 comments on commit de8f1e0

Please sign in to comment.