From 6b9bed64b5a2a3e6e52646cd531ca321680c59b3 Mon Sep 17 00:00:00 2001 From: lijunlong Date: Tue, 23 Dec 2025 21:47:34 +0800 Subject: [PATCH 1/7] tests: use github action instead of travis. --- .github/workflows/ci.yml | 97 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 71 ----------------------------- 2 files changed, 97 insertions(+), 71 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cf6d290 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,97 @@ +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 + NGX_BUILD_JOBS: ${{ env.JOBS }} + LUAJIT_PREFIX: /opt/luajit21 + LUAJIT_LIB: ${{ env.LUAJIT_PREFIX }}/lib + LUAJIT_INC: ${{ env.LUAJIT_PREFIX }}/include/luajit-2.1 + LUA_INCLUDE_DIR: ${{ env.LUAJIT_INC }} + LUA_CMODULE_DIR: /lib + OPENSSL_PREFIX: /usr/local/openresty/openssl3 + OPENSSL_LIB: ${{ env.OPENSSL_PREFIX }}/lib + OPENSSL_INC: ${{ env.OPENSSL_PREFIX }}/include + LD_LIBRARY_PATH: ${{ env.LUAJIT_LIB }}:${{ env.LD_LIBRARY_PATH }} + TEST_NGINX_SLEEP: 0.006 + NGINX_VERSION: ${{ matrix.nginx-version }} + OPENSSL_VER: ${{ matrix.openssl-version }} + + 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 + 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 || true + # If cpanm fails, install cpanminus first + if [ $? -ne 0 ]; then + sudo apt-get install -y cpanminus + cpanm --notest Test::Nginx + fi + + - 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:$LD_LIBRARY_PATH + export TEST_NGINX_RESOLVER=8.8.4.4 + export NGX_BUILD_CC=gcc + wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz + 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 + 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:$LD_LIBRARY_PATH + export TEST_NGINX_RESOLVER=8.8.4.4 + prove -r t diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d25a5b1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,71 +0,0 @@ -sudo: required -dist: focal - -branches: - only: - - "master" - -os: linux - -language: c - -compiler: - - gcc - -cache: - directories: - - download-cache - -env: - global: - - JOBS=3 - - NGX_BUILD_JOBS=$JOBS - - LUAJIT_PREFIX=/opt/luajit21 - - LUAJIT_LIB=$LUAJIT_PREFIX/lib - - LUAJIT_INC=$LUAJIT_PREFIX/include/luajit-2.1 - - LUA_INCLUDE_DIR=$LUAJIT_INC - - LUA_CMODULE_DIR=/lib - - OPENSSL_PREFIX=/opt/ssl - - OPENSSL_LIB=$OPENSSL_PREFIX/lib - - OPENSSL_INC=$OPENSSL_PREFIX/include - - LD_LIBRARY_PATH=$LUAJIT_LIB:$LD_LIBRARY_PATH - - TEST_NGINX_SLEEP=0.006 - matrix: - - NGINX_VERSION=1.29.2 OPENSSL_VER=1.1.1w - -install: - - if [ ! -d download-cache ]; then mkdir download-cache; fi - - if [ ! -f download-cache/openssl-$OPENSSL_VER.tar.gz ]; then wget -O download-cache/openssl-$OPENSSL_VER.tar.gz https://www.openssl.org/source/openssl-$OPENSSL_VER.tar.gz; fi - - sudo apt-get install -qq -y axel - - cpanm --sudo --notest Test::Nginx > build.log 2>&1 || (cat build.log && exit 1) - - wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz - - 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 - -script: - - cd luajit2/ - - make -j$JOBS CCDEBUG=-g Q= PREFIX=$LUAJIT_PREFIX CC=$CC XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT' > build.log 2>&1 || (cat build.log && exit 1) - - sudo make install PREFIX=$LUAJIT_PREFIX > build.log 2>&1 || (cat build.log && exit 1) - - cd .. - - tar zxf download-cache/openssl-$OPENSSL_VER.tar.gz - - cd openssl-$OPENSSL_VER/ - - ./config shared --prefix=$OPENSSL_PREFIX -DPURIFY > build.log 2>&1 || (cat build.log && exit 1) - - make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1) - - sudo make PATH=$PATH install_sw > build.log 2>&1 || (cat build.log && exit 1) - - cd ../mockeagain/ && make CC=$CC -j$JOBS && cd .. - - export PATH=$PWD/work/nginx/sbin:$PWD/nginx-devel-utils:$PATH - - export LD_PRELOAD=$PWD/mockeagain/mockeagain.so - - export LD_LIBRARY_PATH=$PWD/mockeagain:$LD_LIBRARY_PATH - - export TEST_NGINX_RESOLVER=8.8.4.4 - - export NGX_BUILD_CC=$CC - - 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 > build.log 2>&1 || (cat build.log && exit 1) - - nginx -V - - ldd `which nginx`|grep -E 'luajit|ssl|pcre' - - prove -r t From 9c55dde65d08542b53cb60134af7c9d5e43e32ef Mon Sep 17 00:00:00 2001 From: lijunlong Date: Tue, 23 Dec 2025 22:00:17 +0800 Subject: [PATCH 2/7] more fixes --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf6d290..8116e3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,13 +68,13 @@ jobs: - 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 + make -j${{ env.JOBS }} CCDEBUG=-g Q= PREFIX=${{ env.LUAJIT_PREFIX }} CC=gcc XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT' + sudo make install PREFIX=${{ env.LUAJIT_PREFIX }} cd .. - name: Build and install mockeagain run: | - cd mockeagain/ && make CC=gcc -j$JOBS && cd .. + cd mockeagain/ && make CC=gcc -j${{ env.JOBS }} && cd .. - name: Build and configure nginx run: | @@ -83,8 +83,8 @@ jobs: export LD_LIBRARY_PATH=$PWD/mockeagain:$LD_LIBRARY_PATH export TEST_NGINX_RESOLVER=8.8.4.4 export NGX_BUILD_CC=gcc - wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz - 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 + wget http://nginx.org/download/nginx-${{ env.NGINX_VERSION }}.tar.gz + ngx-build ${{ env.NGINX_VERSION }} --with-ipv6 --with-http_realip_module --with-http_ssl_module --with-cc-opt="-I${{ env.OPENSSL_INC }}" --with-ld-opt="-L${{ env.OPENSSL_LIB }} -Wl,-rpath,${{ env.OPENSSL_LIB }}" --add-module=../ndk-nginx-module --add-module=../lua-nginx-module --with-debug nginx -V ldd `which nginx`|grep -E 'luajit|ssl|pcre' @@ -94,4 +94,4 @@ jobs: export LD_PRELOAD=$PWD/mockeagain/mockeagain.so export LD_LIBRARY_PATH=$PWD/mockeagain:$LD_LIBRARY_PATH export TEST_NGINX_RESOLVER=8.8.4.4 - prove -r t + prove -r t \ No newline at end of file From e48925ca84c9a34a9b3668bf0883498e49b039d2 Mon Sep 17 00:00:00 2001 From: lijunlong Date: Tue, 23 Dec 2025 22:05:49 +0800 Subject: [PATCH 3/7] more fixes --- .github/workflows/ci.yml | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8116e3c..cf3be4d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,19 +17,9 @@ jobs: env: JOBS: 3 - NGX_BUILD_JOBS: ${{ env.JOBS }} LUAJIT_PREFIX: /opt/luajit21 - LUAJIT_LIB: ${{ env.LUAJIT_PREFIX }}/lib - LUAJIT_INC: ${{ env.LUAJIT_PREFIX }}/include/luajit-2.1 - LUA_INCLUDE_DIR: ${{ env.LUAJIT_INC }} - LUA_CMODULE_DIR: /lib OPENSSL_PREFIX: /usr/local/openresty/openssl3 - OPENSSL_LIB: ${{ env.OPENSSL_PREFIX }}/lib - OPENSSL_INC: ${{ env.OPENSSL_PREFIX }}/include - LD_LIBRARY_PATH: ${{ env.LUAJIT_LIB }}:${{ env.LD_LIBRARY_PATH }} TEST_NGINX_SLEEP: 0.006 - NGINX_VERSION: ${{ matrix.nginx-version }} - OPENSSL_VER: ${{ matrix.openssl-version }} steps: - name: Checkout code @@ -38,7 +28,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y axel wget build-essential + 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 @@ -46,12 +36,7 @@ jobs: - name: Install Perl modules run: | - cpanm --notest Test::Nginx || true - # If cpanm fails, install cpanminus first - if [ $? -ne 0 ]; then - sudo apt-get install -y cpanminus - cpanm --notest Test::Nginx - fi + cpanm --notest Test::Nginx - name: Clone dependencies run: | @@ -68,23 +53,24 @@ jobs: - name: Build and install LuaJIT run: | cd luajit2/ - make -j${{ env.JOBS }} CCDEBUG=-g Q= PREFIX=${{ env.LUAJIT_PREFIX }} CC=gcc XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT' - sudo make install PREFIX=${{ env.LUAJIT_PREFIX }} + 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${{ env.JOBS }} && cd .. + 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:$LD_LIBRARY_PATH + 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 - wget http://nginx.org/download/nginx-${{ env.NGINX_VERSION }}.tar.gz - ngx-build ${{ env.NGINX_VERSION }} --with-ipv6 --with-http_realip_module --with-http_ssl_module --with-cc-opt="-I${{ env.OPENSSL_INC }}" --with-ld-opt="-L${{ env.OPENSSL_LIB }} -Wl,-rpath,${{ env.OPENSSL_LIB }}" --add-module=../ndk-nginx-module --add-module=../lua-nginx-module --with-debug + export NGX_BUILD_JOBS=$JOBS + 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' @@ -92,6 +78,8 @@ jobs: 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:$LD_LIBRARY_PATH + export LD_LIBRARY_PATH=$PWD/mockeagain:$LUAJIT_PREFIX/lib:$LD_LIBRARY_PATH export TEST_NGINX_RESOLVER=8.8.4.4 - prove -r t \ No newline at end of file + export LUA_INCLUDE_DIR=$LUAJIT_PREFIX/include/luajit-2.1 + export LUA_CMODULE_DIR=/lib + prove -r t From 4966e29475d2eaeb75f4546c152c5f6340a4736f Mon Sep 17 00:00:00 2001 From: lijunlong Date: Tue, 23 Dec 2025 22:12:54 +0800 Subject: [PATCH 4/7] more fixes --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf3be4d..58c784b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,6 +69,10 @@ jobs: 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 @@ -80,6 +84,4 @@ jobs: 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 LUA_INCLUDE_DIR=$LUAJIT_PREFIX/include/luajit-2.1 - export LUA_CMODULE_DIR=/lib prove -r t From fd450123d4fe3cb0395969aede1d77f9388bde50 Mon Sep 17 00:00:00 2001 From: lijunlong Date: Tue, 23 Dec 2025 23:13:58 +0800 Subject: [PATCH 5/7] more fixes --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58c784b..7866d9b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,7 @@ jobs: 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 + git clone https://github.com/openresty/test-nginx.git - name: Build and install LuaJIT run: | @@ -84,4 +85,4 @@ jobs: 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 + prove -Itest-nginx/inc -Itest-nginx/lib -r t From fcd1dc55a57dc57ca348bc2e2865c73f78014df5 Mon Sep 17 00:00:00 2001 From: lijunlong Date: Tue, 23 Dec 2025 23:18:20 +0800 Subject: [PATCH 6/7] more fixes --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7866d9b..976e94d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y axel wget build-essential cpanminus + 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 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 From 67e0057293d9ed3425839b4ef6cfd1260c6d3dc7 Mon Sep 17 00:00:00 2001 From: lijunlong Date: Tue, 23 Dec 2025 23:21:35 +0800 Subject: [PATCH 7/7] more fixes --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 976e94d..72c8020 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - nginx-version: [1.29.2] + nginx-version: [1.29.4] openssl-version: [3.5.4] env: