Skip to content

Commit 234dd78

Browse files
authored
Merge pull request #652 from python-zk/feat/github-actions
chore(ci): Replace Travis with Github Actions
2 parents 6337fd6 + 8eb462f commit 234dd78

File tree

11 files changed

+143
-38
lines changed

11 files changed

+143
-38
lines changed

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Kazoo Awesome Release
2+
3+
on: [push]
4+
5+
jobs:
6+
build-and-release:
7+
name: Build and release Kazoo to Pypi
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Handle the code
11+
uses: actions/checkout@v2
12+
13+
- name: Set up Python 3.9
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: 3.9
17+
18+
- name: Install pypa/build
19+
run: >-
20+
python -m
21+
pip install
22+
build
23+
--user
24+
25+
- name: Build a binary wheel and a source tarball
26+
run: >-
27+
python -m
28+
build
29+
--sdist
30+
--wheel
31+
--outdir dist/
32+
.
33+
34+
- name: Publish Kazoo to PyPI
35+
if: startsWith(github.ref, 'refs/tags')
36+
uses: pypa/gh-action-pypi-publish@master
37+
with:
38+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/testing.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Kazoo Awesome Testing
2+
3+
on: [push]
4+
5+
jobs:
6+
test:
7+
name: >
8+
Test Python ${{ matrix.python-version }},
9+
ZK ${{ matrix.zk-version }}
10+
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
python-version: [3.7, 3.8, 3.9, pypy-3.7]
16+
zk-version: [3.4.14, 3.5.8]
17+
include:
18+
- python-version: 3.7
19+
tox-env: py37
20+
- python-version: 3.8
21+
tox-env: py38
22+
- python-version: 3.9
23+
tox-env: py39
24+
- python-version: pypy-3.7
25+
tox-env: pypy3
26+
steps:
27+
- name: Handle the code
28+
uses: actions/checkout@v2
29+
30+
- name: Set up Python ${{ matrix.python-version }}
31+
uses: actions/setup-python@v2
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
35+
- name: Handle pip cache
36+
uses: actions/cache@v2
37+
with:
38+
path: ~/.cache/pip
39+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
40+
restore-keys: |
41+
${{ runner.os }}-pip-
42+
43+
- name: Handle ZK installation cache
44+
uses: actions/cache@v2
45+
with:
46+
path: zookeeper
47+
key: ${{ runner.os }}-zookeeper
48+
restore-keys: |
49+
${{ runner.os }}-zookeeper
50+
51+
- name: Install required dependencies
52+
run: |
53+
sudo apt-get -y install libevent-dev krb5-kdc krb5-admin-server libkrb5-dev
54+
python -m pip install --upgrade pip
55+
pip install tox
56+
57+
- name: Test with tox
58+
run: tox -e ${TOX_VENV}
59+
env:
60+
TOX_VENV: ${{ format('{0}-{1}', matrix.tox-env, 'gevent-eventlet-sasl,codecov') }}
61+
ZOOKEEPER_VERSION: ${{ matrix.zk-version }}
62+
# TODO: can be removed once tests for ZK 3.4 are removed
63+
ZOOKEEPER_PREFIX: "${{ !contains(matrix.zk-version, '3.4') && 'apache-' || '' }}"
64+
ZOOKEEPER_SUFFIX: "${{ !contains(matrix.zk-version, '3.4') && '-bin' || '' }}"
65+
ZOOKEEPER_LIB: "${{ !contains(matrix.zk-version, '3.4') && 'lib' || '' }}"
66+
67+
- name: Publish Codecov report
68+
uses: codecov/codecov-action@v2
File renamed without changes.

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ BUILD_DIRS = bin build include lib lib64 man share
77

88
PYTHON_EXE = $(shell [ -f $(PYTHON) ] && echo $(PYTHON) || echo python)
99
PYPY = $(shell $(PYTHON_EXE) -c "import sys; print(getattr(sys, 'pypy_version_info', False) and 'yes' or 'no')")
10-
TRAVIS ?= false
11-
TRAVIS_PYTHON_VERSION ?= $(shell $(PYTHON_EXE) -c "import sys; print('.'.join([str(s) for s in sys.version_info][:2]))")
10+
CI ?= false
11+
CI_PYTHON_VERSION ?= $(shell $(PYTHON_EXE) -c "import sys; print('.'.join([str(s) for s in sys.version_info][:2]))")
1212

1313
GREENLET_SUPPORTED = yes
14-
ifeq ($(findstring 3.,$(TRAVIS_PYTHON_VERSION)), 3.)
14+
ifeq ($(findstring 3.,$(CI_PYTHON_VERSION)), 3.)
1515
GREENLET_SUPPORTED = no
1616
VENV_CMD = $(PYTHON_EXE) -m venv .
1717
else
@@ -33,7 +33,7 @@ ifeq ($(GREENLET_SUPPORTED),yes)
3333
$(INSTALL) -U -r requirements_eventlet.txt
3434
$(INSTALL) -U -r requirements_gevent.txt
3535
endif
36-
ifneq ($(TRAVIS), true)
36+
ifneq ($(CI), true)
3737
$(INSTALL) -U -r requirements_sphinx.txt
3838
endif
3939
$(INSTALL) -U -r requirements.txt

kazoo/tests/test_build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
class TestBuildEnvironment(KazooTestCase):
99
def setUp(self):
1010
KazooTestCase.setUp(self)
11-
if not os.environ.get('TRAVIS'):
12-
pytest.skip('Only run build config tests on Travis.')
11+
if not os.environ.get('CI'):
12+
pytest.skip('Only run build config tests on CI.')
1313

1414
def test_zookeeper_version(self):
1515
server_version = self.client.server_version()

kazoo/tests/test_client.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
)
2727
from kazoo.protocol.connection import _CONNECTION_DROP
2828
from kazoo.protocol.states import KeeperState, KazooState
29-
from kazoo.tests.util import TRAVIS_ZK_VERSION
29+
from kazoo.tests.util import CI_ZK_VERSION
3030

3131

3232
if sys.version_info > (3, ): # pragma: nocover
@@ -605,8 +605,8 @@ def test_create_acl_duplicate(self):
605605
client.create("/1", acl=[single_acl, single_acl])
606606
acls, stat = client.get_acls("/1")
607607
# ZK >3.4 removes duplicate ACL entries
608-
if TRAVIS_ZK_VERSION:
609-
version = TRAVIS_ZK_VERSION
608+
if CI_ZK_VERSION:
609+
version = CI_ZK_VERSION
610610
else:
611611
version = client.server_version()
612612
assert len(acls) == 1 if version > (3, 4) else 2
@@ -718,8 +718,8 @@ def test_create_exists(self):
718718
client.create(path)
719719

720720
def test_create_stat(self):
721-
if TRAVIS_ZK_VERSION:
722-
version = TRAVIS_ZK_VERSION
721+
if CI_ZK_VERSION:
722+
version = CI_ZK_VERSION
723723
else:
724724
version = self.client.server_version()
725725
if not version or version < (3, 5):
@@ -1176,9 +1176,9 @@ class TestClientTransactions(KazooTestCase):
11761176
def setUp(self):
11771177
KazooTestCase.setUp(self)
11781178
skip = False
1179-
if TRAVIS_ZK_VERSION and TRAVIS_ZK_VERSION < (3, 4):
1179+
if CI_ZK_VERSION and CI_ZK_VERSION < (3, 4):
11801180
skip = True
1181-
elif TRAVIS_ZK_VERSION and TRAVIS_ZK_VERSION >= (3, 4):
1181+
elif CI_ZK_VERSION and CI_ZK_VERSION >= (3, 4):
11821182
skip = False
11831183
else:
11841184
ver = self.client.server_version()
@@ -1378,8 +1378,8 @@ class TestReconfig(KazooTestCase):
13781378
def setUp(self):
13791379
KazooTestCase.setUp(self)
13801380

1381-
if TRAVIS_ZK_VERSION:
1382-
version = TRAVIS_ZK_VERSION
1381+
if CI_ZK_VERSION:
1382+
version = CI_ZK_VERSION
13831383
else:
13841384
version = self.client.server_version()
13851385
if not version or version < (3, 5):

kazoo/tests/test_connection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from kazoo.protocol.connection import _CONNECTION_DROP
2020
from kazoo.testing import KazooTestCase
2121
from kazoo.tests.util import wait
22-
from kazoo.tests.util import TRAVIS_ZK_VERSION
22+
from kazoo.tests.util import CI_ZK_VERSION
2323

2424

2525
class Delete(namedtuple('Delete', 'path version')):
@@ -259,9 +259,9 @@ class TestReadOnlyMode(KazooTestCase):
259259
def setUp(self):
260260
self.setup_zookeeper(read_only=True)
261261
skip = False
262-
if TRAVIS_ZK_VERSION and TRAVIS_ZK_VERSION < (3, 4):
262+
if CI_ZK_VERSION and CI_ZK_VERSION < (3, 4):
263263
skip = True
264-
elif TRAVIS_ZK_VERSION and TRAVIS_ZK_VERSION >= (3, 4):
264+
elif CI_ZK_VERSION and CI_ZK_VERSION >= (3, 4):
265265
skip = False
266266
else:
267267
ver = self.client.server_version()

kazoo/tests/test_queue.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44

55
from kazoo.testing import KazooTestCase
6-
from kazoo.tests.util import TRAVIS_ZK_VERSION
6+
from kazoo.tests.util import CI_ZK_VERSION
77

88

99
class KazooQueueTests(KazooTestCase):
@@ -59,9 +59,9 @@ class KazooLockingQueueTests(KazooTestCase):
5959
def setUp(self):
6060
KazooTestCase.setUp(self)
6161
skip = False
62-
if TRAVIS_ZK_VERSION and TRAVIS_ZK_VERSION < (3, 4):
62+
if CI_ZK_VERSION and CI_ZK_VERSION < (3, 4):
6363
skip = True
64-
elif TRAVIS_ZK_VERSION and TRAVIS_ZK_VERSION >= (3, 4):
64+
elif CI_ZK_VERSION and CI_ZK_VERSION >= (3, 4):
6565
skip = False
6666
else:
6767
ver = self.client.server_version()

kazoo/tests/test_sasl.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
AuthFailedError,
1010
NoAuthError,
1111
)
12-
from kazoo.tests.util import TRAVIS_ZK_VERSION
12+
from kazoo.tests.util import CI_ZK_VERSION
1313

1414

1515
class TestLegacySASLDigestAuthentication(KazooTestHarness):
@@ -22,8 +22,8 @@ def setUp(self):
2222
os.environ["ZOOKEEPER_JAAS_AUTH"] = "digest"
2323
self.setup_zookeeper()
2424

25-
if TRAVIS_ZK_VERSION:
26-
version = TRAVIS_ZK_VERSION
25+
if CI_ZK_VERSION:
26+
version = CI_ZK_VERSION
2727
else:
2828
version = self.client.server_version()
2929
if not version or version < (3, 4):
@@ -71,8 +71,8 @@ def setUp(self):
7171
os.environ["ZOOKEEPER_JAAS_AUTH"] = "digest"
7272
self.setup_zookeeper()
7373

74-
if TRAVIS_ZK_VERSION:
75-
version = TRAVIS_ZK_VERSION
74+
if CI_ZK_VERSION:
75+
version = CI_ZK_VERSION
7676
else:
7777
version = self.client.server_version()
7878
if not version or version < (3, 4):
@@ -136,8 +136,8 @@ def setUp(self):
136136
os.environ["ZOOKEEPER_JAAS_AUTH"] = "gssapi"
137137
self.setup_zookeeper()
138138

139-
if TRAVIS_ZK_VERSION:
140-
version = TRAVIS_ZK_VERSION
139+
if CI_ZK_VERSION:
140+
version = CI_ZK_VERSION
141141
else:
142142
version = self.client.server_version()
143143
if not version or version < (3, 4):

kazoo/tests/util.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
import os
1717
import time
1818

19-
TRAVIS = os.environ.get('TRAVIS', False)
20-
TRAVIS_ZK_VERSION = TRAVIS and os.environ.get('ZOOKEEPER_VERSION', None)
21-
if TRAVIS_ZK_VERSION:
22-
if '-' in TRAVIS_ZK_VERSION:
19+
CI = os.environ.get('CI', False)
20+
CI_ZK_VERSION = CI and os.environ.get('ZOOKEEPER_VERSION', None)
21+
if CI_ZK_VERSION:
22+
if '-' in CI_ZK_VERSION:
2323
# Ignore pre-release markers like -alpha
24-
TRAVIS_ZK_VERSION = TRAVIS_ZK_VERSION.split('-')[0]
25-
TRAVIS_ZK_VERSION = tuple([int(n) for n in TRAVIS_ZK_VERSION.split('.')])
24+
CI_ZK_VERSION = CI_ZK_VERSION.split('-')[0]
25+
CI_ZK_VERSION = tuple([int(n) for n in CI_ZK_VERSION.split('.')])
2626

2727

2828
class Handler(logging.Handler):

0 commit comments

Comments
 (0)