Skip to content

Merge pull request #17 from oohlaf/manylinux-wheel #15

Merge pull request #17 from oohlaf/manylinux-wheel

Merge pull request #17 from oohlaf/manylinux-wheel #15

Workflow file for this run

name: CI
on:
push:
branches:
- master
- main
tags:
- 'v*'
pull_request:
jobs:
test:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: '3.9'
- os: macos-latest
python-version: '3.9'
- os: windows-latest
python-version: '3.9'
- os: ubuntu-latest
python-version: '3.10'
- os: macos-latest
python-version: '3.10'
- os: windows-latest
python-version: '3.10'
- os: ubuntu-latest
python-version: '3.11'
- os: macos-latest
python-version: '3.11'
- os: windows-latest
python-version: '3.11'
- os: ubuntu-latest
python-version: '3.12'
- os: macos-latest
python-version: '3.12'
- os: windows-latest
python-version: '3.12'
- os: ubuntu-latest
python-version: '3.13'
- os: macos-latest
python-version: '3.13'
- os: windows-latest
python-version: '3.13'
- os: ubuntu-latest
python-version: '3.14'
- os: macos-latest
python-version: '3.14'
- os: windows-latest
python-version: '3.14'
- os: ubuntu-latest
python-version: 'pypy-3.10'
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
setup.py
tox.ini
- name: Install build dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
- name: Install package
run: |
python -m pip install .
- name: Run tests
run: |
python -m unittest discover -s test -p 'test_*.py'
test-py27:
name: Python 2.7 on Ubuntu
runs-on: ubuntu-latest
container:
image: python:2.7.18-buster
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Build extension in place
run: |
python setup.py build_ext --inplace
- name: Run tests
run: |
python -m unittest discover -s test -p 'test_*.py'
build:
name: Build distributions
runs-on: ubuntu-latest
needs: [ test, test-py27 ]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
cache-dependency-path: |
setup.py
tox.ini
- name: Build source and wheel distributions
run: |
python -m pip install --upgrade pip build auditwheel
python -m build
- name: Repair Linux wheel for PyPI compatibility
if: runner.os == 'Linux'
run: |
python - <<'PY'
import glob
import os
import subprocess
wheels = sorted(glob.glob('dist/*.whl'))
if not wheels:
raise SystemExit('No wheel files found in dist/')
original_wheel = wheels[0]
subprocess.check_call([
'auditwheel', 'repair', original_wheel,
'--plat', 'manylinux2014_x86_64',
'-w', 'dist'
])
os.remove(original_wheel)
print('Repaired wheel output is ready in dist/')
PY
- name: Smoke test built artifacts
run: |
python -m venv .venv-smoke
. .venv-smoke/bin/activate
python -m pip install --upgrade pip
python -m pip install dist/*.whl
python -m unittest discover -s test -p 'test_*.py'
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
environment:
name: pypi
permissions:
id-token: write
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/