Skip to content

Commit

Permalink
chore: add cibuildwheel action (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Oct 2, 2022
1 parent 18b1f45 commit f6e4c3c
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 7 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build

on:
release:
types:
- published

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]

steps:
- uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry
# Used to host cibuildwheel
- name: Set up Python
uses: actions/setup-python@v4

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.10.2

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
# to supply options, put them in 'env', like:
env:
CIBW_SKIP: cp36-*
CIBW_BEFORE_ALL_LINUX: apt-get install -y gcc || yum install -y gcc || apk add gcc
REQUIRE_CYTHON: 1

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

upload_pypi:
needs: [build_wheels]
runs-on: ubuntu-latest
environment: release

# alternatively, to publish when a GitHub Release is created, use the following rule:
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist

- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

# To test: repository_url: https://test.pypi.org/legacy/
6 changes: 5 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def build_extensions(self):
def build(setup_kwargs):
if os.environ.get("SKIP_CYTHON", False):
return
with contextlib.suppress(Exception):
try:
from Cython.Build import cythonize

setup_kwargs.update(
Expand All @@ -30,3 +30,7 @@ def build(setup_kwargs):
cmdclass=dict(build_ext=BuildExt),
)
)
except Exception:
if os.environ.get("REQUIRE_CYTHON"):
raise
pass
12 changes: 6 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f6e4c3c

Please sign in to comment.