|
| 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.2] |
| 16 | + openssl-version: [3.5.4] |
| 17 | + |
| 18 | + env: |
| 19 | + JOBS: 3 |
| 20 | + NGX_BUILD_JOBS: ${{ env.JOBS }} |
| 21 | + LUAJIT_PREFIX: /opt/luajit21 |
| 22 | + LUAJIT_LIB: ${{ env.LUAJIT_PREFIX }}/lib |
| 23 | + LUAJIT_INC: ${{ env.LUAJIT_PREFIX }}/include/luajit-2.1 |
| 24 | + LUA_INCLUDE_DIR: ${{ env.LUAJIT_INC }} |
| 25 | + LUA_CMODULE_DIR: /lib |
| 26 | + OPENSSL_PREFIX: /usr/local/openresty/openssl3 |
| 27 | + OPENSSL_LIB: ${{ env.OPENSSL_PREFIX }}/lib |
| 28 | + OPENSSL_INC: ${{ env.OPENSSL_PREFIX }}/include |
| 29 | + LD_LIBRARY_PATH: ${{ env.LUAJIT_LIB }}:${{ env.LD_LIBRARY_PATH }} |
| 30 | + TEST_NGINX_SLEEP: 0.006 |
| 31 | + NGINX_VERSION: ${{ matrix.nginx-version }} |
| 32 | + OPENSSL_VER: ${{ matrix.openssl-version }} |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout code |
| 36 | + uses: actions/checkout@v3 |
| 37 | + |
| 38 | + - name: Install dependencies |
| 39 | + run: | |
| 40 | + sudo apt-get update |
| 41 | + sudo apt-get install -y axel wget build-essential |
| 42 | + wget -O - https://openresty.org/package/pubkey.gpg | sudo apt-key add - |
| 43 | + echo "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/openresty.list |
| 44 | + sudo apt-get update |
| 45 | + sudo apt-get install -y openresty-pcre2 openresty-openssl3 openresty-pcre2-dev openresty-openssl3-dev |
| 46 | +
|
| 47 | + - name: Install Perl modules |
| 48 | + run: | |
| 49 | + cpanm --notest Test::Nginx || true |
| 50 | + # If cpanm fails, install cpanminus first |
| 51 | + if [ $? -ne 0 ]; then |
| 52 | + sudo apt-get install -y cpanminus |
| 53 | + cpanm --notest Test::Nginx |
| 54 | + fi |
| 55 | +
|
| 56 | + - name: Clone dependencies |
| 57 | + run: | |
| 58 | + git clone https://github.com/openresty/openresty.git ../openresty |
| 59 | + git clone https://github.com/openresty/nginx-devel-utils.git |
| 60 | + git clone https://github.com/simpl/ngx_devel_kit.git ../ndk-nginx-module |
| 61 | + git clone https://github.com/openresty/lua-nginx-module.git ../lua-nginx-module |
| 62 | + git clone https://github.com/openresty/lua-resty-core.git ../lua-resty-core |
| 63 | + git clone https://github.com/openresty/lua-resty-lrucache.git ../lua-resty-lrucache |
| 64 | + git clone https://github.com/openresty/no-pool-nginx.git ../no-pool-nginx |
| 65 | + git clone -b v2.1-agentzh https://github.com/openresty/luajit2.git |
| 66 | + git clone https://github.com/openresty/mockeagain.git |
| 67 | +
|
| 68 | + - name: Build and install LuaJIT |
| 69 | + run: | |
| 70 | + cd luajit2/ |
| 71 | + make -j$JOBS CCDEBUG=-g Q= PREFIX=$LUAJIT_PREFIX CC=gcc XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT' |
| 72 | + sudo make install PREFIX=$LUAJIT_PREFIX |
| 73 | + cd .. |
| 74 | +
|
| 75 | + - name: Build and install mockeagain |
| 76 | + run: | |
| 77 | + cd mockeagain/ && make CC=gcc -j$JOBS && cd .. |
| 78 | +
|
| 79 | + - name: Build and configure nginx |
| 80 | + run: | |
| 81 | + export PATH=$PWD/work/nginx/sbin:$PWD/nginx-devel-utils:$PATH |
| 82 | + export LD_PRELOAD=$PWD/mockeagain/mockeagain.so |
| 83 | + export LD_LIBRARY_PATH=$PWD/mockeagain:$LD_LIBRARY_PATH |
| 84 | + export TEST_NGINX_RESOLVER=8.8.4.4 |
| 85 | + export NGX_BUILD_CC=gcc |
| 86 | + wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz |
| 87 | + ngx-build $NGINX_VERSION --with-ipv6 --with-http_realip_module --with-http_ssl_module --with-cc-opt="-I$OPENSSL_INC" --with-ld-opt="-L$OPENSSL_LIB -Wl,-rpath,$OPENSSL_LIB" --add-module=../ndk-nginx-module --add-module=../lua-nginx-module --with-debug |
| 88 | + nginx -V |
| 89 | + ldd `which nginx`|grep -E 'luajit|ssl|pcre' |
| 90 | +
|
| 91 | + - name: Run tests |
| 92 | + run: | |
| 93 | + export PATH=$PWD/work/nginx/sbin:$PWD/nginx-devel-utils:$PATH |
| 94 | + export LD_PRELOAD=$PWD/mockeagain/mockeagain.so |
| 95 | + export LD_LIBRARY_PATH=$PWD/mockeagain:$LD_LIBRARY_PATH |
| 96 | + export TEST_NGINX_RESOLVER=8.8.4.4 |
| 97 | + prove -r t |
0 commit comments