diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..72c8020 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,88 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + nginx-version: [1.29.4] + 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 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 + 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 + git clone https://github.com/openresty/test-nginx.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 -Itest-nginx/inc -Itest-nginx/lib -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