summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Sorriaux <stephen.sorriaux@gmail.com>2021-08-05 22:28:38 -0400
committerStephen Sorriaux <stephen.sorriaux@gmail.com>2021-08-05 23:53:49 -0400
commit8eb462f26cb7af090d863850f71618594620d223 (patch)
tree25f5e911e79e58b4d304102f2badf194049e5b92
parent6337fd6f72b59fb20886f980f2e0d6d41525dc35 (diff)
downloadkazoo-feat/github-actions.tar.gz
chore(ci): Replace Travis with Github Actionsfeat/github-actions
-rw-r--r--.github/workflows/release.yml38
-rw-r--r--.github/workflows/testing.yml68
-rw-r--r--.travis.yml.bak (renamed from .travis.yml)0
-rw-r--r--Makefile8
-rw-r--r--kazoo/tests/test_build.py4
-rw-r--r--kazoo/tests/test_client.py18
-rw-r--r--kazoo/tests/test_connection.py6
-rw-r--r--kazoo/tests/test_queue.py6
-rw-r--r--kazoo/tests/test_sasl.py14
-rw-r--r--kazoo/tests/util.py12
-rw-r--r--tox.ini7
11 files changed, 143 insertions, 38 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..be4b772
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,38 @@
+name: Kazoo Awesome Release
+
+on: [push]
+
+jobs:
+ build-and-release:
+ name: Build and release Kazoo to Pypi
+ runs-on: ubuntu-latest
+ steps:
+ - name: Handle the code
+ uses: actions/checkout@v2
+
+ - name: Set up Python 3.9
+ uses: actions/setup-python@v2
+ with:
+ python-version: 3.9
+
+ - name: Install pypa/build
+ run: >-
+ python -m
+ pip install
+ build
+ --user
+
+ - name: Build a binary wheel and a source tarball
+ run: >-
+ python -m
+ build
+ --sdist
+ --wheel
+ --outdir dist/
+ .
+
+ - name: Publish Kazoo to PyPI
+ if: startsWith(github.ref, 'refs/tags')
+ uses: pypa/gh-action-pypi-publish@master
+ with:
+ password: ${{ secrets.PYPI_API_TOKEN }}
diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml
new file mode 100644
index 0000000..d6690fc
--- /dev/null
+++ b/.github/workflows/testing.yml
@@ -0,0 +1,68 @@
+name: Kazoo Awesome Testing
+
+on: [push]
+
+jobs:
+ test:
+ name: >
+ Test Python ${{ matrix.python-version }},
+ ZK ${{ matrix.zk-version }}
+
+ runs-on: ubuntu-latest
+
+ strategy:
+ matrix:
+ python-version: [3.7, 3.8, 3.9, pypy-3.7]
+ zk-version: [3.4.14, 3.5.8]
+ include:
+ - python-version: 3.7
+ tox-env: py37
+ - python-version: 3.8
+ tox-env: py38
+ - python-version: 3.9
+ tox-env: py39
+ - python-version: pypy-3.7
+ tox-env: pypy3
+ steps:
+ - name: Handle the code
+ uses: actions/checkout@v2
+
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ - name: Handle pip cache
+ uses: actions/cache@v2
+ with:
+ path: ~/.cache/pip
+ key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
+ restore-keys: |
+ ${{ runner.os }}-pip-
+
+ - name: Handle ZK installation cache
+ uses: actions/cache@v2
+ with:
+ path: zookeeper
+ key: ${{ runner.os }}-zookeeper
+ restore-keys: |
+ ${{ runner.os }}-zookeeper
+
+ - name: Install required dependencies
+ run: |
+ sudo apt-get -y install libevent-dev krb5-kdc krb5-admin-server libkrb5-dev
+ python -m pip install --upgrade pip
+ pip install tox
+
+ - name: Test with tox
+ run: tox -e ${TOX_VENV}
+ env:
+ TOX_VENV: ${{ format('{0}-{1}', matrix.tox-env, 'gevent-eventlet-sasl,codecov') }}
+ ZOOKEEPER_VERSION: ${{ matrix.zk-version }}
+ # TODO: can be removed once tests for ZK 3.4 are removed
+ ZOOKEEPER_PREFIX: "${{ !contains(matrix.zk-version, '3.4') && 'apache-' || '' }}"
+ ZOOKEEPER_SUFFIX: "${{ !contains(matrix.zk-version, '3.4') && '-bin' || '' }}"
+ ZOOKEEPER_LIB: "${{ !contains(matrix.zk-version, '3.4') && 'lib' || '' }}"
+
+ - name: Publish Codecov report
+ uses: codecov/codecov-action@v2
diff --git a/.travis.yml b/.travis.yml.bak
index 45059a4..45059a4 100644
--- a/.travis.yml
+++ b/.travis.yml.bak
diff --git a/Makefile b/Makefile
index b03c20f..f49c3c9 100644
--- a/Makefile
+++ b/Makefile
@@ -7,11 +7,11 @@ BUILD_DIRS = bin build include lib lib64 man share
PYTHON_EXE = $(shell [ -f $(PYTHON) ] && echo $(PYTHON) || echo python)
PYPY = $(shell $(PYTHON_EXE) -c "import sys; print(getattr(sys, 'pypy_version_info', False) and 'yes' or 'no')")
-TRAVIS ?= false
-TRAVIS_PYTHON_VERSION ?= $(shell $(PYTHON_EXE) -c "import sys; print('.'.join([str(s) for s in sys.version_info][:2]))")
+CI ?= false
+CI_PYTHON_VERSION ?= $(shell $(PYTHON_EXE) -c "import sys; print('.'.join([str(s) for s in sys.version_info][:2]))")
GREENLET_SUPPORTED = yes
-ifeq ($(findstring 3.,$(TRAVIS_PYTHON_VERSION)), 3.)
+ifeq ($(findstring 3.,$(CI_PYTHON_VERSION)), 3.)
GREENLET_SUPPORTED = no
VENV_CMD = $(PYTHON_EXE) -m venv .
else
@@ -33,7 +33,7 @@ ifeq ($(GREENLET_SUPPORTED),yes)
$(INSTALL) -U -r requirements_eventlet.txt
$(INSTALL) -U -r requirements_gevent.txt
endif
-ifneq ($(TRAVIS), true)
+ifneq ($(CI), true)
$(INSTALL) -U -r requirements_sphinx.txt
endif
$(INSTALL) -U -r requirements.txt
diff --git a/kazoo/tests/test_build.py b/kazoo/tests/test_build.py
index 253027f..687c1dc 100644
--- a/kazoo/tests/test_build.py
+++ b/kazoo/tests/test_build.py
@@ -8,8 +8,8 @@ from kazoo.testing import KazooTestCase
class TestBuildEnvironment(KazooTestCase):
def setUp(self):
KazooTestCase.setUp(self)
- if not os.environ.get('TRAVIS'):
- pytest.skip('Only run build config tests on Travis.')
+ if not os.environ.get('CI'):
+ pytest.skip('Only run build config tests on CI.')
def test_zookeeper_version(self):
server_version = self.client.server_version()
diff --git a/kazoo/tests/test_client.py b/kazoo/tests/test_client.py
index 45ec009..a0f1abd 100644
--- a/kazoo/tests/test_client.py
+++ b/kazoo/tests/test_client.py
@@ -26,7 +26,7 @@ from kazoo.exceptions import (
)
from kazoo.protocol.connection import _CONNECTION_DROP
from kazoo.protocol.states import KeeperState, KazooState
-from kazoo.tests.util import TRAVIS_ZK_VERSION
+from kazoo.tests.util import CI_ZK_VERSION
if sys.version_info > (3, ): # pragma: nocover
@@ -605,8 +605,8 @@ class TestClient(KazooTestCase):
client.create("/1", acl=[single_acl, single_acl])
acls, stat = client.get_acls("/1")
# ZK >3.4 removes duplicate ACL entries
- if TRAVIS_ZK_VERSION:
- version = TRAVIS_ZK_VERSION
+ if CI_ZK_VERSION:
+ version = CI_ZK_VERSION
else:
version = client.server_version()
assert len(acls) == 1 if version > (3, 4) else 2
@@ -718,8 +718,8 @@ class TestClient(KazooTestCase):
client.create(path)
def test_create_stat(self):
- if TRAVIS_ZK_VERSION:
- version = TRAVIS_ZK_VERSION
+ if CI_ZK_VERSION:
+ version = CI_ZK_VERSION
else:
version = self.client.server_version()
if not version or version < (3, 5):
@@ -1176,9 +1176,9 @@ class TestClientTransactions(KazooTestCase):
def setUp(self):
KazooTestCase.setUp(self)
skip = False
- if TRAVIS_ZK_VERSION and TRAVIS_ZK_VERSION < (3, 4):
+ if CI_ZK_VERSION and CI_ZK_VERSION < (3, 4):
skip = True
- elif TRAVIS_ZK_VERSION and TRAVIS_ZK_VERSION >= (3, 4):
+ elif CI_ZK_VERSION and CI_ZK_VERSION >= (3, 4):
skip = False
else:
ver = self.client.server_version()
@@ -1378,8 +1378,8 @@ class TestReconfig(KazooTestCase):
def setUp(self):
KazooTestCase.setUp(self)
- if TRAVIS_ZK_VERSION:
- version = TRAVIS_ZK_VERSION
+ if CI_ZK_VERSION:
+ version = CI_ZK_VERSION
else:
version = self.client.server_version()
if not version or version < (3, 5):
diff --git a/kazoo/tests/test_connection.py b/kazoo/tests/test_connection.py
index 411d2d0..d62f7f7 100644
--- a/kazoo/tests/test_connection.py
+++ b/kazoo/tests/test_connection.py
@@ -19,7 +19,7 @@ from kazoo.protocol.states import KazooState
from kazoo.protocol.connection import _CONNECTION_DROP
from kazoo.testing import KazooTestCase
from kazoo.tests.util import wait
-from kazoo.tests.util import TRAVIS_ZK_VERSION
+from kazoo.tests.util import CI_ZK_VERSION
class Delete(namedtuple('Delete', 'path version')):
@@ -259,9 +259,9 @@ class TestReadOnlyMode(KazooTestCase):
def setUp(self):
self.setup_zookeeper(read_only=True)
skip = False
- if TRAVIS_ZK_VERSION and TRAVIS_ZK_VERSION < (3, 4):
+ if CI_ZK_VERSION and CI_ZK_VERSION < (3, 4):
skip = True
- elif TRAVIS_ZK_VERSION and TRAVIS_ZK_VERSION >= (3, 4):
+ elif CI_ZK_VERSION and CI_ZK_VERSION >= (3, 4):
skip = False
else:
ver = self.client.server_version()
diff --git a/kazoo/tests/test_queue.py b/kazoo/tests/test_queue.py
index 59ece16..b4b8455 100644
--- a/kazoo/tests/test_queue.py
+++ b/kazoo/tests/test_queue.py
@@ -3,7 +3,7 @@ import uuid
import pytest
from kazoo.testing import KazooTestCase
-from kazoo.tests.util import TRAVIS_ZK_VERSION
+from kazoo.tests.util import CI_ZK_VERSION
class KazooQueueTests(KazooTestCase):
@@ -59,9 +59,9 @@ class KazooLockingQueueTests(KazooTestCase):
def setUp(self):
KazooTestCase.setUp(self)
skip = False
- if TRAVIS_ZK_VERSION and TRAVIS_ZK_VERSION < (3, 4):
+ if CI_ZK_VERSION and CI_ZK_VERSION < (3, 4):
skip = True
- elif TRAVIS_ZK_VERSION and TRAVIS_ZK_VERSION >= (3, 4):
+ elif CI_ZK_VERSION and CI_ZK_VERSION >= (3, 4):
skip = False
else:
ver = self.client.server_version()
diff --git a/kazoo/tests/test_sasl.py b/kazoo/tests/test_sasl.py
index efdf965..2ee7120 100644
--- a/kazoo/tests/test_sasl.py
+++ b/kazoo/tests/test_sasl.py
@@ -9,7 +9,7 @@ from kazoo.exceptions import (
AuthFailedError,
NoAuthError,
)
-from kazoo.tests.util import TRAVIS_ZK_VERSION
+from kazoo.tests.util import CI_ZK_VERSION
class TestLegacySASLDigestAuthentication(KazooTestHarness):
@@ -22,8 +22,8 @@ class TestLegacySASLDigestAuthentication(KazooTestHarness):
os.environ["ZOOKEEPER_JAAS_AUTH"] = "digest"
self.setup_zookeeper()
- if TRAVIS_ZK_VERSION:
- version = TRAVIS_ZK_VERSION
+ if CI_ZK_VERSION:
+ version = CI_ZK_VERSION
else:
version = self.client.server_version()
if not version or version < (3, 4):
@@ -71,8 +71,8 @@ class TestSASLDigestAuthentication(KazooTestHarness):
os.environ["ZOOKEEPER_JAAS_AUTH"] = "digest"
self.setup_zookeeper()
- if TRAVIS_ZK_VERSION:
- version = TRAVIS_ZK_VERSION
+ if CI_ZK_VERSION:
+ version = CI_ZK_VERSION
else:
version = self.client.server_version()
if not version or version < (3, 4):
@@ -136,8 +136,8 @@ class TestSASLGSSAPIAuthentication(KazooTestHarness):
os.environ["ZOOKEEPER_JAAS_AUTH"] = "gssapi"
self.setup_zookeeper()
- if TRAVIS_ZK_VERSION:
- version = TRAVIS_ZK_VERSION
+ if CI_ZK_VERSION:
+ version = CI_ZK_VERSION
else:
version = self.client.server_version()
if not version or version < (3, 4):
diff --git a/kazoo/tests/util.py b/kazoo/tests/util.py
index ffbc754..dbe3b48 100644
--- a/kazoo/tests/util.py
+++ b/kazoo/tests/util.py
@@ -16,13 +16,13 @@ import logging
import os
import time
-TRAVIS = os.environ.get('TRAVIS', False)
-TRAVIS_ZK_VERSION = TRAVIS and os.environ.get('ZOOKEEPER_VERSION', None)
-if TRAVIS_ZK_VERSION:
- if '-' in TRAVIS_ZK_VERSION:
+CI = os.environ.get('CI', False)
+CI_ZK_VERSION = CI and os.environ.get('ZOOKEEPER_VERSION', None)
+if CI_ZK_VERSION:
+ if '-' in CI_ZK_VERSION:
# Ignore pre-release markers like -alpha
- TRAVIS_ZK_VERSION = TRAVIS_ZK_VERSION.split('-')[0]
- TRAVIS_ZK_VERSION = tuple([int(n) for n in TRAVIS_ZK_VERSION.split('.')])
+ CI_ZK_VERSION = CI_ZK_VERSION.split('-')[0]
+ CI_ZK_VERSION = tuple([int(n) for n in CI_ZK_VERSION.split('.')])
class Handler(logging.Handler):
diff --git a/tox.ini b/tox.ini
index 350c206..44d792f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,9 +1,9 @@
[tox]
-minversion = 3.6
+minversion = 3.7
skipsdist = True
envlist =
pep8,
- {py27,py34,py35,py36,py37,py38,pypy3}
+ {py37,py38,py39,pypy3}
{gevent,eventlet,sasl,docs},
pypy3
@@ -13,8 +13,7 @@ install_command = pip install {opts} {packages}
passenv =
CI
TOX_*
- TRAVIS
- TRAVIS_*
+ CI_*
ZOOKEEPER_*
setenv =
VIRTUAL_ENV={envdir}