diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a7bb1f8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +--- +name: Build +on: [pull_request] + +jobs: + build: + strategy: + fail-fast: false + matrix: + compiler: [gcc, clang] + dynamic: [0, 1] + nginx: + # Mainline + - 1.21.3 + # Stable. + - 1.20.1 + # First version with loadable module support. + - 1.9.15 + # Oldest supported version. + - 0.8.55 + exclude: + - nginx: 0.8.55 + dynamic: 1 + runs-on: ubuntu-18.04 + env: + CFLAGS: "-Wno-error" + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install Packages + run: | + sudo apt update + sudo apt install -y libpcre3-dev libssl-dev + t/get-pup || echo 'Tests needing pup will be skipped' + - name: Test + env: + CC: ${{ matrix.compiler }} + run: | + CC=${{ matrix.compiler }} + t/build-and-run ${{ matrix.nginx }} ${{ matrix.dynamic }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7953076..0000000 --- a/.travis.yml +++ /dev/null @@ -1,38 +0,0 @@ -language: c - -compiler: - - clang - - gcc - -env: - # Mainline. - - NGINX=1.19.7 - - NGINX=1.19.7 DYNAMIC=1 - # Stable. - - NGINX=1.18.0 - - NGINX=1.18.0 DYNAMIC=1 - # Other configurations. - - NGINX=1.12.2 - - NGINX=1.12.2 DYNAMIC=1 - - NGINX=1.10.3 - # Version 1.9.15 was the first with loadable module support. - - NGINX=1.9.15 - - NGINX=1.9.15 DYNAMIC=1 - - NGINX=1.8.1 - # Also, the oldest supported version - - NGINX=0.8.55 - -sudo: false - -addons: - apt: - packages: - - libpcre3-dev - - libssl-dev - -cache: ccache - -script: - - echo "NGINX=${NGINX} ${DYNAMIC:+DYNAMIC=${DYNAMIC}}" - - t/get-pup || echo 'Tests needing pup will be skipped' - - t/build-and-run ${NGINX} ${DYNAMIC} diff --git a/t/preamble b/t/preamble index d3e4e30..26f2819 100644 --- a/t/preamble +++ b/t/preamble @@ -20,7 +20,7 @@ function nginx_conf_generate () { keepalive_timeout 65; server { server_name localhost; - listen 127.0.0.1:8888; + listen 127.0.0.1:${NGINX_PORT}; root ${TESTDIR}; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } @@ -36,6 +36,11 @@ function nginx_conf_generate () { readonly NGINX_CONF="${PREFIX}/conf/nginx.conf" readonly NGINX_PID="${PREFIX}/logs/nginx.pid" + +NGINX_PORT=$(ss -4Htnl | awk '{ sub("[^:]+:", "", $4) ; seen[$4]=1 } +END { p=1025 ; while (seen[p]) p++; print p}') +readonly NGINX_PORT + rm -f "${NGINX_CONF}" "${NGINX_PID}" mkdir -p "${PREFIX}/logs" @@ -85,7 +90,7 @@ function fetch () { opts+=( -S ) shift fi - wget "${opts[@]}" -O- "http://localhost:8888${1:-/}" 2>&1 + wget "${opts[@]}" -O- "http://localhost:${NGINX_PORT}${1:-/}" 2>&1 } function skip () {