Skip to content

Commit

Permalink
Switch to cibuildwheel.
Browse files Browse the repository at this point in the history
codecov still needs fixing.
  • Loading branch information
anntzer committed Apr 14, 2023
1 parent ab52395 commit 01ba0e3
Showing 1 changed file with 16 additions and 78 deletions.
94 changes: 16 additions & 78 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,88 +16,26 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-20.04, macos-latest, windows-latest]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
os: [ubuntu-latest, macos-latest, windows-latest]
cibw-build: ['cp36-*', 'cp37-*', 'cp38-*', 'cp39-*', 'cp310-*', 'cp311-*']
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install
shell: bash
run: |
python -mpip install --upgrade pip setuptools wheel pytest pytest-cov &&
# Just check build, independently of possible problems in other packages.
python -mpip install --no-deps -ve . &&
python -mpip install -ve . &&
python -mpip list
- name: Test
shell: bash
run: |
python -mpytest --cov --cov-branch --cov-report=xml
- uses: codecov/codecov-action@v1
- name: Build wheels
shell: bash
run: |
git clean -xdf &&
case "$(python -c 'import sys; print(sys.platform)')" in
linux)
PV="$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')" &&
ABI="$(python -c 'import sys; print(sys.abiflags)')" &&
docker run --interactive --volume="$(pwd)":/io:Z --workdir=/io \
quay.io/pypa/manylinux2014_x86_64 bash <<EOF
CFLAGS='-static-libgcc -static-libstdc++' \
LDFLAGS='-static-libgcc -static-libstdc++' \
/opt/python/cp"$PV"-cp"$PV$ABI"/bin/python setup.py bdist_wheel --verbose &&
auditwheel --verbose repair --wheel-dir=/io/dist /io/dist/*.whl
EOF
;;
*)
python setup.py bdist_wheel
;;
esac
if: ${{ always() }}
- uses: actions/upload-artifact@v2
with:
name: wheels
path: dist/*.whl
if: ${{ always() }}

build_aarch64:
name: "Build wheel on ${{ matrix.pyver }} aarch64"
strategy:
matrix:
pyver: [cp36-cp36m, cp37-cp37m, cp38-cp38, cp39-cp39, cp310-cp310, cp311-cp311]
arch: [aarch64]
fail-fast: false
runs-on: ubuntu-latest
env:
py: /opt/python/${{ matrix.pyver }}/bin/python
img: quay.io/pypa/manylinux2014_${{ matrix.arch }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
- name: Test and wheel build
run: |
docker run --rm -v ${{ github.workspace }}:/io:rw --workdir=/io \
${{ env.img }} \
bash -exc '${{ env.py }} -m pip install virtualenv && ${{ env.py }} -m venv .env && \
source .env/bin/activate && \
echo "Installing dependencies" && \
pip install -U pip setuptools wheel pytest pytest-cov && \
pip install -ve . && \
pip list && \
python -mpytest --cov --cov-branch --cov-report=xml && \
python setup.py bdist_wheel --verbose && \
auditwheel --verbose repair --wheel-dir=dist dist/*.whl && \
deactivate'
- uses: actions/upload-artifact@v2
- uses: docker/setup-qemu-action@v2
if: runner.os == 'Linux'
- uses: pypa/cibuildwheel@v2.12.1
env:
CIBW_BUILD: ${{ matrix.cibw-build }}
CIBW_SKIP: '*-musllinux_*'
CIBW_TEST_SKIP: '*-macosx_universal2:arm64'
CIBW_ARCHS_LINUX: 'x86_64 aarch64'
CIBW_ARCHS_MACOS: 'x86_64 universal2'
CIBW_ARCHS_WINDOWS: 'AMD64'
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: python -mpytest --pyargs hmmlearn.tests
- uses: actions/upload-artifact@v3
with:
name: wheels
path: dist/*.whl
path: wheelhouse/*.whl
if: ${{ always() }}

0 comments on commit 01ba0e3

Please sign in to comment.