Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 72 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: publish

on:
push:
tags:
- v*
on: [push, pull_request]

jobs:
pypi:
build:
runs-on: ubuntu-latest

steps:
Expand All @@ -15,18 +12,80 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install python dependencies
run: pip install Cython auditwheel
- name: Build a source tarball
run: python setup.py sdist
- name: Build wheels
uses: RalfG/python-wheels-manylinux-build@v0.4.2-manylinux2014_x86_64
with:
python-versions: 'cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313 cp314-cp314'
build-requirements: 'cython'
- name: Clean linux_x86_64.whl
run: rm dist/*-linux_x86_64.whl
- name: Build Wheel
run: python setup.py bdist_wheel --py-limited-api=cp39
- name: Repair Wheel
run: find dist -name *.whl -print -exec auditwheel repair {} \;
- name: Clean Non Audited Wheel
run: rm -v dist/*-linux_x86_64.whl
- name: Check build result
run: ls -lh dist/
run: |
ls -lh dist
find dist -name *.tar.gz -print -exec tar -ztvf {} \;
ls -lh wheelhouse
find wheelhouse -name *.whl -print -exec unzip -l {} \;
- uses: actions/upload-artifact@v4
with:
name: wheel
path: wheelhouse/*.whl
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz

test:
needs: [build]
runs-on: ubuntu-latest
strategy:
matrix:
pyver: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4
with:
# only checkout files for test
sparse-checkout: |
tests
misc/test.sh
- uses: actions/download-artifact@v4
with:
name: wheel
path: wheel
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.pyver }}
- name: Install python dependencies
run: |
pip install gevent
pip install wheel/*.whl
- name: Run test
run: misc/test.sh

pypi:
needs: [build, test]
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v4
with:
name: wheel
path: dist
- uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: dump result
run: |
ls -lh dist
find dist -name *.whl -print -exec unzip -l {} \;
find dist -name *.tar.gz -print -exec tar -ztvf {} \;
- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip_existing: true
Expand Down
16 changes: 15 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
from glob import glob
from setuptools import setup, Extension

version = "0.4.4"
version = "0.5.0"


def readme():
with open("README.rst") as f:
return f.read()


def make_limited_api_macro(version):
s = 0
step = 8
pos = step * 3
for i in version.split("."):
s += int(i) << pos
pos -= step
return s


include_dirs = ["include"]
sources = glob("*.pyx") + glob("src/*.c")
libraries = ["dl"]
Expand Down Expand Up @@ -50,6 +60,10 @@ def readme():
sources,
include_dirs=include_dirs,
libraries=libraries,
define_macros=[
("Py_LIMITED_API", make_limited_api_macro("3.9")),
],
py_limited_api=True,
)
],
)