Skip to content

Prepare v1.0.0

Prepare v1.0.0 #187

Workflow file for this run

name: build
on:
push:
branches:
- "master"
- "ci-*"
tags:
- "**"
pull_request:
workflow_dispatch:
env:
PY_COLORS: 1
jobs:
test_integration:
name: Test integration | Python 3.14
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: Test
run: python tests/test_integration.py
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: python -m pip install -U build
- name: Build sdist
run: python -m build --sdist
- name: List distributions
run: ls -lR dist
- name: Save build artifacts
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist
- name: Install sdist
run: python -m pip install dist/*.tar.gz
- name: Test
run: python -m unittest discover tests -v
define_build_wheels_matrix:
name: Define build wheels matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.define.outputs.matrix }}
full: ${{ steps.define.outputs.full }}
env:
PYTHON_VERSIONS: cp39 cp310 cp311 cp312 cp313 cp313t pp310 pp311
FULL:
${{ ( startsWith(github.ref, 'refs/tags') || startsWith(github.head_ref,
'release-') || github.event_name == 'workflow_dispatch' ) && '1' || '0' }}
steps:
- name: Define include matrix
id: define
shell: python
run: |
import json
import os
PYTHON_VERSIONS = os.environ["PYTHON_VERSIONS"].split()
FULL = os.environ["FULL"] == "1"
CASES = []
def add(name, platform, archs, build, qemu=False):
CASES.append(locals())
for identifier in ("manylinux", "musllinux"):
build = " ".join(f"{py}-{identifier}_*" for py in PYTHON_VERSIONS if identifier=="manylinux" or py.startswith("cp"))
add(f"Linux regular {identifier}", "ubuntu-latest", "x86_64 i686", build)
if FULL:
for arch in ("aarch64", "ppc64le", "s390x"):
add(f"Linux {arch} {identifier}", "ubuntu-latest", arch, build, True)
build = " ".join(f"{py}-*" for py in PYTHON_VERSIONS)
add("Windows regular", "windows-latest", "AMD64 x86", build)
if FULL:
add("Windows arm", "windows-11-arm", "ARM64", build)
add("macOS regular", "macos-latest", "x86_64 arm64", build)
print("full:", FULL)
print(json.dumps(CASES, indent=2))
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
if FULL:
f.write("full=1\n")
f.write(f"matrix={json.dumps(CASES, indent=None)}\n")
build_wheels:
name: Build wheels | ${{ matrix.name }}
runs-on: ${{ matrix.platform }}
needs:
- build_sdist
- define_build_wheels_matrix
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.define_build_wheels_matrix.outputs.matrix) }}
env:
CIBW_ARCHS: ${{ matrix.archs }}
CIBW_BUILD: ${{ matrix.build }}
CIBW_ENABLE: cpython-freethreading pypy pypy-eol
CIBW_TEST_COMMAND: python -m unittest discover {project}/tests -v
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: python -m pip install -U cibuildwheel
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: sdist
path: sdist
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: ${{ matrix.qemu }}
- name: Build wheels
run: python -m cibuildwheel --output-dir dist sdist/*.tar.gz
shell: bash
- name: List distributions
run: ls -lR dist
shell: bash
- name: Save build artifacts
uses: actions/upload-artifact@v4
with:
name: wheels ${{ matrix.name }}
path: dist/*.whl
test_specific_python_versions:
name: Test on Python version | ${{ matrix.version }}
runs-on: ubuntu-latest
container: docker.io/library/python:${{ matrix.version }}-slim
needs:
- build_wheels
strategy:
fail-fast: false
matrix:
include:
- version: "3.9.0"
file_pattern: "*-cp39-cp39-manylinux*x86_64*.whl"
- version: "3.10.0"
file_pattern: "*-cp310-cp310-manylinux*x86_64*.whl"
- version: "3.11.0"
file_pattern: "*-cp311-cp311-manylinux*x86_64*.whl"
- version: "3.12.0"
file_pattern: "*-cp312-cp312-manylinux*x86_64*.whl"
- version: "3.13.0"
file_pattern: "*-cp313-cp313-manylinux*x86_64*.whl"
steps:
- uses: actions/checkout@v4
- name: Restore build artifacts
uses: actions/download-artifact@v4
with:
name: wheels Linux regular manylinux
path: dist
- name: Python version
run: python -VV
- name: Install package
run: python -m pip install dist/${{ matrix.file_pattern }}
- name: Test
run: python -m unittest discover tests -v
test_system_zstd:
name:
Test system zstd | ${{ matrix.pypy && 'PyPy' || 'CPython' }} ${{ matrix.system &&
'system' || 'distributed' }}
runs-on: ubuntu-latest
needs:
- build_sdist
strategy:
fail-fast: false
matrix:
pypy: [false, true]
system: [false, true]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.pypy && 'pypy3.11' || '3.13' }}"
- name: Restore build artifacts
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Install package
run:
python -m pip install ${{ matrix.system &&
'--config-settings=--build-option=--system-zstd' || '' }} dist/*.tar.gz
- name: Check dynamic libraries requirements
shell: python
run: |
from backports import zstd
import inspect
import subprocess
import sys
filename = inspect.getfile(zstd.${{ matrix.pypy && '_zstd_cffi' || '_zstd' }})
ldd_out = subprocess.check_output(["ldd", filename], text=True)
print(ldd_out)
expected_zstd = ${{ matrix.system && 'True' || 'False' }}
got_zstd = "zstd" in ldd_out
sys.exit(got_zstd != expected_zstd)
- name: Test
run: python -m unittest discover tests -v
env:
BACKPORTSZSTD_SKIP_EXTENSION_TEST: "${{ matrix.system && '1' || '0' }}"
test_typing:
name: Test typing | ${{ matrix.kind }}
runs-on: ubuntu-latest
needs:
- build_sdist
- build_wheels
strategy:
fail-fast: false
matrix:
include:
- kind: sdist
artifact_name: "sdist"
file_pattern: "*.tar.gz"
- kind: wheel
artifact_name: "wheels Linux regular manylinux"
file_pattern: "*-cp313-cp313-manylinux*x86_64*.whl"
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Restore build artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: dist
- name: Install package
run: python -m pip install dist/${{ matrix.file_pattern }}
- name: Install mypy
run: python -m pip install mypy
- name: Test typing
run: mypy tests/test_integration.py
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
if:
startsWith(github.ref, 'refs/tags') &&
needs.define_build_wheels_matrix.outputs.full
needs:
- build_sdist
- build_wheels
- test_integration
- test_specific_python_versions
- test_system_zstd
- test_typing
environment: publish
permissions:
id-token: write # This permission is mandatory for trusted publishing
steps:
- name: Restore build artifacts
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Restore build artifacts
uses: actions/download-artifact@v4
with:
pattern: wheels*
path: dist
merge-multiple: true
- name: List distributions
run: ls -lR dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
print-hash: true