Skip to content

Commit 4b446bb

Browse files
authored
Merge pull request #32 from pycompression/cibuildwheels
Add machinery for automated wheel building.
2 parents 3f01c95 + 69dd25b commit 4b446bb

File tree

4 files changed

+113
-88
lines changed

4 files changed

+113
-88
lines changed

.github/workflows/ci.yml

Lines changed: 106 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
branches:
77
- develop
88
- main
9+
tags:
10+
- "*"
911

1012

1113
jobs:
@@ -42,19 +44,49 @@ jobs:
4244
run: tox -e docs
4345
env:
4446
PYTHON_ISAL_LINK_DYNAMIC: True
45-
test:
46-
runs-on: ubuntu-20.04
47+
twine_check:
48+
needs: lint
49+
runs-on: ${{ matrix.os }}
50+
strategy:
51+
matrix:
52+
python-version:
53+
- 3.6
54+
os: ["ubuntu-latest" ]
55+
steps:
56+
- uses: actions/[email protected]
57+
with:
58+
submodules: recursive
59+
- name: Set up Python ${{ matrix.python-version }}
60+
uses: actions/[email protected]
61+
with:
62+
python-version: ${{ matrix.python-version }}
63+
- name: Install build dependencies (Linux) # Yasm in pypa/manylinux images.
64+
run: sudo apt install yasm
65+
if: runner.os == 'Linux'
66+
- name: Install build dependencies (Macos)
67+
run: brew install yasm automake autoconf
68+
if: runner.os == 'macOS'
69+
- name: Install twine, cython wheel and upgrade setuptools
70+
run: pip install --upgrade twine cython wheel setuptools
71+
- name: create dists
72+
run: python setup.py sdist bdist_wheel
73+
- name: check dists
74+
run: twine check dist/*
75+
76+
test-static:
77+
needs: lint
78+
runs-on: ${{ matrix.os }}
4779
strategy:
4880
matrix:
4981
python-version:
5082
- 3.6
5183
- 3.7
5284
- 3.8
5385
- 3.9
54-
linking_method:
55-
- static
56-
- dynamic
57-
needs: lint
86+
os: ["ubuntu-latest"]
87+
include:
88+
- os: "macos-latest"
89+
python-version: 3.8
5890
steps:
5991
- uses: actions/[email protected]
6092
with:
@@ -63,41 +95,85 @@ jobs:
6395
uses: actions/[email protected]
6496
with:
6597
python-version: ${{ matrix.python-version }}
66-
- name: Install tox and upgrade setuptools and pip
67-
run: pip install --upgrade tox setuptools pip
68-
- name: Install isal
69-
if: ${{ matrix.linking_method == 'dynamic' }}
70-
run: sudo apt-get install libisal-dev
71-
- name: Install yasm # Yasm in pypa/manylinux images.
98+
- name: Install tox and upgrade setuptools
99+
run: pip install --upgrade tox setuptools
100+
- name: Install build dependencies (Linux) # Yasm in pypa/manylinux images.
72101
run: sudo apt install yasm
73-
if: ${{ matrix.linking_method == 'static' }}
74-
- name: Run tests (dynamic link)
75-
run: tox -e py3
76-
env:
77-
PYTHON_ISAL_LINK_DYNAMIC: True
78-
if: ${{ matrix.linking_method == 'dynamic' }}
79-
- name: Run tests (dynamic link)
102+
if: runner.os == 'Linux'
103+
- name: Install build dependencies (Macos)
104+
run: brew install yasm automake autoconf
105+
if: runner.os == 'macOS'
106+
- name: Run tests
80107
run: tox -e py3
81-
if: ${{ matrix.linking_method == 'static' }}
82108
- name: Upload coverage report
83-
if: ${{ matrix.python-version == 3.6 && matrix.linking_method == 'static'}} # Only upload coverage once
84109
uses: codecov/codecov-action@v1
85110

86-
macos:
87-
runs-on: macos-latest
111+
test-dynamic:
112+
runs-on: ${{ matrix.os }}
88113
needs: lint
114+
strategy:
115+
matrix:
116+
python-version:
117+
- 3.6
118+
os: ["ubuntu-20.04"]
89119
steps:
90-
- name: Install python 3.6
91-
uses: actions/[email protected]
120+
- uses: actions/[email protected]
92121
with:
93122
submodules: recursive
94-
- name: Set up Python 3.6
123+
- name: Set up Python ${{ matrix.python-version }}
95124
uses: actions/[email protected]
96125
with:
97-
python-version: 3.6
126+
python-version: ${{ matrix.python-version }}
127+
- name: Install isal
128+
run: sudo apt-get install libisal-dev
98129
- name: Install tox and upgrade setuptools and pip
99130
run: pip install --upgrade tox setuptools pip
100-
- name: Install build dependencies
101-
run: brew install yasm automake autoconf
102-
- name: Run tests
131+
- name: Run tests (dynamic link)
103132
run: tox -e py3
133+
env:
134+
PYTHON_ISAL_LINK_DYNAMIC: True
135+
136+
deploy:
137+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
138+
runs-on: ${{ matrix.os }}
139+
needs: [lint, docs, test-static, test-dynamic, twine_check]
140+
strategy:
141+
matrix:
142+
os: [ "macos-latest", "ubuntu-latest" ]
143+
steps:
144+
- uses: actions/[email protected]
145+
with:
146+
submodules: recursive
147+
- uses: actions/setup-python@v2
148+
name: Install Python
149+
- name: Install cibuildwheel
150+
run: python -m pip install cibuildwheel==1.8.0
151+
- name: Install build dependencies (Macos)
152+
run: brew install yasm automake autoconf
153+
if: runner.os == 'macOS'
154+
- name: Build wheels
155+
run: cibuildwheel --output-dir dist
156+
env:
157+
CIBW_BUILD: "cp3{6,7,8,9}-*"
158+
CIBW_SKIP: "*-win32 *-manylinux_i686" # Skip 32 bit.
159+
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
160+
# Below command fails when data is not correctly statically linked
161+
# Full tests not needed: these are done prior to building.
162+
CIBW_TEST_COMMAND: "python -c 'from isal import isal_zlib, igzip; isal_zlib.adler32(b\"bla\")'"
163+
- name: Build sdist
164+
if: "runner.os == 'Linux'"
165+
run: python setup.py sdist
166+
- name: Publish package to TestPyPI
167+
uses: pypa/gh-action-pypi-publish@master
168+
# Alpha, Beta and dev releases contain a - in the tag.
169+
if: contains(github.ref, '-') && startsWith(github.ref, 'refs/tags')
170+
with:
171+
user: __token__
172+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
173+
repository_url: https://test.pypi.org/legacy/
174+
- name: Publish package to PyPI
175+
uses: pypa/gh-action-pypi-publish@master
176+
if: "!contains(github.ref, '-') && startsWith(github.ref, 'refs/tags')"
177+
with:
178+
user: __token__
179+
password: ${{ secrets.PYPI_API_TOKEN }}

CHANGELOG.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ Changelog
77
.. This document is user facing. Please word the changes in such a way
88
.. that users understand how the changes affect the new version.
99
10-
version 0.3.1-dev
10+
version 0.4.0-dev
1111
-----------------
12+
+ Move wheel building to cibuildwheel on github actions CI. Wheels are now
13+
provided for Mac OS as well.
1214
+ Make a tiny change in setup.py so python-isal can be build on Mac OS X.
1315

1416
version 0.3.0

README.rst

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,20 @@ Installation
4848
Installation with pip
4949
.....................
5050

51-
+ Linux: ``pip install isal``. Wheels are provided, so installation should
51+
+ Linux and MacOS: ``pip install isal``. Wheels are provided, so installation should
5252
be almost instantaneous.
53-
+ MacOS: make sure ``gcc``, ``yasm``, ``automake`` and ``autoconf`` packages
54-
are installed. These can be installed via `Homebrew <https://brew.sh/>`_ with
55-
``brew install gcc yasm automake autoconf``. Then proceed with ``pip
56-
install isal``. The package will be build on your computer.
5753
+ Windows: Installation is not supported yet.
5854

59-
The installation will include a staticallly linked version of isa-l. On Linux,
60-
wheels are provided. If a wheel is not provided for your system the
55+
The installation will include a staticallly linked version of isa-l. On Linux
56+
and MacOS, wheels are provided. If a wheel is not provided for your system the
6157
installation will build ISA-L first in a temporary directory. Please check the
6258
`ISA-L homepage <https://github.com/intel/isa-l>`_ for the build requirements.
6359

6460
The latest development version of python-isal can be installed with::
6561

6662
pip install git+https://github.com/rhpvorderman/python-isal.git
6763

64+
This requires having the build requirements installed.
6865
If you wish to link
6966
dynamically against a version of libisal installed on your system use::
7067

buildwheels.sh

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)