Skip to content

Use build/setuptools to build crc32c #300

Use build/setuptools to build crc32c

Use build/setuptools to build crc32c #300

name: Build and release to PyPI
# Build on every branch push, tag push, and pull request change:
on:
push:
pull_request:
schedule:
# 00:00 UTC every Saturday, don't bother anyone
- cron: '0 0 * * 6'
jobs:
build_wheels:
name: Build wheels on ${{matrix.arch}} for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2019, macos-14]
arch: [auto]
include:
- os: ubuntu-20.04
arch: aarch64
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
if: ${{ matrix.arch == 'aarch64' }}
name: Set up QEMU
- name: Run cibuildwheel
uses: pypa/cibuildwheel@v2.22.0
env:
CIBW_ARCHS_LINUX: ${{matrix.arch}}
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: "python -u {project}/run-tests.py"
CIBW_ARCHS_MACOS: "x86_64 arm64 universal2"
CIBW_TEST_SKIP: '*macosx_arm64 *universal2:arm64'
CIBW_BUILD_VERBOSITY: 1
CIBW_ENABLE: pypy cpython-freethreading
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.13'
- name: Install build
run: pip install build
- name: Build sdist
run: python -m build -s
- uses: actions/upload-artifact@v4
with:
name: source-dist
path: dist/*.tar.gz
test_sdist:
name: Check source distribution is usable
needs: [build_sdist]
runs-on: ubuntu-22.04
steps:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.13"
- uses: actions/download-artifact@v4
with:
name: source-dist
- name: Extract source distribution
run: tar xvf crc32c*.tar.gz && rm crc32c*.tar.gz
- name: Install source distribution
run: pip install ./crc32c*
- name: Install test dependencies
run: pip install pytest
- name: Run source distribution tests
run: cd crc32c* && python run-tests.py
merge_artifacts:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: all-artifacts
upload_pypi:
needs: [merge_artifacts]
runs-on: ubuntu-22.04
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
name: all-artifacts
path: dist
- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}