Skip to content

Try to use ngx.null #74

Try to use ngx.null

Try to use ngx.null #74

Workflow file for this run

name: Tests
on:
push:
paths-ignore:
# ignore top-level markdown files (CHANGELOG.md, README.md, etc.)
- '*.md'
branches:
- master
- release/*
- test-please/*
- use-atomic-set
pull_request:
paths-ignore:
# ignore top-level markdown files (CHANGELOG.md, README.md, etc.)
- '*.md'
schedule:
- cron: '0 7 * * *'
# cancel previous runs if new commits are pushed to the PR, but run for each commit on master
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
tests:
name: Tests
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- nginx: "1.25.3"
openssl: "3.2.1"
lua_nginx_module: "v0.10.26"
stream_lua_nginx_module: "v0.0.14"
lua_resty_core: "v0.1.28"
- nginx: "1.21.4"
openssl: "3.0.12"
lua_nginx_module: "v0.10.26"
stream_lua_nginx_module: "v0.0.14"
lua_resty_core: "v0.1.28"
- nginx: "1.25.3"
openssl: "3.1.4"
lua_nginx_module: "v0.10.26"
stream_lua_nginx_module: "v0.0.14"
lua_resty_core: "v0.1.28"
- nginx: "1.21.4"
openssl: "1.1.1w"
lua_nginx_module: "v0.10.21"
stream_lua_nginx_module: "v0.0.11"
lua_resty_core: "v0.1.23"
env:
JOBS: 3
SH: bash
NGX_BUILD_JOBS: 3
BASE_PATH: /home/runner/work/cache
LUAJIT_PREFIX: /home/runner/work/cache/luajit21
LUAJIT_LIB: /home/runner/work/cache/luajit21/lib
LUAJIT_INC: /home/runner/work/cache/luajit21/include/luajit-2.1
LUA_INCLUDE_DIR: /home/runner/work/cache/luajit21/include/luajit-2.1
OPENSSL_PREFIX: /home/runner/work/cache/ssl
OPENSSL_LIB: /home/runner/work/cache/ssl/lib
OPENSSL_INC: /home/runner/work/cache/ssl/include
TEST_NGINX_SLEEP: 0.005
TEST_NGINX_RANDOMIZE: 1
LUACHECK_VER: 0.21.1
CC: gcc
NGX_BUILD_CC: gcc
NGINX_CC_OPTS: ""
LUAJIT_CC_OPTS: ""
services:
# Redis with auth disabled
redis:
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
# Redis with auth enabled
redis-auth:
image: redis/redis-stack-server
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6380:6379
env:
REDIS_ARGS: "--requirepass passdefault"
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Setup cache
uses: actions/cache@v2
with:
path: |
/home/runner/work/cache
key: ${{ runner.os }}-${{ hashFiles('**/tests.yml') }}-nginx-${{ matrix.nginx }}-openssl-${{ matrix.openssl }}
- name: Prepare environment
run: |
bash t/fixtures/prepare_env.sh
- name: Setup tools
run: |
sudo apt-get install -qq -y cpanminus axel ca-certificates
mkdir -p $OPENSSL_PREFIX $LUAJIT_PREFIX
# perl cache
pushd /home/runner/work/cache
if [ ! -e perl ]; then sudo cpanm --notest Test::Nginx > build.log 2>&1 || (cat build.log && exit 1); cp -r /usr/local/share/perl/ .; else sudo cp -r perl /usr/local/share; fi
# build tools at parent directory of cache
cd ..
git clone https://github.com/openresty/openresty.git ./openresty
git clone https://github.com/openresty/nginx-devel-utils.git
git clone https://github.com/simpl/ngx_devel_kit.git ./ndk-nginx-module
git clone https://github.com/openresty/lua-nginx-module.git ./lua-nginx-module -b ${{ matrix.lua_nginx_module }}
git clone https://github.com/openresty/stream-lua-nginx-module.git ./stream-lua-nginx-module -b ${{ matrix.stream_lua_nginx_module }}
git clone https://github.com/openresty/no-pool-nginx.git ./no-pool-nginx
# lua libraries at parent directory of current repository
popd
mkdir ../lib
git clone https://github.com/openresty/lua-resty-core.git ../lua-resty-core -b ${{ matrix.lua_resty_core }}
git clone https://github.com/openresty/lua-resty-lrucache.git ../lua-resty-lrucache
git clone https://github.com/openresty/lua-resty-redis.git ../lua-resty-redis
git clone -b v0.15 https://github.com/ledgetech/lua-resty-http ../lua-resty-http
git clone https://github.com/fffonion/lua-resty-openssl ../lua-resty-openssl
git clone -b 0.3.0 https://github.com/spacewander/luafilesystem ../luafilesystem-ffi
git clone https://github.com/jkeys089/lua-resty-hmac ../lua-resty-hmac && pushd ../lua-resty-hmac && git checkout 79a4929 && popd
git clone https://github.com/iresty/lua-typeof ../lua-typeof
git clone https://github.com/api7/lua-resty-etcd ../lua-resty-etcd -b v1.4.4
cp -r ../lua-resty-lrucache/lib/* ../lua-resty-redis/lib/* ../lua-resty-http/lib/* ../lua-resty-openssl/lib/* ../lua-typeof/lib/* ../lua-resty-etcd/lib/* ../lib/
cp ../luafilesystem-ffi/lfs_ffi.lua ../lib/
find ../lib
- name: Build OpenSSL
run: |
if [ "X$OPENSSL_HASH" != "X" ]; then wget https://github.com/openssl/openssl/archive/$OPENSSL_HASH.tar.gz -O - | tar zxf ; pushd openssl-$OPENSSL_HASH/; fi
if [ "X$OPENSSL_HASH" = "X" ] ; then (wget https://github.com/openssl/openssl/releases/download/openssl-${{ matrix.openssl }}/openssl-${{ matrix.openssl }}.tar.gz -qO - || wget https://openssl.org/source/old/1.1.1/openssl-${{ matrix.openssl}}.tar.gz -qO -)| tar zxf -; pushd openssl-${{ matrix.openssl }}/; fi
if [ ! -e $OPENSSL_PREFIX/include ]; then ./config shared -d --prefix=$OPENSSL_PREFIX -DPURIFY > build.log 2>&1 || (cat build.log && exit 1); fi
if [ ! -e $OPENSSL_PREFIX/include ]; then make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1); fi
if [ ! -e $OPENSSL_PREFIX/include ]; then sudo make PATH=$PATH install_sw > build.log 2>&1 || (cat build.log && exit 1); fi
mkdir -p $OPENSSL_PREFIX/certs/ && sudo cp -r /etc/ssl/certs/* $OPENSSL_PREFIX/certs/
- name: Build LuaJIT
run: |
cd $LUAJIT_PREFIX
if [ ! -e luajit2 ]; then git clone -b v2.1-agentzh https://github.com/openresty/luajit2.git; fi
cd luajit2
make -j$JOBS CCDEBUG=-g Q= PREFIX=$LUAJIT_PREFIX CC=$CC XCFLAGS="-DLUA_USE_APICHECK -DLUA_USE_ASSERT -DLUAJIT_ENABLE_LUA52COMPAT $LUAJIT_CC_OPTS" > build.log 2>&1 || (cat build.log && exit 1)
make install PREFIX=$LUAJIT_PREFIX > build.log 2>&1 || (cat build.log && exit 1)
- name: Build lua-cjson
run: |
if [ ! -e lua-cjson ]; then git clone https://github.com/openresty/lua-cjson.git ./lua-cjson; fi
pushd ./lua-cjson && make && sudo PATH=$PATH make install && popd
- name: Build Nginx
run: |
export PATH=$BASE_PATH/work/nginx/sbin:$BASE_PATH/../nginx-devel-utils:$PATH
export LD_LIBRARY_PATH=$LUAJIT_LIB:$LD_LIBRARY_PATH
cd $BASE_PATH
if [ ! -e work ]; then ngx-build ${{ matrix.nginx }} --add-module=../ndk-nginx-module --add-module=../lua-nginx-module --add-module=../stream-lua-nginx-module --with-http_ssl_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt="-I$OPENSSL_INC $NGINX_CC_OPTS" --with-ld-opt="-L$OPENSSL_LIB -Wl,-rpath,$OPENSSL_LIB" --with-debug > build.log 2>&1 || (cat build.log && exit 1); fi
nginx -V
ldd `which nginx`|grep -E 'luajit|ssl|pcre'
- name: Run Tests
run: |
export LD_LIBRARY_PATH=$LUAJIT_LIB:$LD_LIBRARY_PATH
export PATH=$BASE_PATH/work/nginx/sbin:$PATH
TEST_NGINX_TIMEOUT=60 prove -j$JOBS -r t/
- name: Show logs
if: failure()
run: |
pushd t/fixtures
docker compose logs