-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrating to pyproject.toml + cibuildwheel (#256)
* introduce pyproject.toml * introduce cibuildwheel * require cython during build (no silent fails anymore) * introduce PyPI test
- Loading branch information
Showing
13 changed files
with
305 additions
and
183 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: Build wheels | ||
|
||
on: [workflow_dispatch] | ||
|
||
jobs: | ||
make_sdist: | ||
name: Make SDist | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Optional, use if you use setuptools_scm | ||
submodules: true # Optional, use if you have submodules | ||
|
||
- name: Install dependencies | ||
run: python -m pip install cython numpy pysam | ||
|
||
- name: Build SDist | ||
run: pipx run build --sdist | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-sdist | ||
path: dist/*.tar.gz | ||
|
||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
# macos-13 is an intel runner, macos-14 is apple silicon | ||
os: [ubuntu-latest] | ||
#, windows-latest, macos-13, macos-14] | ||
python-version: [ "3.11" ] # "3.7", "3.8", "3.9", "3.10", | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
# - name: Build wheels | ||
# uses: pypa/cibuildwheel@v2.21.0 | ||
# # uses: pypa/cibuildwheel@v2.17.0 | ||
# # env: | ||
# # CIBW_SOME_OPTION: value | ||
# # ... | ||
# # with: | ||
# # package-dir: . | ||
# # output-dir: wheelhouse | ||
# # config-file: "{package}/pyproject.toml" | ||
|
||
- name: Install cibuildwheel | ||
run: python -m pip install cibuildwheel==2.22.0 | ||
|
||
- name: Build wheels | ||
run: python -m cibuildwheel --output-dir dist | ||
# to supply options, put them in 'env', like: | ||
env: | ||
#CIBW_BUILD_FRONTEND: "pip; args: --no-build-isolation" | ||
CIBW_BUILD_FRONTEND: "build; args: --no-isolation" | ||
CIBW_BEFORE_ALL: "yum install bzip2-devel xz-devel -y;" | ||
|
||
# we have to recompile pysam so that repairwheel can later find various libraries (libssl, libnghttp2, etc) | ||
#CIBW_BEFORE_ALL: "yum install bzip2-devel xz-devel openssl-devel openldap-devel krb5-devel libssh-devel libnghttp2-devel -y;" | ||
CIBW_BEFORE_BUILD: "python -m pip install setuptools cython numpy pysam --no-binary pysam" | ||
|
||
# skip building 32-bit wheels (i686) | ||
CIBW_ARCHS_LINUX: "auto64" | ||
|
||
# we could use 2_28 to download pysam's wheel instead of compiling it ; | ||
# HOWEVER THAT DIDN'T WORK BECAUSE PYSAM DEPENDS ON LIBSSL, LIBNGHTTP2, ETC, WHICH CANNOT BE FOUND | ||
# SO WE ARE BACK TO COMPILING PYSAM'S WHEEL (no-binary pysam) | ||
# CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28" | ||
|
||
## skip building pypy and musllinux | ||
CIBW_SKIP: pp* *musllinux* | ||
|
||
#CIBW_REPAIR_WHEEL_COMMAND: 'auditwheel -v repair -w {dest_dir} {wheel}' | ||
|
||
#PIP_NO_CACHE_DIR: "false" | ||
#PIP_NO_BUILD_ISOLATION: "false" | ||
#PIP_NO_BINARY: "pysam" | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | ||
path: ./dist/*.whl |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,51 @@ | ||
|
||
# This workflows will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
name: Publish Python Package to Test PyPI | ||
|
||
on: | ||
release: | ||
types: [prereleased] | ||
# release: | ||
# types: [published] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
|
||
publish_all: | ||
name: Publish wheels and sdist to Test PyPI | ||
|
||
# if: github.event_name == 'release' && github.event.action == 'published' | ||
|
||
environment: testpypi | ||
permissions: | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine cython numpy pysam | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist | ||
twine upload --repository-url https://test.pypi.org/legacy/ dist/* | ||
- uses: dawidd6/action-download-artifact@v7 | ||
with: | ||
# Required, if the repo is private a Personal Access Token with `repo` scope is needed or GitHub token in a job where the permissions `action` scope set to `read` | ||
#github_token: ${{secrets.GITHUB_TOKEN}} | ||
# Optional, workflow file name or ID | ||
# If not specified, will be inferred from run_id (if run_id is specified), or will be the current workflow | ||
workflow: python-build-wheels.yml | ||
# Optional, the status or conclusion of a completed workflow to search for | ||
# Can be one of a workflow conclusion: | ||
# "failure", "success", "neutral", "cancelled", "skipped", "timed_out", "action_required" | ||
# Or a workflow status: | ||
# "completed", "in_progress", "queued" | ||
# Use the empty string ("") to ignore status or conclusion in the search | ||
workflow_conclusion: success | ||
|
||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
packages-dir: cibw-sdist | ||
repository-url: https://test.pypi.org/legacy/ | ||
|
||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
packages-dir: cibw-wheels-ubuntu-latest-0 | ||
repository-url: https://test.pypi.org/legacy/ | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,48 @@ | ||
# # This workflow will upload a Python Package using Twine when a release is created | ||
# # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
# name: Upload Python Package | ||
|
||
# on: | ||
# release: | ||
# types: [created] | ||
|
||
# jobs: | ||
# deploy: | ||
|
||
# runs-on: ubuntu-latest | ||
|
||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - name: Set up Python | ||
# uses: actions/setup-python@v2 | ||
# with: | ||
# python-version: '3.10' | ||
# - name: Install dependencies | ||
# run: | | ||
# python -m pip install --upgrade pip | ||
# pip install setuptools wheel twine cython pysam numpy | ||
# - name: Build and publish | ||
# env: | ||
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
# run: | | ||
# python setup.py sdist | ||
# twine upload dist/* | ||
|
||
|
||
name: Publish Python Package to PyPI | ||
|
||
on: | ||
release: | ||
types: [published] | ||
# release: | ||
# types: [published] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
Publish: | ||
# prevents this action from running on forks | ||
if: github.repository == 'open2c/pairtools' | ||
|
||
runs-on: ubuntu-latest | ||
publish_all: | ||
name: Publish wheels and sdist to PyPI | ||
|
||
# if: github.event_name == 'release' && github.event.action == 'published' | ||
|
||
environment: pypi | ||
permissions: | ||
id-token: write | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: dawidd6/action-download-artifact@v7 | ||
with: | ||
# Required, if the repo is private a Personal Access Token with `repo` scope is needed or GitHub token in a job where the permissions `action` scope set to `read` | ||
#github_token: ${{secrets.GITHUB_TOKEN}} | ||
# Optional, workflow file name or ID | ||
# If not specified, will be inferred from run_id (if run_id is specified), or will be the current workflow | ||
workflow: python-build-wheels.yml | ||
# Optional, the status or conclusion of a completed workflow to search for | ||
# Can be one of a workflow conclusion: | ||
# "failure", "success", "neutral", "cancelled", "skipped", "timed_out", "action_required" | ||
# Or a workflow status: | ||
# "completed", "in_progress", "queued" | ||
# Use the empty string ("") to ignore status or conclusion in the search | ||
workflow_conclusion: success | ||
|
||
- name: Setup | ||
uses: actions/setup-python@v5 | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
python-version: "3.x" | ||
cache: 'pip' # caching pip dependencies | ||
|
||
- name: Install, build | ||
run: | | ||
python -m pip install --upgrade pip wheel setuptools build | ||
python -m pip install --upgrade cython pysam | ||
python -m pip install -r requirements-dev.txt | ||
python -m build | ||
packages-dir: cibw-sdist | ||
|
||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
packages-dir: cibw-wheels-ubuntu-latest-0 | ||
|
||
|
||
|
||
|
||
|
||
|
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
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
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
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
Oops, something went wrong.