Skip to content

Commit

Permalink
chore(ci) new setup + compatible with new CLI/tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed Jul 19, 2016
1 parent cd758d2 commit ec1e70d
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 211 deletions.
26 changes: 11 additions & 15 deletions .ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@

set -e

export BUSTED_ARGS="-o gtest -v --exclude-tags=ci"

if [ "$TEST_SUITE" == "unit" ]; then
kong config -c kong.yml -e TEST -s TEST
make lint
make test
else
kong config -c kong.yml -d $DATABASE -e TEST -s TEST
fi

createuser --createdb kong
createdb -U kong kong_tests
createuser --createdb kong
createdb -U kong kong_tests

CMD="busted -v -o gtest --exclude-tags=ci"

if [ "$TEST_SUITE" == "unit" ]; then
CMD="$CMD --coverage spec/unit && luacov-coveralls -i kong"
elif [ "$TEST_SUITE" == "plugins" ]; then
CMD="$CMD spec/plugins"
elif [ "$TEST_SUITE" == "integration" ]; then
CMD="$CMD spec/integration"
if [ "$TEST_SUITE" == "integration" ]; then
make test-integration
elif [ "$TEST_SUITE" == "plugins" ]; then
make test-plugins
fi
fi

eval $CMD
10 changes: 0 additions & 10 deletions .ci/setenv_kong.sh

This file was deleted.

19 changes: 0 additions & 19 deletions .ci/setup_cassandra.sh

This file was deleted.

22 changes: 0 additions & 22 deletions .ci/setup_dnsmasq.sh

This file was deleted.

94 changes: 94 additions & 0 deletions .ci/setup_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
set -e

OPENRESTY_INSTALL=$CACHE_DIR/openresty
LUAROCKS_INSTALL=$CACHE_DIR/luarocks
SERF_INSTALL=$CACHE_DIR/serf

mkdir -p $CACHE_DIR

if [ ! "$(ls -A $CACHE_DIR)" ]; then
# Not in cache

# ---------------
# Install OpenSSL
# ---------------
OPENSSL_BASE=openssl-$OPENSSL
curl -L http://www.openssl.org/source/$OPENSSL_BASE.tar.gz | tar xz

# -----------------
# Install OpenResty
# -----------------
OPENRESTY_BASE=openresty-$OPENRESTY
mkdir -p $OPENRESTY_INSTALL
curl -L https://openresty.org/download/$OPENRESTY_BASE.tar.gz | tar xz

pushd $OPENRESTY_BASE
./configure \
--prefix=$OPENRESTY_INSTALL \
--with-openssl=../$OPENSSL_BASE \
--with-ipv6 \
--with-pcre-jit \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_stub_status_module \
--without-lua_resty_websocket \
--without-lua_resty_upload \
--without-lua_resty_mysql \
--without-lua_resty_redis \
--without-http_redis_module \
--without-http_redis2_module \
--without-lua_redis_parser
make
make install
popd

rm -rf $OPENRESTY_BASE

# ----------------
# Install Luarocks
# ----------------
LUAROCKS_BASE=luarocks-$LUAROCKS
mkdir -p $LUAROCKS_INSTALL
git clone https://github.com/keplerproject/luarocks.git $LUAROCKS_BASE

pushd $LUAROCKS_BASE
git checkout v$LUAROCKS
./configure \
--prefix=$LUAROCKS_INSTALL \
--lua-suffix=jit \
--with-lua=$OPENRESTY_INSTALL/luajit \
--with-lua-include=$OPENRESTY_INSTALL/luajit/include/luajit-2.1
make build
make install
popd

rm -rf $LUAROCKS_BASE

# ------------
# Install Serf
# ------------
mkdir -p $SERF_INSTALL
pushd $SERF_INSTALL
wget https://releases.hashicorp.com/serf/${SERF}/serf_${SERF}_linux_amd64.zip
unzip serf_${SERF}_linux_amd64.zip
popd
fi

export PATH=$PATH:$OPENRESTY_INSTALL/nginx/sbin:$OPENRESTY_INSTALL/bin:$LUAROCKS_INSTALL/bin:$SERF_INSTALL

eval `luarocks path`

# -------------------------------------
# Install ccm & setup Cassandra cluster
# -------------------------------------
if [ "$TEST_SUITE" != "unit" ]; then
pip install --user PyYAML six
git clone https://github.com/pcmanus/ccm.git
pushd ccm
./setup.py install --user
popd
ccm create test -v binary:$CASSANDRA -n 1 -d
ccm start -v
ccm status
fi

54 changes: 0 additions & 54 deletions .ci/setup_lua.sh

This file was deleted.

35 changes: 0 additions & 35 deletions .ci/setup_openresty.sh

This file was deleted.

17 changes: 0 additions & 17 deletions .ci/setup_serf.sh

This file was deleted.

48 changes: 17 additions & 31 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,45 @@
sudo: false

notifications:
email: false

addons:
postgresql: "9.4"
apt:
packages:
- sed
- net-tools
- dnsmasq
- uuid-dev
- net-tools
- libpcre3-dev
- build-essential

env:
global:
- LUAJIT=2.1
- SERF=0.7.0
- LUAROCKS=2.3.0
- OPENRESTY=1.9.7.3
- CASSANDRA=2.2.4
- OPENSSL=1.0.2f
- SERF=0.7.0
- DNSMASQ=2.75
- CASSANDRA_HOSTS=127.0.0.1
- OPENRESTY_DIR=$HOME/openresty-$OPENRESTY
- SERF_DIR=$HOME/serf
- DNSMASQ_DIR=$HOME/dnsmasq
- LUA_DIR=$HOME/lua
- LUAROCKS_DIR=$HOME/luarocks
- CASSANDRA=2.2.4
- OPENRESTY=1.9.7.3
- $CACHE_DIR=$HOME/cache
matrix:
- TEST_SUITE=unit
- TEST_SUITE=integration
DATABASE=cassandra
- TEST_SUITE=plugins
DATABASE=cassandra
- TEST_SUITE=integration
DATABASE=postgres
- TEST_SUITE=plugins
DATABASE=postgres

before_install:
- source .ci/setenv_kong.sh
- bash .ci/setup_cassandra.sh
- source .ci/setup_env.sh

install:
- luarocks purge --tree=$LUAROCKS_DIR
- luarocks install busted
- luarocks install luacov-coveralls
- luarocks install luacheck
- luarocks make
- make dev

script:
- make lint
- .ci/run_tests.sh

cache:
apt: true
pip: true
directories:
- $LUA_DIR
- $LUAROCKS_DIR
- $SERF_DIR
- $DNSMASQ_DIR
- $OPENRESTY_DIR
- $CACHE_DIR
- $HOME/.ccm/repository

Loading

0 comments on commit ec1e70d

Please sign in to comment.