use more up-to-date GH actions and explicitly enable python 3.13 #33
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
name: Build + Deploy | |
on: | |
push: | |
branches: [master] | |
tags: ["v*.*.*"] | |
pull_request: | |
branches: [master] | |
release: | |
types: | |
- published | |
env: | |
PROJECT_NAME: brotli | |
PACKAGE_DIR: src/brotli | |
CIBW_TEST_COMMAND: python -m unittest discover -v -s {package}/python/ -p "*_test.py" | |
jobs: | |
build_sdist: | |
name: Build Source Distribution | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ${{ env.PACKAGE_DIR }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: pip install --upgrade setuptools twine | |
- name: Build sdist | |
run: python setup.py sdist | |
- name: Check metadata | |
run: twine check dist/*.tar.gz | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ env.PACKAGE_DIR }}/dist/*.tar.gz | |
name: sdist | |
build_wheels: | |
name: ${{ matrix.type }} ${{ matrix.arch }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, windows-latest] | |
arch: [auto64] | |
build: ["*"] | |
# temporarily disable building wheels for PyPy until this gets fixed: | |
# https://github.com/google/brotli-wheels/issues/19 | |
skip: ["pp*"] | |
include: | |
# the manylinux1 docker images only contain from python3.6 to 3.9 | |
- os: ubuntu-latest | |
type: manylinux1 | |
arch: auto | |
build: "cp{36,37,38,39}-*" | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 | |
CIBW_MANYLINUX_I686_IMAGE: manylinux1 | |
# the manylinux2010 image also contains python 3.10 | |
- os: ubuntu-latest | |
arch: auto | |
type: manylinux2010 | |
build: "cp310-*" | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010 | |
CIBW_MANYLINUX_I686_IMAGE: manylinux2010 | |
# the manylinux2014 image also contains python 3.11, 3.12 and 3.13 | |
- os: ubuntu-latest | |
arch: auto | |
type: manylinux2014 | |
build: "cp311-* cp312-* cp313-*" | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_MANYLINUX_I686_IMAGE: manylinux2014 | |
- os: macos-latest | |
arch: universal2 | |
build: "*" | |
skip: "pp*" | |
- os: windows-latest | |
arch: auto32 | |
build: "*" | |
skip: "pp*" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: pip install cibuildwheel | |
- name: Build Wheels | |
run: python -m cibuildwheel --output-dir wheelhouse "${PACKAGE_DIR}" | |
env: | |
CIBW_BUILD: ${{ matrix.build }} | |
CIBW_SKIP: ${{ matrix.skip }} | |
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.CIBW_MANYLINUX_I686_IMAGE }} | |
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.CIBW_MANYLINUX_X86_64_IMAGE }} | |
CIBW_ARCHS: ${{ matrix.arch }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: wheelhouse/*.whl | |
name: wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.type }} | |
build_arch_wheels: | |
name: py${{ matrix.python }} on ${{ matrix.arch }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# aarch64 uses qemu so it's slow, build each py version in parallel jobs | |
python: [36, 37, 38, 39, 310, 311, 312, 313] | |
arch: [aarch64, ppc64le] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: docker/[email protected] | |
with: | |
platforms: all | |
- name: Install dependencies | |
run: pip install cibuildwheel | |
- name: Build Wheels | |
run: python -m cibuildwheel --output-dir wheelhouse "${PACKAGE_DIR}" | |
env: | |
CIBW_BUILD: cp${{ matrix.python }}-* | |
CIBW_ARCHS: ${{ matrix.arch }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: wheelhouse/*.whl | |
name: wheels-${{ matrix.arch }}-${{ matrix.python }} | |
deploy: | |
name: Upload if release | |
needs: [build_wheels, build_arch_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
merge-multiple: true | |
- uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} |