Refactor readme, changelog + use SPDF license identifier #44
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
name: build | |
on: | |
push: | |
branches: | |
- "master" | |
- "ci-*" | |
tags: | |
pull_request: | |
env: | |
PYTHON_VER: "3.11" # Python to run test/cibuildwheel | |
CIBW_BUILD: > | |
cp38-* cp39-* cp310-* cp311-* cp312-* | |
pp38-* pp39-* pp310-* | |
CIBW_TEST_COMMAND: python -m unittest discover {project}/tests | |
jobs: | |
test_cpython: | |
name: Test on ${{ matrix.platform }} ${{ matrix.architecture }} ${{ matrix.build_option }} | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
matrix: | |
platform: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
build_option: | |
- "--warning-as-error" | |
- "--warning-as-error --multi-phase-init" | |
- "--warning-as-error --cffi" | |
architecture: | |
- x64 | |
include: | |
- platform: windows-latest | |
build_option: "--warning-as-error" | |
architecture: x86 | |
- platform: windows-latest | |
build_option: "--warning-as-error --multi-phase-init" | |
architecture: x86 | |
- platform: windows-latest | |
build_option: "--warning-as-error --cffi" | |
architecture: x86 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VER }} | |
architecture: ${{ matrix.architecture }} | |
- name: Run test | |
run: | | |
python -m pip install cffi | |
python -m pip install --config-settings="--build-option=${{ matrix.build_option }}" -vv . | |
python -m unittest discover tests | |
test_cpython_debug: | |
name: Test debug build on Ubuntu ${{ matrix.build_option }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
build_option: | |
- "--warning-as-error --debug" | |
- "--warning-as-error --debug --multi-phase-init" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Run test | |
run: | | |
sudo apt-get update | |
sudo apt-get install python3-dbg | |
sudo python3-dbg -m pip install -U pip | |
python3-dbg -m pip install --config-settings="--build-option=${{ matrix.build_option }}" -vv . | |
python3-dbg -m unittest discover tests | |
test_pypy: | |
name: Test on ${{ matrix.py }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
py: | |
- "pypy-3.8" | |
- "pypy-3.9" | |
- "pypy-3.10" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.py }} | |
- name: Build & test | |
run: | | |
sudo apt-get install -q -y zstd libzstd1 libzstd-dev | |
python -m pip install --config-settings="--build-option=--dynamic-link-zstd --warning-as-error" -v . | |
python -m unittest discover tests | |
# If the head commit message contains '<more-tests>', run test on | |
# armv6/armv7/aarch64/ppc64le/s390x/riscv64 architectures. | |
test_arches: | |
name: Test on ${{ matrix.distro }} ${{ matrix.arch }} | |
if: github.event_name == 'push' && contains(github.event.head_commit.message, '<more-tests>') | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
arch: | |
- armv6 | |
- armv7 | |
- aarch64 | |
- ppc64le | |
- s390x | |
distro: | |
- alpine_latest | |
include: | |
- arch: riscv64 | |
distro: alpine_edge | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: uraimo/run-on-arch-action@v2 | |
name: Build & run test | |
with: | |
arch: ${{ matrix.arch }} | |
distro: ${{ matrix.distro }} | |
install: | | |
apk update | |
apk add python3 python3-dev py3-pip build-base gcc | |
run: | | |
python3 -m venv pyzstd-venv | |
. pyzstd-venv/bin/activate | |
python3 -m pip install --config-settings="--build-option=--warning-as-error" -v . | |
python3 -m unittest discover tests | |
build_sdist: | |
name: Build sdist | |
if: startsWith(github.ref, 'refs/tags') || startsWith(github.head_ref, 'release-') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VER }} | |
- name: Build sdist | |
run: | | |
python -m pip install -U build | |
python -m build --sdist | |
- name: List distributions | |
run: ls -lR dist | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-sdist | |
path: dist/*.tar.gz | |
build_wheels: | |
name: Build wheels on ${{ matrix.platform }} | |
if: startsWith(github.ref, 'refs/tags') || startsWith(github.head_ref, 'release-') | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
matrix: | |
platform: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
env: | |
CIBW_ARCHS_MACOS: "x86_64 arm64" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VER }} | |
- name: Build wheels | |
run: | | |
python -m pip install -U cibuildwheel | |
python -m cibuildwheel --output-dir wheelhouse | |
- name: List distributions | |
run: ls -lR wheelhouse | |
shell: bash | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.platform }} | |
path: wheelhouse/*.whl | |
build_arch_wheels: | |
name: Build wheels for ${{ matrix.arch }} (skip ${{ matrix.skip_image }}) | |
if: startsWith(github.ref, 'refs/tags') || startsWith(github.head_ref, 'release-') | |
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@v4 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VER }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Build wheels | |
run: | | |
python -m pip install -U cibuildwheel | |
python -m cibuildwheel --output-dir wheelhouse | |
- name: List distributions | |
run: ls -lR wheelhouse | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.arch }}-${{ matrix.skip_image }} | |
path: wheelhouse/*.whl | |
upload_pypi: | |
name: Publish to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
needs: | |
- build_sdist | |
- build_wheels | |
- build_arch_wheels | |
runs-on: ubuntu-latest | |
environment: publish | |
permissions: | |
id-token: write # This permission is mandatory for trusted publishing | |
steps: | |
- name: Download wheels | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- name: List distributions | |
run: ls -lR dist | |
- name: Upload to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip-existing: true | |
verbose: true | |
print-hash: true |