feat: release v3.1.0 (#38) #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and test for Ubuntu latest | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: Build and install dependencies | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
openresty-version: [1.21.4.1] | |
luarocks-version: [3.8.0] | |
steps: | |
- name: Update and install OS dependencies | |
run: sudo apt-get update && sudo apt-get install -y libssl-dev ssl-cert | |
- name: Set environment variables | |
env: | |
LUAROCKS_VER: ${{ matrix.luarocks-version }} | |
OPENRESTY_VER: ${{ matrix.openresty-version }} | |
run: | | |
echo "DOWNLOAD_PATH=$HOME/download-root" >> $GITHUB_ENV | |
export DOWNLOAD_PATH=$HOME/download-root | |
echo "INSTALL_PATH=$HOME/install-root" >> $GITHUB_ENV | |
export INSTALL_PATH=$HOME/install-root | |
echo "LUAROCKS_VER=$LUAROCKS_VER" >> $GITHUB_ENV | |
echo "OPENRESTY_VER=$OPENRESTY_VER" >> $GITHUB_ENV | |
export LUAROCKS_PREFIX=$INSTALL_PATH/luarocks-$LUAROCKS_VER | |
echo "LUAROCKS_PREFIX=$LUAROCKS_PREFIX" >> $GITHUB_ENV | |
export OPENRESTY_PREFIX=$INSTALL_PATH/openresty-$OPENRESTY_VER | |
echo "OPENRESTY_PREFIX=$OPENRESTY_PREFIX" >> $GITHUB_ENV | |
echo "PATH=$DOWNLOAD_PATH:$LUAROCKS_PREFIX/bin:$OPENRESTY_PREFIX/nginx/sbin:$DOWNLOAD_PATH/cpanm:$PATH" >> $GITHUB_ENV | |
- name: Checkout lua-resty-healthcheck | |
uses: actions/checkout@v2 | |
- name: Lookup build cache | |
uses: actions/cache@v2 | |
id: cache-deps | |
with: | |
path: | | |
${{ env.INSTALL_PATH }} | |
~/perl5 | |
key: ${{ runner.os }}-${{ matrix.openresty-version }}-${{ hashFiles('.github/workflows/latest_os.yml') }} | |
- name: Create needed paths | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p $DOWNLOAD_PATH | |
mkdir -p $INSTALL_PATH | |
- name: Build and install OpenResty ${{ matrix.openresty-version }} | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
if [ ! -d $INSTALL_PATH/openresty-$OPENRESTY_VER ]; | |
then | |
pushd $DOWNLOAD_PATH | |
echo "Downloading from http://openresty.org/download/openresty-$OPENRESTY_VER.tar.gz" | |
wget -O $DOWNLOAD_PATH/openresty-$OPENRESTY_VER.tar.gz http://openresty.org/download/openresty-$OPENRESTY_VER.tar.gz | |
echo "tar -zxf $DOWNLOAD_PATH/openresty-$OPENRESTY_VER.tar.gz" | |
tar -zxf $DOWNLOAD_PATH/openresty-$OPENRESTY_VER.tar.gz | |
echo "result: $?" | |
pushd openresty-$OPENRESTY_VER | |
./configure --prefix=$OPENRESTY_PREFIX | |
make | |
make install | |
popd | |
popd | |
fi | |
- name: Build and install LuaRocks ${{ matrix.luarocks-version }} | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
if [ ! -d $INSTALL_PATH/luarocks-$LUAROCKS_VER ]; | |
then | |
pushd $DOWNLOAD_PATH | |
echo "Downloading from https://luarocks.github.io/luarocks/releases/luarocks-$LUAROCKS_VER.tar.gz" | |
wget -O $DOWNLOAD_PATH/luarocks-$LUAROCKS_VER.tar.gz https://luarocks.github.io/luarocks/releases/luarocks-$LUAROCKS_VER.tar.gz | |
tar -zxf $DOWNLOAD_PATH/luarocks-$LUAROCKS_VER.tar.gz | |
pushd luarocks-$LUAROCKS_VER | |
./configure --prefix=$LUAROCKS_PREFIX --with-lua=$OPENRESTY_PREFIX/luajit --with-lua-include=$OPENRESTY_PREFIX/luajit/include/luajit-2.1 --lua-suffix=jit | |
make build | |
make install | |
popd | |
luarocks install luacheck | |
popd | |
fi | |
- name: Install Test::NGINX | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
if [ ! -f $DOWNLOAD_PATH/cpanm ]; | |
then | |
wget -O $DOWNLOAD_PATH/cpanm https://cpanmin.us/ | |
chmod +x $DOWNLOAD_PATH/cpanm | |
cpanm --notest --local-lib=$HOME/perl5 local::lib && eval $(perl -I $HOME/perl5/lib/perl5/ -Mlocal::lib) | |
cpanm --notest Test::Nginx | |
fi | |
lint: | |
name: Static code analysis | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
matrix: | |
openresty-version: [1.21.4.1] | |
luarocks-version: [3.8.0] | |
steps: | |
- name: Checkout lua-resty-healthcheck | |
uses: actions/checkout@v2 | |
- name: Set environment variables | |
env: | |
LUAROCKS_VER: ${{ matrix.luarocks-version }} | |
OPENRESTY_VER: ${{ matrix.openresty-version }} | |
run: | | |
echo "DOWNLOAD_PATH=$HOME/download-root" >> $GITHUB_ENV | |
export DOWNLOAD_PATH=$HOME/download-root | |
echo "INSTALL_PATH=$HOME/install-root" >> $GITHUB_ENV | |
export INSTALL_PATH=$HOME/install-root | |
echo "LUAROCKS_VER=$LUAROCKS_VER" >> $GITHUB_ENV | |
echo "OPENRESTY_VER=$OPENRESTY_VER" >> $GITHUB_ENV | |
export LUAROCKS_PREFIX=$INSTALL_PATH/luarocks-$LUAROCKS_VER | |
echo "LUAROCKS_PREFIX=$LUAROCKS_PREFIX" >> $GITHUB_ENV | |
export OPENRESTY_PREFIX=$INSTALL_PATH/openresty-$OPENRESTY_VER | |
echo "OPENRESTY_PREFIX=$OPENRESTY_PREFIX" >> $GITHUB_ENV | |
echo "PATH=$DOWNLOAD_PATH:$LUAROCKS_PREFIX/bin:$OPENRESTY_PREFIX/nginx/sbin:$DOWNLOAD_PATH/cpanm:$PATH" >> $GITHUB_ENV | |
- name: Lookup build cache | |
uses: actions/cache@v2 | |
id: cache-deps | |
with: | |
path: | | |
${{ env.INSTALL_PATH }} | |
~/perl5 | |
key: ${{ runner.os }}-${{ matrix.openresty-version }}-${{ hashFiles('.github/workflows/latest_os.yml') }} | |
- name: Lint code | |
run: | | |
eval `luarocks path` | |
luacheck lib | |
install-and-test: | |
name: Test lua-resty-healthcheck | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
matrix: | |
openresty-version: [1.21.4.1] | |
luarocks-version: [3.8.0] | |
steps: | |
- name: Checkout lua-resty-healthcheck | |
uses: actions/checkout@v2 | |
- name: Set environment variables | |
env: | |
LUAROCKS_VER: ${{ matrix.luarocks-version }} | |
OPENRESTY_VER: ${{ matrix.openresty-version }} | |
run: | | |
echo "DOWNLOAD_PATH=$HOME/download-root" >> $GITHUB_ENV | |
export DOWNLOAD_PATH=$HOME/download-root | |
echo "INSTALL_PATH=$HOME/install-root" >> $GITHUB_ENV | |
export INSTALL_PATH=$HOME/install-root | |
echo "LUAROCKS_VER=$LUAROCKS_VER" >> $GITHUB_ENV | |
echo "OPENRESTY_VER=$OPENRESTY_VER" >> $GITHUB_ENV | |
export LUAROCKS_PREFIX=$INSTALL_PATH/luarocks-$LUAROCKS_VER | |
echo "LUAROCKS_PREFIX=$LUAROCKS_PREFIX" >> $GITHUB_ENV | |
export OPENRESTY_PREFIX=$INSTALL_PATH/openresty-$OPENRESTY_VER | |
echo "OPENRESTY_PREFIX=$OPENRESTY_PREFIX" >> $GITHUB_ENV | |
echo "PATH=$DOWNLOAD_PATH:$LUAROCKS_PREFIX/bin:$OPENRESTY_PREFIX/nginx/sbin:$DOWNLOAD_PATH/cpanm:$PATH" >> $GITHUB_ENV | |
- name: Lookup build cache | |
uses: actions/cache@v2 | |
id: cache-deps | |
with: | |
path: | | |
${{ env.INSTALL_PATH }} | |
~/perl5 | |
key: ${{ runner.os }}-${{ matrix.openresty-version }}-${{ hashFiles('.github/workflows/latest_os.yml') }} | |
- name: Install lua-resty-healthcheck | |
run: luarocks make | |
- name: Run tests | |
run: | | |
eval `luarocks path` | |
eval $(perl -I $HOME/perl5/lib/perl5/ -Mlocal::lib) | |
TEST_NGINX_RANDOMIZE=1 prove -I. -r t |