Skip to content

Commit

Permalink
Build cross platform wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
rickardp committed Oct 5, 2022
1 parent 609fe23 commit f498914
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
29 changes: 24 additions & 5 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "pypy2.7", "pypy3.9"]
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10", "pypy3.9"]
arch: [x86_64, aarch64]
exclude:
- os: macos-latest
python-version: "3.5"
- os: windows-latest
python-version: "3.5"
arch: aarch64
- os: macos-latest # Not yet supported by GitHub actions
arch: aarch64
- arch: aarch64 # Python 2.7 does not have a supported manylinux image for ARM64
python-version: "2.7"
- os: macos-latest
python-version: "3.6"
- os: windows-latest
Expand All @@ -37,11 +40,27 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: pip install --upgrade pip && pip install wheel auditwheel
- run: pip install --upgrade pip && pip install wheel
- name: Set up Docker multiarch
if: startsWith(matrix.os, 'ubuntu')
uses: docker/setup-qemu-action@v2
- name: Build
if: startsWith(matrix.os, 'ubuntu')
run: |
if [ "${{ matrix.python-version }}" == "2.7" ]; then
manylinux_image=manylinux1
else
manylinux_image=manylinux2014
fi
image=quay.io/pypa/${manylinux_image}_${{ matrix.arch }}
echo "Using image $image"
docker run --user $(id -u) -i -w /src -v $PWD:/src $image ./make_manylinux.sh ${{ matrix.python-version }}
ls -lR ./dist/
- name: Test
run: |
python setup.py test
- name: Build
if: "!startsWith(matrix.os, 'ubuntu')"
run: |
python setup.py bdist_wheel
- name: Upload build artifact
Expand Down
16 changes: 16 additions & 0 deletions make_manylinux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
set -e

ver=$(echo $1 | sed -e s/\\.// -e 's/^\([0-9]\)/cp\1/')
actual_ver=$(ls /opt/python/ | grep $ver | head -1)
if [ -z "$actual_ver" ]; then
echo "Version not found"
exit 1
fi
/opt/python/$actual_ver/bin/python setup.py bdist_wheel --dist-dir /tmp
pushd /tmp
auditwheel show /tmp/*.whl
auditwheel repair /tmp/*.whl
popd
mkdir -p ./dist/
mv /tmp/wheelhouse/*.whl ./dist/
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
Expand Down

0 comments on commit f498914

Please sign in to comment.