Skip to content

Commit 26264e4

Browse files
authored
Merge pull request #101 from ynouri/master
Github Actions + Manylinux Wheels
2 parents dc6aaf6 + 9a8a94f commit 26264e4

4 files changed

Lines changed: 174 additions & 31 deletions

File tree

.github/workflows/pypy.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: PyPy
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: [pypy2, pypy3]
11+
12+
name: ${{ matrix.python-version }}
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Setup Python
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
architecture: x64
22+
23+
- name: Install test dependencies
24+
run: pip install cffi flake8 pytest
25+
26+
- name: Install libsnappy-dev
27+
run: sudo apt-get install libsnappy-dev
28+
29+
# Flake8 is already run in Source Distribution (sdist) workflow, so we don't run it here.
30+
31+
- name: Install python-snappy from source
32+
run: pip install -e .
33+
34+
- name: Pytest
35+
run: pytest --verbose test_snappy.py test_snappy_cffi.py

.github/workflows/sdist.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Source Distribution
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
name: Python 3.9
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Setup Python
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: 3.9
18+
architecture: x64
19+
20+
- name: Install test dependencies
21+
run: pip install wheel flake8 pytest twine
22+
23+
- name: Flake8
24+
# stop the build if there are Python syntax errors or undefined names
25+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
26+
run: |
27+
flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
28+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
29+
30+
- name: Install libsnappy-dev
31+
run: sudo apt-get install libsnappy-dev
32+
33+
- name: Generate source distribution
34+
run: python setup.py sdist
35+
36+
- name: Clean up sources
37+
# this cleans up the sources to make sure `import snappy` uses the sdist
38+
# an alternative would be to run pytest in a different working directory
39+
run: rm -rf setup.py ./snappy
40+
41+
- name: Install python-snappy sdist
42+
run: pip install dist/python-snappy*.tar.gz
43+
44+
- name: Pytest
45+
run: pytest --verbose test_snappy.py
46+
47+
- name: Archive sdist
48+
if: startsWith(github.ref, 'refs/tags/0.')
49+
uses: actions/upload-artifact@v2
50+
with:
51+
name: python-snappy-sdist
52+
path: dist/python-snappy*.tar.gz
53+
54+
- name: Publish sdist to PyPI
55+
if: startsWith(github.ref, 'refs/tags/0.')
56+
env:
57+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
58+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
59+
run: |
60+
twine upload dist/python-snappy*.tar.gz

.github/workflows/wheel.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Wheel
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
include:
11+
- python-version: 2.7
12+
pep-425-tag: cp27-cp27mu
13+
# we build for "wide-unicode" CPython 2.7, which is prevalent among
14+
# most Linux distributions. See https://github.com/pypa/manylinux
15+
16+
- python-version: 3.5
17+
pep-425-tag: cp35-cp35m
18+
19+
- python-version: 3.6
20+
pep-425-tag: cp36-cp36m
21+
22+
- python-version: 3.7
23+
pep-425-tag: cp37-cp37m
24+
25+
- python-version: 3.8
26+
pep-425-tag: cp38-cp38
27+
28+
- python-version: 3.9
29+
pep-425-tag: cp39-cp39
30+
31+
name: Python ${{ matrix.python-version }}
32+
33+
steps:
34+
- uses: actions/checkout@v2
35+
36+
- name: Setup Python
37+
uses: actions/setup-python@v2
38+
with:
39+
python-version: ${{ matrix.python-version }}
40+
architecture: x64
41+
42+
- name: Install test dependencies
43+
run: pip install pytest twine
44+
45+
# Flake8 is already run in Source Distribution (sdist) workflow, so we don't run it here.
46+
47+
- name: Build python-snappy manylinux wheels
48+
uses: RalfG/python-wheels-manylinux-build@v0.3.3-manylinux2010_x86_64
49+
with:
50+
python-versions: ${{ matrix.pep-425-tag }}
51+
system-packages: "snappy-devel"
52+
53+
- name: Install python-snappy wheel
54+
# manylinux1 offers broader compatibility than manylinux2010 or manylinux2014
55+
run: |
56+
pip install dist/python_snappy*-manylinux1*.whl
57+
58+
- name: Clean up sources
59+
# this cleans up the sources to make sure `import snappy` uses the wheel
60+
# an alternative would be to run pytest in a different working directory
61+
run: rm -rf setup.py ./snappy
62+
63+
- name: Pytest
64+
run: pytest --verbose test_snappy.py
65+
66+
- name: Archive wheels
67+
if: startsWith(github.ref, 'refs/tags/0.')
68+
uses: actions/upload-artifact@v2
69+
with:
70+
name: python_snappy-${{ matrix.pep-425-tag }}-manylinux
71+
path: dist/python_snappy*-manylinux1*.whl
72+
73+
- name: Publish wheels to PyPI
74+
if: startsWith(github.ref, 'refs/tags/0.')
75+
env:
76+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
77+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
78+
run: |
79+
twine upload dist/python_snappy*-manylinux1*.whl

.travis.yml

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

0 commit comments

Comments
 (0)