Updated for Python 3.13. #45
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Automatically build binary wheels and source packages. | |
name: cibuildwheel | |
# Build on every branch push with tag. | |
on: | |
push: | |
tags: | |
- '*' | |
env: | |
PYTHON_VER: '3.10' # Python to run test/cibuildwheel | |
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-* cp313-* | |
CIBW_TEST_COMMAND: python -m unittest regex.test_regex | |
jobs: | |
# Run test on Ubuntu/macOS/Windows for every commit. | |
run_test: | |
name: Run test on ${{ matrix.platform }} | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VER }} | |
- name: Run test | |
run: | | |
python -m pip install -vv . | |
python -m unittest -v regex.test_regex | |
# Build Linux/macOS/Windows wheels. | |
build_wheels: | |
name: Build ${{ matrix.platform }} wheels | |
if: github.event_name == 'push' | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
env: | |
# macOS archs | |
CIBW_ARCHS_MACOS: "x86_64 arm64 universal2" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VER }} | |
- name: Install cibuildwheel & build wheels | |
run: | | |
python -m pip install -U cibuildwheel | |
python -m cibuildwheel --output-dir wheelhouse | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: regex-files | |
path: wheelhouse/*.whl | |
# I cannot get this to work! | |
# - name: Create GitHub release | |
# uses: actions/create-release@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# tag_name: ${{ github.ref }} | |
# release_name: regex ${{ github.ref }} | |
# Build source distribution & manylinux1_x86_64 wheels | |
# These two jobs build: | |
# 1, build_wheels (above): manylinux1_i686 / manylinux2014_x86_64 | |
# 2, build_in_manylinux2010 (this): manylinux1_x86_64 | |
# manylinux2014_x86_64 wheels use a new memcpy() function | |
# (memcpy@GLIBC_2.14), so the wheels are not compatible with | |
# manylinux1_x86_64 environment. In order to be compatible as | |
# much as possible, this job builds manylinux1_x86_64 wheels. | |
build_in_manylinux2010: | |
name: Build in manylinux2010 environment | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
env: | |
# Generate manylinux1_x86_64 wheels. | |
# tag pip CPython with the pip glibc | |
# manylinux1 >=8.1.0 3.5.2+, 3.6.0+ 2.5 (2006-09-29) | |
# manylinux2010 >=19.0 3.7.3+, 3.8.0+ 2.12 (2010-05-03) | |
# manylinux2014 >=19.3 3.7.8+, 3.8.4+, 3.9.0+ 2.17 (2012-12-25) | |
# manylinux_x_y >=20.3 3.8.10+, 3.9.5+, 3.10.0+ x.y | |
# manylinux2010 images EOL on 2022-08-01, it doesn't support cp311. | |
CIBW_BUILD: cp38-* cp39-* cp310-* | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010 | |
CIBW_ARCHS_LINUX: x86_64 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VER }} | |
- name: Build source distribution & wheels | |
run: | | |
python setup.py sdist --formats=gztar | |
python -m pip install -U cibuildwheel | |
python -m cibuildwheel --output-dir wheelhouse | |
- name: Upload source distribution | |
uses: actions/upload-artifact@v3 | |
with: | |
name: regex-files | |
path: dist/*.tar.gz | |
- name: Upload manylinux1_x86_64 wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: regex-files | |
path: wheelhouse/*.whl | |
# Build and upload aarch64/ppc64le/s390x wheels. | |
build_arch_wheels: | |
name: Build ${{ matrix.arch }} Linux wheels | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
arch: [aarch64, ppc64le, s390x] | |
# Building in QEMU is very slow, so parallelize the tasks. | |
skip_image: ["*musllinux*", "*manylinux*"] | |
env: | |
CIBW_ARCHS: ${{ matrix.arch }} | |
CIBW_SKIP: ${{ matrix.skip_image }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VER }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Install cibuildwheel & build wheels | |
run: | | |
python -m pip install -U cibuildwheel | |
python -m cibuildwheel --output-dir wheelhouse | |
- name: Upload ${{ matrix.arch }} wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: regex-files | |
path: wheelhouse/*.whl | |
# Upload to PyPI | |
upload_pypi: | |
name: Publish to PyPI | |
needs: [build_wheels, build_in_manylinux2010, build_arch_wheels] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: regex-files | |
path: dist | |
- name: Upload to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
skip_existing: true | |
verbose: true | |
print_hash: true |