Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(travis) add support for openresty-patches #3476

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .ci/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ set -e
#---------
OPENSSL_DOWNLOAD=$DOWNLOAD_CACHE/openssl-$OPENSSL
OPENRESTY_DOWNLOAD=$DOWNLOAD_CACHE/openresty-$OPENRESTY
OPENRESTY_PATCHES_DOWNLOAD=$DOWNLOAD_CACHE/openresty-patches-master
LUAROCKS_DOWNLOAD=$DOWNLOAD_CACHE/luarocks-$LUAROCKS

mkdir -p $OPENSSL_DOWNLOAD $OPENRESTY_DOWNLOAD $LUAROCKS_DOWNLOAD
mkdir -p $OPENSSL_DOWNLOAD $OPENRESTY_DOWNLOAD $OPENRESTY_PATCHES_DOWNLOAD $LUAROCKS_DOWNLOAD

if [ ! "$(ls -A $OPENSSL_DOWNLOAD)" ]; then
pushd $DOWNLOAD_CACHE
Expand All @@ -22,6 +23,12 @@ if [ ! "$(ls -A $OPENRESTY_DOWNLOAD)" ]; then
popd
fi

if [ ! "$(ls -A $OPENRESTY_PATCHES_DOWNLOAD)" ]; then
pushd $DOWNLOAD_CACHE
curl -s -S -L https://github.com/Kong/openresty-patches/archive/master.tar.gz | tar xz
popd
fi

if [ ! "$(ls -A $LUAROCKS_DOWNLOAD)" ]; then
git clone -q https://github.com/keplerproject/luarocks.git $LUAROCKS_DOWNLOAD
fi
Expand All @@ -37,6 +44,7 @@ mkdir -p $OPENSSL_INSTALL $OPENRESTY_INSTALL $LUAROCKS_INSTALL

if [ ! "$(ls -A $OPENSSL_INSTALL)" ]; then
pushd $OPENSSL_DOWNLOAD
echo "Installing OpenSSL $OPENSSL..."
./config shared --prefix=$OPENSSL_INSTALL &> build.log || (cat build.log && exit 1)
make &> build.log || (cat build.log && exit 1)
make install &> build.log || (cat build.log && exit 1)
Expand All @@ -56,6 +64,15 @@ if [ ! "$(ls -A $OPENRESTY_INSTALL)" ]; then
)

pushd $OPENRESTY_DOWNLOAD
if [ -d $OPENRESTY_PATCHES_DOWNLOAD/patches/$OPENRESTY ]; then
pushd bundle
for patch_file in $(ls -1 $OPENRESTY_PATCHES_DOWNLOAD/patches/$OPENRESTY/*.patch); do
echo "Applying OpenResty patch $patch_file"
patch -p1 < $patch_file 2> build.log || (cat build.log && exit 1)
done
popd
fi
echo "Installing OpenResty $OPENRESTY..."
./configure ${OPENRESTY_OPTS[*]} &> build.log || (cat build.log && exit 1)
make &> build.log || (cat build.log && exit 1)
make install &> build.log || (cat build.log && exit 1)
Expand All @@ -64,6 +81,7 @@ fi

if [ ! "$(ls -A $LUAROCKS_INSTALL)" ]; then
pushd $LUAROCKS_DOWNLOAD
echo "Installing LuaRocks $LUAROCKS..."
git checkout -q v$LUAROCKS
./configure \
--prefix=$LUAROCKS_INSTALL \
Expand All @@ -86,6 +104,7 @@ eval `luarocks path`
# Install ccm & setup Cassandra cluster
# -------------------------------------
if [[ "$TEST_SUITE" != "unit" ]] && [[ "$TEST_SUITE" != "lint" ]]; then
echo "Installing ccm and setting up Cassandra cluster..."
pip install --user PyYAML six ccm &> build.log || (cat build.log && exit 1)
ccm create test -v $CASSANDRA -n 1 -d
ccm start -v
Expand Down