Skip to content

Commit 89044fc

Browse files
authored
Move test suite to GitHub Actions
1 parent 9b27f5d commit 89044fc

7 files changed

Lines changed: 137 additions & 135 deletions

File tree

.github/workflows/ci.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: CI
2+
on: [push, pull_request]
3+
4+
jobs:
5+
lint:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
with:
10+
submodules: recursive
11+
- uses: actions/setup-python@v1
12+
with:
13+
python-version: 3.8
14+
- name: Run lint
15+
run: |
16+
python -m pip install tox
17+
tox -e lint
18+
19+
test:
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os: [ubuntu-latest, macos-latest, windows-latest]
25+
steps:
26+
- name: Set git to use LF on Windows
27+
if: runner.os == 'Windows'
28+
run: |
29+
git config --global core.autocrlf false
30+
git config --global core.eol lf
31+
- uses: actions/checkout@v2
32+
with:
33+
submodules: recursive
34+
- uses: actions/setup-python@v1
35+
with:
36+
python-version: 2.7
37+
- uses: actions/setup-python@v1
38+
with:
39+
python-version: 3.5
40+
- uses: actions/setup-python@v1
41+
with:
42+
python-version: 3.9
43+
- name: Install Visual C++ for Python 2.7
44+
if: runner.os == 'Windows'
45+
run: choco install vcpython27 -f -y
46+
- name: Run tests
47+
run: |
48+
python -m pip install tox
49+
tox --skip-missing-interpreters
50+
51+
package-sdist:
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v2
55+
with:
56+
submodules: recursive
57+
- uses: actions/setup-python@v1
58+
with:
59+
python-version: 3.8
60+
- name: Build source package
61+
run: python setup.py sdist
62+
- name: Upload source package
63+
uses: actions/upload-artifact@v1
64+
with:
65+
name: sdist
66+
path: dist/
67+
68+
package-wheel:
69+
runs-on: ${{ matrix.os }}
70+
strategy:
71+
matrix:
72+
include:
73+
- name: manylinux
74+
os: ubuntu-latest
75+
- name: macos
76+
os: macos-latest
77+
- name: win
78+
os: windows-latest
79+
80+
steps:
81+
- uses: actions/checkout@v2
82+
with:
83+
submodules: recursive
84+
- uses: actions/setup-python@v2
85+
86+
- name: Install cibuildwheel
87+
run: python -m pip install cibuildwheel
88+
- name: Install Visual C++ for Python 2.7
89+
if: runner.os == 'Windows'
90+
run: choco install vcpython27 -f -y
91+
- name: Build wheels
92+
run: python -m cibuildwheel --output-dir wheelhouse
93+
env:
94+
CIBW_BUILD: cp27-${{ matrix.name }}* cp35-${{ matrix.name }}* pp*-${{ matrix.name }}*
95+
- uses: actions/upload-artifact@v2
96+
with:
97+
name: wheels-${{ matrix.name }}
98+
path: ./wheelhouse/*.whl
99+
100+
publish:
101+
runs-on: ubuntu-latest
102+
needs: [lint, test, package-sdist, package-wheel]
103+
steps:
104+
- uses: actions/checkout@v2
105+
- uses: actions/download-artifact@v1
106+
with:
107+
name: sdist
108+
path: dists/
109+
- uses: actions/download-artifact@v1
110+
with:
111+
name: wheels-win
112+
path: dists/
113+
- uses: actions/download-artifact@v1
114+
with:
115+
name: wheels-macos
116+
path: dists/
117+
- uses: actions/download-artifact@v1
118+
with:
119+
name: wheels-manylinux
120+
path: dists/
121+
- name: Publish to PyPI
122+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
123+
uses: pypa/gh-action-pypi-publish@master
124+
with:
125+
user: __token__
126+
password: ${{ secrets.PYPI_TOKEN }}

.github/workflows/wheels.yml

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

.travis.yml

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

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ recursive-include libbrotli/enc *.c *.h *.cc
99
recursive-include libbrotli/dec *.c *.h *.cc
1010
recursive-include libbrotli/common *.c *.h *.cc
1111
recursive-include libbrotli/include *.c *.h *.cc
12+
13+
# Include test files
14+
recursive-include test/ *.py

tasks.py

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

test/test_simple_compression.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import pytest
1111

12-
from hypothesis import given
12+
from hypothesis import given, settings
1313
from hypothesis.strategies import binary, integers, sampled_from, one_of
1414

1515

@@ -25,6 +25,8 @@ def test_roundtrip_compression_with_files(simple_compressed_file):
2525
) == uncompressed_data
2626

2727

28+
@pytest.mark.slow
29+
@settings(deadline=None)
2830
@given(
2931
chunk_size=integers(min_value=1, max_value=2**12),
3032
mode=sampled_from(list(brotli.BrotliEncoderMode)),
@@ -62,6 +64,8 @@ def test_streaming_compression(one_compressed_file,
6264
assert decompressed == f.read()
6365

6466

67+
@pytest.mark.slow
68+
@settings(deadline=None)
6569
@given(
6670
chunk_size=integers(min_value=1, max_value=2**12),
6771
mode=sampled_from(list(brotli.BrotliEncoderMode)),

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py27, py34, py35, py36, pypy, lint
2+
envlist = py27, py34, py35, py36, py37, py38, py39, pypy, lint
33

44
[testenv]
55
deps= -r{toxinidir}/test_requirements.txt
@@ -10,6 +10,6 @@ commands= py.test --cov brotli {posargs} {toxinidir}/test/
1010
commands= py.test {toxinidir}/test/
1111

1212
[testenv:lint]
13-
basepython=python3.4
14-
deps = flake8==3.5.0
13+
basepython=python3
14+
deps = flake8
1515
commands = flake8 --max-complexity 10 src/brotli test

0 commit comments

Comments
 (0)