Skip to content

Commit 3d2bec7

Browse files
committed
Setup CI
1 parent f62a2d3 commit 3d2bec7

File tree

5 files changed

+83
-4
lines changed

5 files changed

+83
-4
lines changed

.travis.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
sudo: false
2+
dist: xenial
3+
addons:
4+
apt:
5+
packages:
6+
- libevent-dev
7+
cache:
8+
pip: true
9+
directories:
10+
- zookeeper
11+
language: python
12+
python:
13+
- '3.7'
14+
matrix:
15+
include:
16+
- python: '2.7'
17+
env: TOX_ENV=py27
18+
- python: '3.4'
19+
env: TOX_ENV=py34
20+
- python: '3.5'
21+
env: TOX_ENV=py35
22+
- python: '3.6'
23+
env: TOX_ENV=py36
24+
# - python: '3.7'
25+
# env: TOX_ENV=py37
26+
# - python: '3.8'
27+
# env: TOX_ENV=py38
28+
# - python: pypy
29+
# env: TOX_ENV=pypy
30+
# - python: pypy3
31+
# env: TOX_ENV=pypy3
32+
notifications:
33+
email: false
34+
install:
35+
- pip install tox codecov
36+
- ZOOKEEPER_VERSION=3.4.9 bash -x ./tools/ci/ensure-zookeeper-env.sh
37+
script:
38+
- export ZOOKEEPER_PATH="$(pwd)/zookeeper/3.4.9/lib"
39+
- tox -e $TOX_ENV
40+
- codecov

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Huskar SDK
22

3+
[![Build Status](https://travis-ci.com/huskar-org/huskar-python.svg?branch=master)](https://travis-ci.com/huskar-org/huskar-python)
4+
[![codecov](https://codecov.io/gh/huskar-org/huskar-python/branch/master/graph/badge.svg)](https://codecov.io/gh/huskar-org/huskar-python)
5+
36
- [Documentation](https://github.com/huskar-org/huskar-python)
47

58
- [Toturial](https://github.com/huskar-org/huskar-python)

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def run_tests(self):
6262
"pytest-cov==2.5.1",
6363
"pytest-xdist==1.20.0",
6464
"pytest-mock==1.6.2",
65+
"pytest-forked==0.2",
6566
"mock==2.0.0"]
6667

6768
setup(

tools/ci/ensure-zookeeper-env.sh

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
# base on https://github.com/python-zk/kazoo/blob/master/ensure-zookeeper-env.sh
4+
5+
set -euo pipefail
6+
set -x
7+
IFS=$'\n\t'
8+
9+
HERE=$(pwd)
10+
ZOO_BASE_DIR="$HERE/zookeeper"
11+
ZOOKEEPER_VERSION=${ZOOKEEPER_VERSION:-3.4.9}
12+
ZOOKEEPER_PATH="$ZOO_BASE_DIR/$ZOOKEEPER_VERSION"
13+
ZOOKEEPER_PREFIX="${ZOOKEEPER_PREFIX:-}"
14+
ZOOKEEPER_SUFFIX="${ZOOKEEPER_SUFFIX:-}"
15+
ZOOKEEPER_LIB="${ZOOKEEPER_LIB:-lib}"
16+
ZOO_MIRROR_URL="http://archive.apache.org/dist"
17+
18+
19+
function download_zookeeper(){
20+
mkdir -p "$ZOO_BASE_DIR"
21+
cd "$ZOO_BASE_DIR"
22+
curl --silent -C - "$ZOO_MIRROR_URL/zookeeper/zookeeper-$ZOOKEEPER_VERSION/${ZOOKEEPER_PREFIX}zookeeper-${ZOOKEEPER_VERSION}${ZOOKEEPER_SUFFIX}.tar.gz" | tar -zx
23+
mv "${ZOOKEEPER_PREFIX}zookeeper-${ZOOKEEPER_VERSION}${ZOOKEEPER_SUFFIX}" "$ZOOKEEPER_VERSION"
24+
chmod a+x "$ZOOKEEPER_PATH/bin/zkServer.sh"
25+
}
26+
27+
if [ ! -d "$ZOOKEEPER_PATH" ]; then
28+
download_zookeeper
29+
echo "Downloaded zookeeper $ZOOKEEPER_VERSION to $ZOOKEEPER_PATH"
30+
else
31+
echo "Already downloaded zookeeper $ZOOKEEPER_VERSION to $ZOOKEEPER_PATH"
32+
fi
33+
34+
# Used as install_path when starting ZK
35+
export ZOOKEEPER_PATH="${ZOOKEEPER_PATH}/${ZOOKEEPER_LIB}"
36+
echo "$ZOOKEEPER_PATH"

tox.ini

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
[tox]
22
minversion = 2.5
3-
envlist = erase,py27,py34,py35
3+
envlist = erase,py27,py34,py35,py36,py37,py38,pypy,pypy3
44

55
[testenv]
6-
changedir = {toxinidir}/.tox
76
deps =
87
flake8
98
extras =
109
test
1110
bootstrap
1211
setenv =
1312
commands =
14-
flake8 --exclude=.tox,.venv,docs,build {toxinidir}
15-
py.test --cov={envsitepackagesdir}/huskar_sdk_v2 --cov-append --boxed {toxinidir} {posargs}
13+
flake8 --exclude=.tox,.venv,docs,build,zookeeper huskar_sdk_v2
14+
py.test --cov=huskar_sdk_v2 tests/
1615

1716
[testenv:erase]
1817
basepython = python2.7

0 commit comments

Comments
 (0)