Skip to content

Build Wheels

Build Wheels #13

Workflow file for this run

---
name: Build Wheels
on:
workflow_dispatch:
jobs:
Standard:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-11.0, windows-latest, ubuntu-latest]
architecture: [x64]
include:
- os: windows-latest
architecture: x86
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
architecture: ${{ matrix.architecture }}
- name: Install clang
if: startsWith(matrix.os, 'windows')
uses: bwoodsend/setup-winlibs-action@v1
with:
architecture: ${{ matrix.architecture }}
with_clang: true
# Compile with clang by default which produces faster binaries.
- run: echo CC=clang >> $GITHUB_ENV
- run: pip wheel --no-deps -w dist .
- if: startsWith(matrix.os, 'macos')
run: MACOS_ARCHITECTURE=arm64 pip wheel --no-deps -w arm-dist .
- if: startsWith(matrix.os, 'ubuntu')
run: |
pip install auditwheel
export OLD_WHEEL="$(echo dist/*.whl)"
# When glibc on CI updates, update the manylinux variant as needed.
auditwheel repair "$OLD_WHEEL" --plat=manylinux2014_x86_64 -w dist
rm $OLD_WHEEL
- name: Test Wheel
run: |
pip install "$(echo dist/*.whl)[test]"
rm -rf motmot
pytest --no-cov
shell: bash
- if: startsWith(matrix.os, 'macos')
run: mv arm-dist/* dist
- uses: actions/upload-artifact@v3
with:
name: wheels-${{ matrix.os }}-${{ matrix.architecture }}
path: dist/*.whl
Whacky-Linux:
runs-on: ubuntu-latest
strategy:
matrix:
base:
- manylinux1_x86_64
- manylinux1_i686
- manylinux2014_aarch64
# Support these when NumPy provides wheels for them.
# - manylinux2014_ppc64le
# - manylinux2014_s390x
steps:
- uses: actions/checkout@v4
- uses: crazy-max/ghaction-docker-buildx@v3.3.0
- name: Build docker image
run: |
docker build -t bob-the-builder --build-arg BASE=${{ matrix.base }} .
- name: Build wheel
run: |
docker run -v "$(pwd):/io" bob-the-builder bash -c "
rm -rf build /tmp/dist
python setup.py -q bdist_wheel -d /tmp/dist
auditwheel repair /tmp/dist/*.whl -w dist
"
- name: Upload wheel(s) as build artifacts
uses: actions/upload-artifact@v3
with:
name: wheels-${{ matrix.base }}
path: dist/*.whl
- name: Install and test wheel
run: |
docker run -v "$(pwd)/tests:/tests" -v "$(pwd)/dist:/dist" \
-t bob-the-builder bash -c "
cd ~ &&
pip uninstall -y motmot &&
# Note that this assumes that there is only one wheel in dist.
pip install /dist/motmot*manylinux*.whl &&
pytest /tests
"