Skip to content

Commit

Permalink
refactor build wheel workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mammothb committed Mar 29, 2024
1 parent 97c4cca commit e9776f5
Showing 1 changed file with 43 additions and 15 deletions.
58 changes: 43 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,56 @@ name: Tests
on: [push, pull_request]

jobs:
build:
name: Build wheel for on cp${{ matrix.python }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build
run: |
python -m pip install --upgrade pip
python -m pip install build
python -m build --sdist
pip install -v dist/editdistpy-*.tar.gz
- name: Install test dependencies
run: |
python -m pip install pytest numpy symspellpy
pytest tests
- uses: actions/upload-artifact@v4
with:
name: artifact-sdist
path: dist/*.tar.gz
build_wheels_linux:
name: Build wheels for ubuntu-latest/${{ matrix.arch }}/${{ matrix.python_tag }}
needs: [build_sdist]
runs-on: ubuntu-latest
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, windows-latest, macos-latest]

arch: [x86_64]
python_tag: ["cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*"]
steps:
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/[email protected]
- uses: actions/download-artifact@v4
with:
name: artifact-sdist
path: dist
- name: Copy wheel
run: cp dist/editdistpy-*.tar.gz editdistpy.tar.gz
- name: Build wheel
uses: pypa/[email protected]
env:
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform }}
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.python_tag }}
CIBW_BUILD_VERBOSITY: 3
CIBW_BEFORE_TEST: pip install -r {project}/requirements-dev.txt
CIBW_BEFORE_TEST: pip install symspellpy --no-deps
CIBW_TEST_REQUIRES: pytest numpy
CIBW_TEST_COMMAND: pytest -sv {project}/tests

with:
package-dir: editdistpy.tar.gz
output-dir: wheelhouse
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl

0 comments on commit e9776f5

Please sign in to comment.