summaryrefslogtreecommitdiffstats
path: root/src/civetweb/ci/travis
diff options
context:
space:
mode:
Diffstat (limited to 'src/civetweb/ci/travis')
-rwxr-xr-xsrc/civetweb/ci/travis/install_rocks.sh14
-rwxr-xr-xsrc/civetweb/ci/travis/lua_env.sh5
-rwxr-xr-xsrc/civetweb/ci/travis/platform.sh15
-rwxr-xr-xsrc/civetweb/ci/travis/run_ci_tests.sh7
-rwxr-xr-xsrc/civetweb/ci/travis/setup_lua.sh61
5 files changed, 102 insertions, 0 deletions
diff --git a/src/civetweb/ci/travis/install_rocks.sh b/src/civetweb/ci/travis/install_rocks.sh
new file mode 100755
index 00000000..739248b8
--- /dev/null
+++ b/src/civetweb/ci/travis/install_rocks.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+set -ev
+
+source ci/travis/lua_env.sh
+
+# add any rocks required for ci_tests to this list
+# lua-curl depends on a libcurl development package (i.e. libcurl4-openssl-dev)
+ROCKS=(lua-curl busted)
+
+for ROCK in ${ROCKS[*]}
+do
+ $LUAROCKS install $ROCK
+done
+
diff --git a/src/civetweb/ci/travis/lua_env.sh b/src/civetweb/ci/travis/lua_env.sh
new file mode 100755
index 00000000..dd742e91
--- /dev/null
+++ b/src/civetweb/ci/travis/lua_env.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+LUAROCKS=ci/lua/bin/luarocks
+eval $($LUAROCKS path --bin)
+
diff --git a/src/civetweb/ci/travis/platform.sh b/src/civetweb/ci/travis/platform.sh
new file mode 100755
index 00000000..4a3af0d4
--- /dev/null
+++ b/src/civetweb/ci/travis/platform.sh
@@ -0,0 +1,15 @@
+if [ -z "$PLATFORM" ]; then
+ PLATFORM=$TRAVIS_OS_NAME;
+fi
+
+if [ "$PLATFORM" == "osx" ]; then
+ PLATFORM="macosx";
+fi
+
+if [ -z "$PLATFORM" ]; then
+ if [ "$(uname)" == "Linux" ]; then
+ PLATFORM="linux";
+ else
+ PLATFORM="macosx";
+ fi;
+fi
diff --git a/src/civetweb/ci/travis/run_ci_tests.sh b/src/civetweb/ci/travis/run_ci_tests.sh
new file mode 100755
index 00000000..16c2cc06
--- /dev/null
+++ b/src/civetweb/ci/travis/run_ci_tests.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+set -ev
+
+source ci/travis/lua_env.sh
+busted -o TAP ci/test/
+
+
diff --git a/src/civetweb/ci/travis/setup_lua.sh b/src/civetweb/ci/travis/setup_lua.sh
new file mode 100755
index 00000000..8e1b324e
--- /dev/null
+++ b/src/civetweb/ci/travis/setup_lua.sh
@@ -0,0 +1,61 @@
+#!/usr/bin/env /bash
+set -ev
+
+# this script installs a lua / luarocks environment in .travis/lua
+# this is necessary because travis docker architecture (the fast way)
+# does not permit sudo, and does not contain a useful lua installation
+
+# After this script is finished, you can configure your environment to
+# use it by sourcing lua_env.sh
+
+source ci/travis/platform.sh
+
+# The current versions when this script was written
+LUA_VERSION=5.2.4
+LUAROCKS_VERSION=2.2.2
+
+# directory where this script is located
+SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+
+# civetweb base dir
+PROJECT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../.. && pwd )
+
+# fetch and unpack lua src
+cd $SCRIPT_DIR
+LUA_BASE=lua-$LUA_VERSION
+rm -rf $LUA_BASE
+curl http://www.lua.org/ftp/$LUA_BASE.tar.gz | tar zx
+
+# build lua
+cd $LUA_BASE
+make $PLATFORM
+make local
+
+# mv built lua install to target Lua dir
+LUA_DIR=$PROJECT_DIR/ci/lua
+rm -rf $LUA_DIR
+mv $SCRIPT_DIR/$LUA_BASE/install $LUA_DIR
+
+# add to path required by luarocks installer
+export PATH=$LUA_DIR/bin:$PATH
+
+
+# fetch and unpack luarocks
+cd $SCRIPT_DIR
+LUAROCKS_BASE=luarocks-$LUAROCKS_VERSION
+rm -rf ${LUAROCKS_BASE}
+LUAROCKS_URL=http://luarocks.org/releases/${LUAROCKS_BASE}.tar.gz
+# -L because it's a 302 redirect
+curl -L $LUAROCKS_URL | tar xzp
+cd $LUAROCKS_BASE
+
+# build luarocks
+./configure --prefix=$LUA_DIR
+make build
+make install
+
+# cleanup source dirs
+cd $SCRIPT_DIR
+rm -rf $LUAROCKS_BASE
+rm -rf $LUA_BASE
+