|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + nginx-version: [1.29.4] |
| 16 | + openssl-version: [3.5.4] |
| 17 | + |
| 18 | + env: |
| 19 | + JOBS: 3 |
| 20 | + LUAJIT_PREFIX: /opt/luajit21 |
| 21 | + OPENSSL_PREFIX: /usr/local/openresty/openssl3 |
| 22 | + TEST_NGINX_SLEEP: 0.006 |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout code |
| 26 | + uses: actions/checkout@v3 |
| 27 | + |
| 28 | + - name: Install dependencies |
| 29 | + run: | |
| 30 | + sudo apt-get update |
| 31 | + sudo apt-get install -y axel wget build-essential cpanminus libtest-base-perl libtext-diff-perl liburi-perl libwww-perl libtest-longstring-perl liblist-moreutils-perl |
| 32 | + wget -O - https://openresty.org/package/pubkey.gpg | sudo apt-key add - |
| 33 | + echo "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/openresty.list |
| 34 | + sudo apt-get update |
| 35 | + sudo apt-get install -y openresty-pcre2 openresty-openssl3 openresty-pcre2-dev openresty-openssl3-dev |
| 36 | +
|
| 37 | + - name: Install Perl modules |
| 38 | + run: | |
| 39 | + cpanm --notest Test::Nginx |
| 40 | +
|
| 41 | + - name: Clone dependencies |
| 42 | + run: | |
| 43 | + git clone https://github.com/openresty/openresty.git ../openresty |
| 44 | + git clone https://github.com/openresty/nginx-devel-utils.git |
| 45 | + git clone https://github.com/simpl/ngx_devel_kit.git ../ndk-nginx-module |
| 46 | + git clone https://github.com/openresty/lua-nginx-module.git ../lua-nginx-module |
| 47 | + git clone https://github.com/openresty/lua-resty-core.git ../lua-resty-core |
| 48 | + git clone https://github.com/openresty/lua-resty-lrucache.git ../lua-resty-lrucache |
| 49 | + git clone https://github.com/openresty/no-pool-nginx.git ../no-pool-nginx |
| 50 | + git clone -b v2.1-agentzh https://github.com/openresty/luajit2.git |
| 51 | + git clone https://github.com/openresty/mockeagain.git |
| 52 | + git clone https://github.com/openresty/test-nginx.git |
| 53 | +
|
| 54 | + - name: Build and install LuaJIT |
| 55 | + run: | |
| 56 | + cd luajit2/ |
| 57 | + make -j$JOBS CCDEBUG=-g Q= PREFIX=$LUAJIT_PREFIX CC=gcc XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT' |
| 58 | + sudo make install PREFIX=$LUAJIT_PREFIX |
| 59 | + cd .. |
| 60 | +
|
| 61 | + - name: Build and install mockeagain |
| 62 | + run: | |
| 63 | + cd mockeagain/ && make CC=gcc -j$JOBS && cd .. |
| 64 | +
|
| 65 | + - name: Build and configure nginx |
| 66 | + run: | |
| 67 | + export PATH=$PWD/work/nginx/sbin:$PWD/nginx-devel-utils:$PATH |
| 68 | + export LD_PRELOAD=$PWD/mockeagain/mockeagain.so |
| 69 | + export LD_LIBRARY_PATH=$PWD/mockeagain:$LUAJIT_PREFIX/lib:$LD_LIBRARY_PATH |
| 70 | + export TEST_NGINX_RESOLVER=8.8.4.4 |
| 71 | + export NGX_BUILD_CC=gcc |
| 72 | + export NGX_BUILD_JOBS=$JOBS |
| 73 | + export LUAJIT_LIB=$LUAJIT_PREFIX/lib |
| 74 | + export LUAJIT_INC=$LUAJIT_PREFIX/include/luajit-2.1 |
| 75 | + export LUA_INCLUDE_DIR=$LUAJIT_INC |
| 76 | + export LUA_CMODULE_DIR=/lib |
| 77 | + wget http://nginx.org/download/nginx-${{ matrix.nginx-version }}.tar.gz |
| 78 | + 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 |
| 79 | + nginx -V |
| 80 | + ldd `which nginx`|grep -E 'luajit|ssl|pcre' |
| 81 | +
|
| 82 | + - name: Run tests |
| 83 | + run: | |
| 84 | + export PATH=$PWD/work/nginx/sbin:$PWD/nginx-devel-utils:$PATH |
| 85 | + export LD_PRELOAD=$PWD/mockeagain/mockeagain.so |
| 86 | + export LD_LIBRARY_PATH=$PWD/mockeagain:$LUAJIT_PREFIX/lib:$LD_LIBRARY_PATH |
| 87 | + export TEST_NGINX_RESOLVER=8.8.4.4 |
| 88 | + prove -Itest-nginx/inc -Itest-nginx/lib -r t |
0 commit comments