diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index f6cc4099..d876570d 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -41,7 +41,7 @@ jobs: - name: Install Python tools run: | python -m pip install --upgrade pip - pip install build jinja2 pytest + pip install auditwheel build jinja2 setuptools pytest - name: Install OpenSlide run: | case "${{ matrix.os }}" in @@ -53,13 +53,36 @@ jobs: ;; esac - name: Build wheel - run: python -m build -w + run: | + if [[ "${{ matrix.os }}" == macos-* ]]; then + py_cflags=$(python -c 'import sysconfig; print(sysconfig.get_config_vars()["CFLAGS"])') + echo "Python compile flags: $py_cflags" + if [[ $py_cflags !~ "-arch x86_64" || $py_cflags !~ "-arch arm64" ]]; then + echo "Working around missing universal binary flags" + export CFLAGS="-arch x86_64 -arch arm64" + export LDFLAGS="$CFLAGS" + fi + fi + python -m build -w + if [[ "${{ matrix.os }}" == ubuntu-* ]]; then + mv dist old + auditwheel repair --only-plat -w dist old/*whl + fi + 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: pip 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 + - name: Archive wheel + uses: actions/upload-artifact@v3 + with: + name: ${{ env.basename }} + path: artifacts windows: name: Windows needs: pre-commit