Skip to content
Snippets Groups Projects
build.yml 2.42 KiB
Newer Older
name: Build CI

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        include:
          # Mainline
            dynamic_module: true
David Beitey's avatar
David Beitey committed
          - nginx: 1.23.2
            dynamic_module: false
          # Stable
David Beitey's avatar
David Beitey committed
          - nginx: 1.22.1
            dynamic_module: true
          - nginx: 1.22.1
            dynamic_module: false
          # Past stable versions
          - nginx: 1.20.2
            dynamic_module: true
          - nginx: 1.20.2
            dynamic_module: false
          - nginx: 1.18.0
            dynamic_module: true
          - nginx: 1.18.0
            dynamic_module: false
          - nginx: 1.16.1
            dynamic_module: true
          - nginx: 1.16.1
            dynamic_module: false
          - nginx: 1.14.2
            dynamic_module: false

    steps:
      - uses: actions/checkout@v2
      - name: Install prerequisites
        run: |
          sudo apt install -y git wget gcc cmake
          sudo apt install -y libpcre3-dev libssl-dev zlib1g-dev
      - name: Build
        env:
          _NGINX_VERSION: ${{ matrix.nginx }}
          SHIB_DYNAMIC_MODULE: ${{ matrix.dynamic_module }}
        run: |
            wget -O - "https://nginx.org/download/nginx-$_NGINX_VERSION.tar.gz" | tar -xzf -
            cd "nginx-$_NGINX_VERSION"
            git clone https://github.com/openresty/headers-more-nginx-module.git -b v0.34
            if [ "$SHIB_DYNAMIC_MODULE" = true ]; then
              ./configure --with-debug --add-dynamic-module=.. --add-dynamic-module=./headers-more-nginx-module
            else
              ./configure --with-debug --add-module=.. --add-module=./headers-more-nginx-module
            fi
            make
            echo "$(pwd)/objs" >> $GITHUB_PATH
            if [ "$SHIB_DYNAMIC_MODULE" = true ]; then
              echo "SHIB_MODULE_PATH=$(pwd)/objs" >> $GITHUB_ENV
            fi
      - name: Test
        env:
          SHIB_DYNAMIC_MODULE: ${{ matrix.dynamic_module }}
          SHIB_MODULE_PATH: ${{ env.SHIB_MODULE_PATH }}
        run: |
          sudo apt install -y cpanminus
          cpanm --notest --local-lib=$HOME/perl5 Test::Nginx
          PERL5LIB=$HOME/perl5/lib/perl5 TEST_NGINX_VERBOSE=true prove -v
      - name: Output debugging info on failure
        if: ${{ failure() }}
        run: |
          cat t/servroot/conf/nginx.conf
          cat t/servroot/access.log
          cat t/servroot/error.log