-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build and upload binary wheels in CI #36
Merged
Merged
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
c04b6be
add pyproject.toml, set minimum python version to 3.6
zariiii9003 b60f64c
test 3.12
zariiii9003 3d159fa
do not run setup.py
zariiii9003 f0ec7b6
update actions
zariiii9003 65a69f3
use cibuildwheel
zariiii9003 5789422
raise minimum python version to 3.7 because of setuptools compatibility
zariiii9003 f2373a2
explicitly set packages, fix setuptools complaints about newlines in …
zariiii9003 192113e
try to fix pytest command
zariiii9003 1dfd0de
use src package structure
zariiii9003 c66303b
try to build pypy wheels
zariiii9003 fbbf30b
skip pypy
zariiii9003 bf64067
run `ruff --select UP --select I --fix src`
zariiii9003 7284780
update MANIFEST.in
zariiii9003 8a05fe7
do not run setup.py
zariiii9003 0600347
build and release wheels whenever a release is published on GitHub
zariiii9003 01390db
do not limit max. parallel CI jobs
zariiii9003 d155afc
use pytest
zariiii9003 de878f9
fix path, set fail-fast: false
zariiii9003 4156afb
publish on tag and workflow_dispatch
zariiii9003 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,64 @@ | ||
name: Build & Release | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# Used to host cibuildwheel | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install cibuildwheel | ||
run: python -m pip install cibuildwheel | ||
|
||
- name: Build wheels | ||
run: python -m cibuildwheel --output-dir wheelhouse | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
|
||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Build sdist | ||
run: pipx run build --sdist | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: dist/*.tar.gz | ||
|
||
release: | ||
name: Publish distribution 📦 to PyPI | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
skip_existing: true | ||
password: ${{ secrets.pypi_password }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
test: | ||
python3 setup.py build_ext -b . | ||
python3 -m pip install -e . | ||
python3 -m unittest |
This file was deleted.
Oops, something went wrong.
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,55 @@ | ||
[build-system] | ||
build-backend = 'setuptools.build_meta' | ||
requires = ["setuptools >= 68.0"] | ||
|
||
[project] | ||
name = "bitstruct" | ||
description = """This module performs conversions between Python values \ | ||
and C bit field structs represented as Python \ | ||
byte strings.""" | ||
readme = "README.rst" | ||
requires-python = ">=3.7" | ||
license = { text = "MIT" } | ||
keywords = [ | ||
"bit field", | ||
"bit parsing", | ||
"bit unpack", | ||
"bit pack", | ||
] | ||
authors = [ | ||
{ name = "Erik Moqvist", email = "[email protected]" }, | ||
{ name = "Ilya Petukhov" }, | ||
] | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: Implementation :: CPython", | ||
] | ||
dependencies = [] | ||
dynamic = ["version"] | ||
|
||
[project.urls] | ||
Documentation = "https://bitstruct.readthedocs.io/en/latest/" | ||
Issues = "https://github.com/eerimoq/bitstruct/issues" | ||
Source = "https://github.com/eerimoq/bitstruct" | ||
Homepage = "https://github.com/eerimoq/bitstruct" | ||
|
||
[tool.setuptools.packages.find] | ||
where = ["src"] | ||
|
||
[tool.setuptools.dynamic] | ||
version = {attr = "bitstruct.__version__"} | ||
|
||
[tool.setuptools.package-data] | ||
"*" = [ | ||
"**/py.typed", | ||
"**.pyi", | ||
] | ||
|
||
[tool.cibuildwheel] | ||
test-requires = "pytest" | ||
test-command = "pytest -v --assert=plain {project}/tests" | ||
build-frontend = "build" | ||
skip = "pp*" |
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,61 +1,19 @@ | ||
#!/usr/bin/env python | ||
|
||
import sys | ||
import re | ||
import setuptools | ||
import platform | ||
from setuptools import find_packages | ||
|
||
|
||
def find_version(): | ||
return re.search(r"^__version__ = '(.*)'$", | ||
open('bitstruct/version.py', 'r').read(), | ||
re.MULTILINE).group(1) | ||
|
||
|
||
def is_cpython_3(): | ||
if platform.python_implementation() != 'CPython': | ||
return False | ||
|
||
if sys.version_info[0] < 3: | ||
return False | ||
|
||
return True | ||
import setuptools | ||
|
||
if platform.python_implementation() == "CPython": | ||
ext_modules = [ | ||
setuptools.Extension( | ||
"bitstruct.c", | ||
sources=[ | ||
"src/bitstruct/c.c", | ||
"src/bitstruct/bitstream.c", | ||
], | ||
) | ||
] | ||
|
||
def setup(ext_modules): | ||
setuptools.setup( | ||
name='bitstruct', | ||
version=find_version(), | ||
description=('This module performs conversions between Python values ' | ||
'and C bit field structs represented as Python ' | ||
'byte strings.'), | ||
long_description=open('README.rst', 'r').read(), | ||
author='Erik Moqvist, Ilya Petukhov', | ||
author_email='[email protected]', | ||
license='MIT', | ||
classifiers=[ | ||
'License :: OSI Approved :: MIT License', | ||
'Programming Language :: Python :: 2', | ||
'Programming Language :: Python :: 3', | ||
], | ||
keywords=['bit field', 'bit parsing', 'bit unpack', 'bit pack'], | ||
url='https://github.com/eerimoq/bitstruct', | ||
packages=find_packages(exclude=['tests']), | ||
ext_modules=ext_modules, | ||
test_suite="tests") | ||
|
||
|
||
if is_cpython_3(): | ||
try: | ||
setup([setuptools.Extension('bitstruct.c', | ||
sources=[ | ||
'bitstruct/c.c', | ||
'bitstruct/bitstream.c' | ||
])]) | ||
except: | ||
print('WARNING: Failed to build the C extension.') | ||
setup([]) | ||
else: | ||
print('INFO: C extension only implemented in CPython 3.') | ||
setup([]) | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this mean? How do I trigger this workflow? I usually want to publish to PyPI on all tags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I misread what you said earlier to be honest. So this workflow would be triggered whenever you publish a new release here on GitHub. But i just noticed, that you don't do that 😄
I'll change that back so it is triggered by tags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used the solution from here
Hopefully that works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try it out. I'll merge!