tests: use github action instead of travis. #4
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| nginx-version: [1.29.2] | |
| openssl-version: [3.5.4] | |
| env: | |
| JOBS: 3 | |
| LUAJIT_PREFIX: /opt/luajit21 | |
| OPENSSL_PREFIX: /usr/local/openresty/openssl3 | |
| TEST_NGINX_SLEEP: 0.006 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y axel wget build-essential cpanminus | |
| wget -O - https://openresty.org/package/pubkey.gpg | sudo apt-key add - | |
| echo "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/openresty.list | |
| sudo apt-get update | |
| sudo apt-get install -y openresty-pcre2 openresty-openssl3 openresty-pcre2-dev openresty-openssl3-dev | |
| - name: Install Perl modules | |
| run: | | |
| cpanm --notest Test::Nginx | |
| - name: Clone dependencies | |
| run: | | |
| 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 | |
| git clone https://github.com/openresty/lua-resty-core.git ../lua-resty-core | |
| git clone https://github.com/openresty/lua-resty-lrucache.git ../lua-resty-lrucache | |
| git clone https://github.com/openresty/no-pool-nginx.git ../no-pool-nginx | |
| git clone -b v2.1-agentzh https://github.com/openresty/luajit2.git | |
| git clone https://github.com/openresty/mockeagain.git | |
| - name: Build and install LuaJIT | |
| run: | | |
| cd luajit2/ | |
| make -j$JOBS CCDEBUG=-g Q= PREFIX=$LUAJIT_PREFIX CC=gcc XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT' | |
| sudo make install PREFIX=$LUAJIT_PREFIX | |
| cd .. | |
| - name: Build and install mockeagain | |
| run: | | |
| cd mockeagain/ && make CC=gcc -j$JOBS && cd .. | |
| - name: Build and configure nginx | |
| run: | | |
| export PATH=$PWD/work/nginx/sbin:$PWD/nginx-devel-utils:$PATH | |
| export LD_PRELOAD=$PWD/mockeagain/mockeagain.so | |
| export LD_LIBRARY_PATH=$PWD/mockeagain:$LUAJIT_PREFIX/lib:$LD_LIBRARY_PATH | |
| export TEST_NGINX_RESOLVER=8.8.4.4 | |
| export NGX_BUILD_CC=gcc | |
| export NGX_BUILD_JOBS=$JOBS | |
| export LUAJIT_LIB=$LUAJIT_PREFIX/lib | |
| export LUAJIT_INC=$LUAJIT_PREFIX/include/luajit-2.1 | |
| export LUA_INCLUDE_DIR=$LUAJIT_INC | |
| export LUA_CMODULE_DIR=/lib | |
| wget http://nginx.org/download/nginx-${{ matrix.nginx-version }}.tar.gz | |
| ngx-build ${{ matrix.nginx-version }} --with-ipv6 --with-http_realip_module --with-http_ssl_module --with-cc-opt="-I$OPENSSL_PREFIX/include" --with-ld-opt="-L$OPENSSL_PREFIX/lib -Wl,-rpath,$OPENSSL_PREFIX/lib" --add-module=../ndk-nginx-module --add-module=../lua-nginx-module --with-debug | |
| nginx -V | |
| ldd `which nginx`|grep -E 'luajit|ssl|pcre' | |
| - name: Run tests | |
| run: | | |
| export PATH=$PWD/work/nginx/sbin:$PWD/nginx-devel-utils:$PATH | |
| export LD_PRELOAD=$PWD/mockeagain/mockeagain.so | |
| export LD_LIBRARY_PATH=$PWD/mockeagain:$LUAJIT_PREFIX/lib:$LD_LIBRARY_PATH | |
| export TEST_NGINX_RESOLVER=8.8.4.4 | |
| prove -r t |