Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #23 from Grokzen/travis-ci
Browse files Browse the repository at this point in the history
TravisCI & coveralls support.
  • Loading branch information
Grokzen committed Aug 1, 2014
2 parents 0ad5ca8 + 0ebfdf6 commit 04da5ec
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
env27*
.tox
rediscluster.egg-info
.coverage
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
language: python
python:
- "3.3"
- "3.2"
- "2.7"
services:
- redis-server
env:
- TEST_HIREDIS=0
- TEST_HIREDIS=1
install:
- make travis-install
- pip install pytest>=2.5.0
- pip install coverage python-coveralls
- pip install -e .
- "if [[ $TEST_PEP8 == '1' ]]; then pip install pep8; fi"
- "if [[ $TEST_HIREDIS == '1' ]]; then pip install hiredis; fi"
script: "if [[ $TEST_PEP8 == '1' ]]; then pep8 --repeat --show-source --exclude=.venv,.tox,dist,docs,build,rediscluster.egg-info,.git --ignore=E501 .; else make test; fi"
after_success: "if [[ $TEST_PEP8 == '1' ]]; then echo 'No coveralls for pep8 tests...'; else coveralls; fi"
matrix:
include:
- python: "2.7"
env: TEST_PEP8=1
- python: "3.4"
env: TEST_PEP8=1
131 changes: 127 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,85 @@
PATH := ./redis-git/src:${PATH}

# CLUSTER REDIS NODES
define REDIS_CLUSTER_NODE1_CONF
daemonize yes
port 7000
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node1.pid
logfile /tmp/redis_cluster_node1.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node1.conf
endef

define REDIS_CLUSTER_NODE2_CONF
daemonize yes
port 7001
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node2.pid
logfile /tmp/redis_cluster_node2.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node2.conf
endef

define REDIS_CLUSTER_NODE3_CONF
daemonize yes
port 7002
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node3.pid
logfile /tmp/redis_cluster_node3.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node3.conf
endef

define REDIS_CLUSTER_NODE4_CONF
daemonize yes
port 7003
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node4.pid
logfile /tmp/redis_cluster_node4.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node4.conf
endef

define REDIS_CLUSTER_NODE5_CONF
daemonize yes
port 7004
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node5.pid
logfile /tmp/redis_cluster_node5.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node5.conf
endef

define REDIS_CLUSTER_NODE6_CONF
daemonize yes
port 7005
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node6.pid
logfile /tmp/redis_cluster_node6.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node6.conf
endef

export REDIS_CLUSTER_NODE1_CONF
export REDIS_CLUSTER_NODE2_CONF
export REDIS_CLUSTER_NODE3_CONF
export REDIS_CLUSTER_NODE4_CONF
export REDIS_CLUSTER_NODE5_CONF
export REDIS_CLUSTER_NODE6_CONF

help:
@echo "Please use 'make <target>' where <target> is one of"
@echo " clean remove temporary files created by build tools"
Expand All @@ -7,6 +89,8 @@ help:
@echo " sdist make a source distribution"
@echo " bdist make an egg distribution"
@echo " install install package"
@echo " *** CI Commands ***"
@echo " start starts a test redis cluster"

clean:
-rm -f MANIFEST
Expand All @@ -23,10 +107,6 @@ cleanall: clean cleanmeta
-find . -type f -name "*.pyc" -exec rm -f "{}" \;
-find . -type f -name "*.parse-index" -exec rm -f "{}" \;

test:
python runtests.py
pep8 --ignore=E501,E241 --show-source --exclude=.vev,.tox,dist,doc,build,*.egg .

sdist: cleanmeta
python setup.py sdist

Expand All @@ -35,3 +115,46 @@ bdist: cleanmeta

install:
python setup.py install

start: cleanup
echo "$$REDIS_CLUSTER_NODE1_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE2_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE3_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE4_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE5_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE6_CONF" | redis-server -

cleanup:
- rm -vf /tmp/redis_cluster_node*.conf 2>/dev/null
- rm dump.rdb appendonly.aof - 2>/dev/null

stop:
kill `cat /tmp/redis_cluster_node1.pid` || true
kill `cat /tmp/redis_cluster_node2.pid` || true
kill `cat /tmp/redis_cluster_node3.pid` || true
kill `cat /tmp/redis_cluster_node4.pid` || true
kill `cat /tmp/redis_cluster_node5.pid` || true
kill `cat /tmp/redis_cluster_node6.pid` || true
rm -f /tmp/redis_cluster_node1.conf
rm -f /tmp/redis_cluster_node2.conf
rm -f /tmp/redis_cluster_node3.conf
rm -f /tmp/redis_cluster_node4.conf
rm -f /tmp/redis_cluster_node5.conf
rm -f /tmp/redis_cluster_node6.conf

test:
make start
sleep 5
echo "yes" | ruby redis-git/src/redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005
sleep 5
coverage erase
coverage run --source rediscluster/ -m py.test
make stop

travis-install:
[ ! -e redis-git ] && git clone https://github.com/antirez/redis.git redis-git || true
make -C redis-git -j4
gem install redis
sleep 3

.PHONY: test
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ This project is a port to python based on the redis-rb-cluster implementation do

The original source can be found at https://github.com/antirez/redis-rb-cluster

[![Build Status](https://travis-ci.org/Grokzen/redis-py-cluster.svg?branch=master)](https://travis-ci.org/Grokzen/redis-py-cluster) - [![Coverage Status](https://coveralls.io/repos/Grokzen/redis-py-cluster/badge.png)](https://coveralls.io/r/Grokzen/redis-py-cluster)



## Dependencies
Expand Down

0 comments on commit 04da5ec

Please sign in to comment.