Skip to content

Commit

Permalink
Update travis.yml to support travis.com and change to stages
Browse files Browse the repository at this point in the history
  • Loading branch information
tvoinarovskyi committed Aug 19, 2018
1 parent 7e9a0f2 commit 04d95eb
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 49 deletions.
100 changes: 57 additions & 43 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,69 @@
language: python
conditions: v1

sudo: required
services:
- docker
language: python

branches:
only:
- master
- v0.2
- /^v\d+\.\d+\.\d+$/
- master
- v0.2
- "/^v\\d+\\.\\d+\\.\\d+$/"
- "/^v\\d+\\.\\d+\\.\\d+\\.dev\\d*$/"

stages:
- &stage_sanity_test Unit tests on container workers
- &stage_functional Run main functional tests
- name: &stage_deploy Optionally run deploy to PyPi
# This will prevent deploy unless it's a tagged commit:
if: tag IS present

matrix:
include:
- stage: *stage_sanity_test
sudo: false
python: 3.6
script:
- make ci-test-unit

- stage: *stage_functional
sudo: true
python: 3.6
services:
- docker
env: KAFKA_VERSION=0.11.0.0 SCALA_VERSION=2.12 PYTHONASYNCIODEBUG=1
script:
- make ci-test-all

- stage: *stage_deploy
python: 3.6
script: skip
deploy:
provider: pypi
user: aio-libs-bot
password:
secure: BSV2mPhyeyM8N7IdNtAlF11+pAQu9jdJQUOWWSfQBar+qgfFobkm23OZtvVZzl68U+cYzROlv6m66Xu9SN5MdPezrEXKKmcnzC/iREzHyB//Edrj+WsyqbmeqW3MGNgUu3bGq23Jw629jU3oGCm59cCa04Z/ZLhWHowH0UVVI/cbzfI5nc0nJkPSzYE2+L5DUjLGUgAA2+bygAWu2DpaUlVq5Pd+ApRSwvhg+qV2QHYCM6ypX5X0IjVNORQev9UuiKgAEFAeYcCgi0LB1DuasRVCf+yQeHa7xUGjtGS4PNWyK1jyyvJGYjV9XI1vUfnR5iKzKQVkBafqcCsW65H4D7m9cSVfU9P23XaHmwKAqYHG0LOyis/NT4cI5lRu7NhyTb6k3qex5jOGlIWrGGuA2Aer8jsMZ4msZDYlRksBUQD4TJpeoCxYikxuPx9ylE8cGle2qMHzdayM31rZ6AJSqZEMGFlWPIOsvTyBtO0yYFF+glP/cw1FUxDYTeBynEyjIH0PpMGwLY8rU4EZlQI4pU0aKEsziZt6AkkkGE7R3KMTWiOcqdprNp41RoW1Bqjrkf/j0iIzsvZv0aol0hfcfxg3jKnGagVZfmX9K3UQexDgIe5n/1P/dM91Zh3uMkrRMt2WYExd6nI5B3YzxTj1xzla7fYFixl6BudS9lhkmvg=
distributions: sdist
on:
tags: true
all_branches: true
python: 3.6

python:
- 3.4
- 3.6
env:
matrix:
- KAFKA_VERSION=0.9.0.1 SCALA_VERSION=2.11 PYTHONASYNCIODEBUG=1
- KAFKA_VERSION=0.9.0.1 SCALA_VERSION=2.11 PYTHONASYNCIODEBUG=1 AIOKAFKA_NO_EXTENSIONS=1
- KAFKA_VERSION=0.10.2.1 SCALA_VERSION=2.11 PYTHONASYNCIODEBUG=1
- KAFKA_VERSION=0.10.2.1 SCALA_VERSION=2.11 PYTHONASYNCIODEBUG=1 AIOKAFKA_NO_EXTENSIONS=1
- KAFKA_VERSION=0.11.0.0 SCALA_VERSION=2.12 PYTHONASYNCIODEBUG=1
- KAFKA_VERSION=0.11.0.0 SCALA_VERSION=2.12 PYTHONASYNCIODEBUG=1 AIOKAFKA_NO_EXTENSIONS=1
- 3.6

before_install:
- sudo apt-get update
- sudo apt-get install -y libsnappy-dev
- sudo apt-get update
- sudo apt-get install -y libsnappy-dev

install:
- pip install --upgrade pip setuptools wheel
- pip install flake8
- pip install pytest pytest-cov pytest-catchlog docker-py
- pip install codecov
- pip install cython
- pip install python-snappy
- pip install lz4 xxhash
- pip install pathlib
- pip install -vv -Ue .

script:
- make cov FLAGS="-v"
- pip install --upgrade pip setuptools wheel
- pip install flake8
- pip install "pytest<3.3.0" pytest-cov pytest-catchlog docker-py
- pip install codecov
- pip install cython
- pip install python-snappy
- pip install lz4 xxhash
- pip install pathlib
- pip install -vv -Ue .

after_success:
- codecov

deploy:
provider: pypi
user: andrew.svetlov
password:
secure: "o1Ws6S+Tc9880TEcDHMLEFbehGmQKvr7BTwoOuVMgZ4WCVt8CS96I2rjFzZIUIxeIwd/+Mgz37XEjbQy1slkOCh2aapCq361HM6L6c/3V6dvx0Kw2mRZzr/GwfgiuR6JersgSYnuu1WnwetQ2YPVhrXWFWDAA3oZs22R9CmWrvo="
distributions: "sdist"
on:
tags: true
all_branches: true
python: 3.6
- codecov
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ vtest: flake
py.test -s -v --no-print-logs --docker-image $(DOCKER_IMAGE) $(FLAGS) -Wdefault tests

cov cover coverage: flake
py.test -s --cov aiokafka --cov-report html --docker-image $(DOCKER_IMAGE) $(FLAGS) tests
py.test -s --cov aiokafka --cov-report html --docker-image $(DOCKER_IMAGE) -Wdefault $(FLAGS) tests
@echo "open file://`pwd`/htmlcov/index.html"

ci-test-unit:
py.test -s --cov aiokafka --cov-report html -Wdefault $(FLAGS) tests

ci-test-all:
py.test -s --cov aiokafka --cov-report html --docker-image $(DOCKER_IMAGE) -Wdefault $(FLAGS) tests

coverage.xml: .coverage
coverage xml

Expand Down
2 changes: 1 addition & 1 deletion aiokafka/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.4.2.dev' # noqa
__version__ = '0.4.2.dev0' # noqa

from .abc import ConsumerRebalanceListener
from .client import AIOKafkaClient
Expand Down
15 changes: 12 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@
def pytest_addoption(parser):
parser.addoption('--docker-image',
action='store',
default='pygo/kafka:2.11_0.9.0.1',
default=None,
help='Kafka docker image to use')
parser.addoption('--no-pull',
action='store_true',
help='Do not pull new docker image before test run')


@pytest.fixture(scope='session')
def docker():
def docker(request):
image = request.config.getoption('--docker-image')
if not image:
return None
return libdocker.Client(version='auto')


Expand Down Expand Up @@ -77,8 +80,10 @@ def docker_ip_address():
else:

@pytest.fixture(scope='session')
def docker_ip_address(docker):
def docker_ip_address(request, docker):
"""Returns IP address of the docker daemon service."""
if not docker:
return '127.0.0.1'
# Fallback docker daemon bridge name
ifname = 'docker0'
try:
Expand Down Expand Up @@ -118,6 +123,10 @@ def session_id():
def kafka_server(request, docker, docker_ip_address,
unused_port, session_id, ssl_folder):
image = request.config.getoption('--docker-image')
if not image:
pytest.skip(
"Skipping functional test as `--docker-image` not provided")
return
if not request.config.getoption('--no-pull'):
docker.pull(image)
kafka_host = docker_ip_address
Expand Down
3 changes: 2 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def test_init_with_list(self):
loop=self.loop, bootstrap_servers=[
'127.0.0.1:9092', '127.0.0.2:9092', '127.0.0.3:9092'])
self.assertEqual(
'<AIOKafkaClient client_id=aiokafka-0.4.2.dev>', client.__repr__())
'<AIOKafkaClient client_id=aiokafka-0.4.2.dev0>',
client.__repr__())
self.assertEqual(
sorted([('127.0.0.1', 9092, socket.AF_INET),
('127.0.0.2', 9092, socket.AF_INET),
Expand Down

0 comments on commit 04d95eb

Please sign in to comment.