Skip to content

Commit

Permalink
workflows: build wheels on Linux and macOS
Browse files Browse the repository at this point in the history
The convert module doesn't use any libc APIs, so we can build on any Linux
and auditwheel will tag it as the oldest manylinux.

Signed-off-by: Benjamin Gilbert <[email protected]>
  • Loading branch information
bgilbert committed Nov 1, 2023
1 parent 40e7604 commit 7e214a0
Showing 1 changed file with 47 additions and 5 deletions.
52 changes: 47 additions & 5 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,36 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
# setup-python's Python < 3.11 won't build universal binaries
# https://github.com/actions/setup-python/issues/439#issuecomment-1247646682
include:
- os: macos-latest
python-version: "3.8"
brew-python: true
- os: macos-latest
python-version: "3.9"
brew-python: true
- os: macos-latest
python-version: "3.10"
brew-python: true
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
if: "! matrix.brew-python"
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }} (macOS fallback)
if: matrix.brew-python
run: |
brew install python@${{matrix.python-version}}
python3 -V
pip3 -V
- name: Install Python tools
run: |
python -m pip install --upgrade pip
pip install build jinja2 pytest
python3 -m pip install --upgrade pip
pip3 install auditwheel build jinja2 pytest setuptools
- name: Install OpenSlide
run: |
case "${{ matrix.os }}" in
Expand All @@ -53,13 +72,36 @@ jobs:
;;
esac
- name: Build wheel
run: python -m build -w
run: |
python3 -m build -w
case "${{ matrix.os }}" in
ubuntu-*)
mv dist old
auditwheel repair --only-plat -w dist old/*whl
;;
macos-*)
if [ ! -e dist/*universal2* ]; then
echo "Wheel is not universal:"
ls dist
exit 1
fi
;;
esac
basename=openslide-python-wheels-$GITHUB_RUN_NUMBER-$(echo $GITHUB_SHA | cut -c-10)
mkdir -p "artifacts/${basename}"
mv dist/*.whl "artifacts/${basename}"
echo "basename=${basename}" >> $GITHUB_ENV
- name: Install
run: pip install dist/*.whl
run: pip3 install artifacts/${basename}/*.whl
- name: Run tests
run: pytest -v
- name: Tile slide
run: python examples/deepzoom/deepzoom_tile.py --viewer -o tiled tests/fixtures/small.svs
run: python3 examples/deepzoom/deepzoom_tile.py --viewer -o tiled tests/fixtures/small.svs
- name: Archive wheel
uses: actions/upload-artifact@v3
with:
name: ${{ env.basename }}
path: artifacts
windows:
name: Windows
needs: pre-commit
Expand Down

0 comments on commit 7e214a0

Please sign in to comment.