Skip to content

Commit

Permalink
Switch to Github Actions to build wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
aMarcireau committed Nov 24, 2022
1 parent e1abe30 commit ff76f21
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 41 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build

on:
push:
pull_request:
release:
types:
- published

env:
CIBW_ARCHS_MACOS: x86_64 arm64

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Build wheels
uses: pypa/cibuildwheel@v2.11.2
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1.5.0
with:
password: ${{ secrets.PYPI_API_TOKEN }}
43 changes: 12 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@ The present package contains two libraries. `lzip` deals with high-level operati
- [FileEncoder](#fileencoder)
- [BufferEncoder](#bufferencoder)
- [RemainingBytesError](#remainingbyteserror)
- [compress_to_buffer](#compress_to_buffer)
- [compress_to_file](#compress_to_file)
- [decompress_buffer](#decompress_buffer)
- [decompress_buffer_iter](#decompress_buffer_iter)
- [decompress_file](#decompress_file)
- [decompress_file_iter](#decompress_file_iter)
- [decompress_file_like](#decompress_file_like)
- [decompress_file_like_iter](#decompress_file_like_iter)
- [decompress_url](#decompress_url)
- [decompress_url_iter](#decompress_url_iter)
- [lzip_extension](#lzip_extension)
- [compress\_to\_buffer](#compress_to_buffer)
- [compress\_to\_file](#compress_to_file)
- [decompress\_buffer](#decompress_buffer)
- [decompress\_buffer\_iter](#decompress_buffer_iter)
- [decompress\_file](#decompress_file)
- [decompress\_file\_iter](#decompress_file_iter)
- [decompress\_file\_like](#decompress_file_like)
- [decompress\_file\_like\_iter](#decompress_file_like_iter)
- [decompress\_url](#decompress_url)
- [decompress\_url\_iter](#decompress_url_iter)
- [lzip\_extension](#lzip_extension)
- [Decoder](#decoder)
- [Encoder](#encoder)
- [Compare options](#compare-options)
Expand Down Expand Up @@ -501,23 +501,4 @@ default_member_size = 1 << 51

1. Bump the version number in _version.py_.

2. Install Cubuzoa in a different directory (https://github.com/neuromorphicsystems/cubuzoa) to build pre-compiled versions for all major operating systems. Cubuzoa depends on VirtualBox (with its extension pack) and requires about 75 GB of free disk space.

```sh
cd cubuzoa
python3 cubuzoa.py provision
python3 -m cubuzoa build /path/to/lzip --post /path/to/lzip/test.py
```

3. Install twine

```sh
pip3 install twine
```

4. Upload the compiled wheels and the source code to PyPI:

```sh
python3 setup.py sdist --dist-dir wheels
python3 -m twine upload wheels/*
```
2. Create a new release on GitHub.
21 changes: 12 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import distutils.core
import pathlib
import setuptools
import setuptools.extension
import setuptools.command.build_ext
import sys

with open("README.md") as file:
dirname = pathlib.Path(__file__).resolve().parent

with open(dirname / "README.md") as file:
long_description = file.read()

extra_compile_args = []
extra_link_args = []
if sys.platform == "linux":
extra_compile_args += ["-std=c++11"]
extra_link_args += ["-std=c++11", "-lstdc++"]
extra_compile_args += ["-std=c++17"]
extra_link_args += ["-std=c++17", "-lstdc++"]
elif sys.platform == "darwin":
extra_compile_args += ["-std=c++11", "-stdlib=libc++"]
extra_link_args += ["-std=c++11", "-stdlib=libc++"]
extra_compile_args += ["-std=c++17", "-stdlib=libc++"]
extra_link_args += ["-std=c++17", "-stdlib=libc++"]

exec(open("version.py").read())
exec(open(dirname / "version.py").read())
setuptools.setup(
name="lzip",
version=__version__, # type: ignore
Expand All @@ -32,12 +35,12 @@
],
py_modules=["lzip"],
ext_modules=[ # type: ignore
distutils.core.Extension(
setuptools.extension.Extension(
"lzip_extension",
language="cpp",
sources=[
"lzip_extension.cpp",
str(pathlib.Path("third_party") / "lzlib" / "lzlib.cpp"),
str(dirname / "third_party" / "lzlib" / "lzlib.cpp"),
],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "1.1.1"
__version__ = "1.1.2"
__lzlib_version__ = "1.13"

0 comments on commit ff76f21

Please sign in to comment.