summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOscar Lim <olim@ucla.edu>2016-05-07 13:28:29 -0700
committerOscar Lim <olim@ucla.edu>2016-05-07 13:34:03 -0700
commit61067b665311b5ae6efc56e4df90e5b348a73814 (patch)
treee451cc57a766ec7e1357fcac83f3aebb4dd43811
parent67e5f4ff685bee3fa381db6f50be3506ad0b5e76 (diff)
downloadluasystem-61067b665311b5ae6efc56e4df90e5b348a73814.zip
New travis infrastructure
Changes the travis setup and drop `sudo` in favor of the faster container-based travis infrastructure.
-rw-r--r--.travis.yml19
-rw-r--r--.travis/platform.sh15
-rw-r--r--.travis/setenv_lua.sh3
-rw-r--r--.travis/setup_lua.sh122
-rw-r--r--.travis_setup.sh45
5 files changed, 152 insertions, 52 deletions
diff --git a/.travis.yml b/.travis.yml
index acfaa21..129680d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,17 +1,22 @@
language: c
env:
- - LUA='Lua 5.1'
- - LUA='Lua 5.2'
- - LUA='Lua 5.3'
- - LUA='LuaJIT 2.0'
+ global:
+ - LUAROCKS=2.3.0
+ matrix:
+ - LUA=lua5.1
+ - LUA=lua5.2
+ - LUA=lua5.3
+ - LUA=luajit
+ - LUA=luajit2.0
+ - LUA=luajit2.1
before_install:
- - bash .travis_setup.sh
+ - source .travis/setenv_lua.sh
install:
- - sudo luarocks install busted
- - sudo luarocks make luasystem-scm-0.rockspec
+ - luarocks install busted
+ - luarocks make luasystem-scm-0.rockspec
script: busted spec
diff --git a/.travis/platform.sh b/.travis/platform.sh
new file mode 100644
index 0000000..7259a7d
--- /dev/null
+++ b/.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/.travis/setenv_lua.sh b/.travis/setenv_lua.sh
new file mode 100644
index 0000000..8d8c825
--- /dev/null
+++ b/.travis/setenv_lua.sh
@@ -0,0 +1,3 @@
+export PATH=${PATH}:$HOME/.lua:$HOME/.local/bin:${TRAVIS_BUILD_DIR}/install/luarocks/bin
+bash .travis/setup_lua.sh
+eval `$HOME/.lua/luarocks path`
diff --git a/.travis/setup_lua.sh b/.travis/setup_lua.sh
new file mode 100644
index 0000000..6dcc0c6
--- /dev/null
+++ b/.travis/setup_lua.sh
@@ -0,0 +1,122 @@
+#! /bin/bash
+
+# A script for setting up environment for travis-ci testing.
+# Sets up Lua and Luarocks.
+# LUA must be "lua5.1", "lua5.2" or "luajit".
+# luajit2.0 - master v2.0
+# luajit2.1 - master v2.1
+
+set -eufo pipefail
+
+LUAJIT_VERSION="2.0.4"
+LUAJIT_BASE="LuaJIT-$LUAJIT_VERSION"
+
+source .travis/platform.sh
+
+LUA_HOME_DIR=$TRAVIS_BUILD_DIR/install/lua
+
+LR_HOME_DIR=$TRAVIS_BUILD_DIR/install/luarocks
+
+mkdir $HOME/.lua
+
+LUAJIT="no"
+
+if [ "$PLATFORM" == "macosx" ]; then
+ if [ "$LUA" == "luajit" ]; then
+ LUAJIT="yes";
+ fi
+ if [ "$LUA" == "luajit2.0" ]; then
+ LUAJIT="yes";
+ fi
+ if [ "$LUA" == "luajit2.1" ]; then
+ LUAJIT="yes";
+ fi;
+elif [ "$(expr substr $LUA 1 6)" == "luajit" ]; then
+ LUAJIT="yes";
+fi
+
+mkdir -p "$LUA_HOME_DIR"
+
+if [ "$LUAJIT" == "yes" ]; then
+
+ if [ "$LUA" == "luajit" ]; then
+ curl --location https://github.com/LuaJIT/LuaJIT/archive/v$LUAJIT_VERSION.tar.gz | tar xz;
+ else
+ git clone https://github.com/LuaJIT/LuaJIT.git $LUAJIT_BASE;
+ fi
+
+ cd $LUAJIT_BASE
+
+ if [ "$LUA" == "luajit2.1" ]; then
+ git checkout v2.1;
+ # force the INSTALL_TNAME to be luajit
+ perl -i -pe 's/INSTALL_TNAME=.+/INSTALL_TNAME= luajit/' Makefile
+ fi
+
+ make && make install PREFIX="$LUA_HOME_DIR"
+
+ ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/luajit
+ ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/lua;
+
+else
+
+ if [ "$LUA" == "lua5.1" ]; then
+ curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz
+ cd lua-5.1.5;
+ elif [ "$LUA" == "lua5.2" ]; then
+ curl http://www.lua.org/ftp/lua-5.2.4.tar.gz | tar xz
+ cd lua-5.2.4;
+ elif [ "$LUA" == "lua5.3" ]; then
+ curl http://www.lua.org/ftp/lua-5.3.2.tar.gz | tar xz
+ cd lua-5.3.2;
+ fi
+
+ # Build Lua without backwards compatibility for testing
+ perl -i -pe 's/-DLUA_COMPAT_(ALL|5_2)//' src/Makefile
+ make $PLATFORM
+ make INSTALL_TOP="$LUA_HOME_DIR" install;
+
+ ln -s $LUA_HOME_DIR/bin/lua $HOME/.lua/lua
+ ln -s $LUA_HOME_DIR/bin/luac $HOME/.lua/luac;
+
+fi
+
+cd $TRAVIS_BUILD_DIR
+
+lua -v
+
+LUAROCKS_BASE=luarocks-$LUAROCKS
+
+curl --location http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz | tar xz
+
+cd $LUAROCKS_BASE
+
+if [ "$LUA" == "luajit" ]; then
+ ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR";
+elif [ "$LUA" == "luajit2.0" ]; then
+ ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR";
+elif [ "$LUA" == "luajit2.1" ]; then
+ ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.1" --prefix="$LR_HOME_DIR";
+else
+ ./configure --with-lua="$LUA_HOME_DIR" --prefix="$LR_HOME_DIR"
+fi
+
+make build && make install
+
+ln -s $LR_HOME_DIR/bin/luarocks $HOME/.lua/luarocks
+
+cd $TRAVIS_BUILD_DIR
+
+luarocks --version
+
+rm -rf $LUAROCKS_BASE
+
+if [ "$LUAJIT" == "yes" ]; then
+ rm -rf $LUAJIT_BASE;
+elif [ "$LUA" == "lua5.1" ]; then
+ rm -rf lua-5.1.5;
+elif [ "$LUA" == "lua5.2" ]; then
+ rm -rf lua-5.2.4;
+elif [ "$LUA" == "lua5.3" ]; then
+ rm -rf lua-5.3.2;
+fi
diff --git a/.travis_setup.sh b/.travis_setup.sh
deleted file mode 100644
index f186230..0000000
--- a/.travis_setup.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-# A script for setting up environment for travis-ci testing.
-# Sets up Lua and Luarocks.
-# LUA must be "Lua 5.1", "Lua 5.2", "Lua 5.3" or "LuaJIT 2.0".
-
-set -e
-
-echo 'rocks_servers = {
- "http://luarocks.org/manifests/olivine-labs",
- "http://rocks.moonscript.org/",
- "http://luarocks.org/repositories/rocks",
- "http://luarocks.logiceditor.com/rocks",
- "http://liblua.so/luarocks/repositories/rocks"
-}' >> ~/config.lua
-
-
-if [ "$LUA" == "LuaJIT 2.0" ]; then
- wget -O - http://luajit.org/download/LuaJIT-2.0.4.tar.gz | tar xz
- cd LuaJIT-2.0.4
- make && sudo make install INSTALL_TSYMNAME=lua;
-else
- if [ "$LUA" == "Lua 5.1" ]; then
- wget -O - http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz
- cd lua-5.1.5;
- elif [ "$LUA" == "Lua 5.2" ]; then
- wget -O - http://www.lua.org/ftp/lua-5.2.4.tar.gz | tar xz
- cd lua-5.2.4;
- elif [ "$LUA" == "Lua 5.3" ]; then
- wget -O - http://www.lua.org/ftp/lua-5.3.2.tar.gz | tar xz
- cd lua-5.3.2;
- fi
- sudo make linux install;
-fi
-
-cd ..
-wget -O - http://luarocks.org/releases/luarocks-2.3.0.tar.gz | tar xz || wget -O - http://keplerproject.github.io/luarocks/releases/luarocks-2.3.0.tar.gz | tar xz
-cd luarocks-2.3.0
-
-if [ "$LUA" == "LuaJIT 2.0" ]; then
- ./configure --with-lua-include=/usr/local/include/luajit-2.0;
-else
- ./configure;
-fi
-
-make build && sudo make install
-cd ..