diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c80c33e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,79 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + name: 'build' + runs-on: ubuntu-latest + steps: + - name: 'checkout' + uses: actions/checkout@v3 + with: + path: nginx-module-vts + - name: 'checkout nginx' + uses: actions/checkout@v3 + with: + repository: nginx/nginx + path: nginx + - name: 'checkout luajit2' + uses: actions/checkout@v3 + with: + repository: openresty/luajit2 + path: luajit2 + - name: 'checkout ngx_devel_kit' + uses: actions/checkout@v3 + with: + repository: vision5/ngx_devel_kit + path: ngx_devel_kit + - name: 'checkout lua-nginx-module' + uses: actions/checkout@v3 + with: + repository: openresty/lua-nginx-module + path: lua-nginx-module + - name: 'checkout lua-resty-core' + uses: actions/checkout@v3 + with: + repository: openresty/lua-resty-core + path: lua-resty-core + - name: 'checkout lua-resty-lrucache' + uses: actions/checkout@v3 + with: + repository: openresty/lua-resty-lrucache + path: lua-resty-lrucache + - name: 'build luajit2' + working-directory: luajit2 + run: | + make + sudo make install + sudo mkdir /usr/local/share/lua/5.1/resty + - name: 'link resty lib' + working-directory: /usr/local/share/lua/5.1/resty + run: | + sudo ln -s /home/runner/work/nginx-module-vts/nginx-module-vts/lua-resty-core/lib/resty/core core + sudo ln -s /home/runner/work/nginx-module-vts/nginx-module-vts/lua-resty-core/lib/resty/core.lua core.lua + sudo ln -s /home/runner/work/nginx-module-vts/nginx-module-vts/lua-resty-lrucache/lib/resty/lrucache lrucache + sudo ln -s /home/runner/work/nginx-module-vts/nginx-module-vts/lua-resty-lrucache/lib/resty/lrucache.lua lrucache.lua + - name: 'build nginx' + working-directory: nginx + run: | + ./auto/configure --with-ld-opt="-Wl,-rpath,/usr/local/lib" --without-pcre2 --with-cc-opt=-Wno-stringop-overread --add-module=/home/runner/work/nginx-module-vts/nginx-module-vts/ngx_devel_kit --add-module=/home/runner/work/nginx-module-vts/nginx-module-vts/lua-nginx-module --add-module=/home/runner/work/nginx-module-vts/nginx-module-vts/nginx-module-vts + make + sudo make install + /usr/local/nginx/sbin/nginx -V + env: + LUAJIT_LIB: /usr/local/lib + LUAJIT_INC: /usr/local/include/luajit-2.1 + - name: 'prepare cpanm' + run: | + sudo apt install -y cpanminus + sudo cpanm install Test::Nginx::Socket + - name: 'test' + working-directory: nginx-module-vts + run: | + echo "/usr/local/nginx/sbin/" >> $GITHUB_PATH + sudo PATH=/usr/local/nginx/sbin:$PATH prove -r t diff --git a/t/021.set_by_filter.t b/t/021.set_by_filter.t index 07d17ee..9924576 100644 --- a/t/021.set_by_filter.t +++ b/t/021.set_by_filter.t @@ -84,7 +84,7 @@ __DATA__ '2xx:$2xx'; access_log logs/access.log basic; upstream backend { - server localhost:1984; + server 127.0.0.1:1984; } --- config location /status { @@ -101,7 +101,7 @@ __DATA__ vhost_traffic_status_set_by_filter $outBytes $group/$zone/outBytes; vhost_traffic_status_set_by_filter $2xx $group/$zone/2xx; - proxy_pass http://localhost:1984/return; + proxy_pass http://127.0.0.1:1984/return; } --- user_files eval [ @@ -130,7 +130,7 @@ __DATA__ '2xx:$2xx'; access_log logs/access.log basic; upstream backend { - server localhost:1984; + server 127.0.0.1:1984; } --- config location /v { @@ -211,7 +211,7 @@ __DATA__ 'cacheUsedSize:$cacheUsedSize cacheHit:$cacheHit'; access_log logs/access.log basic; upstream backend { - server localhost:1984; + server 127.0.0.1:1984; } --- config location /v {