|
| 1 | +name: NGINX |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + |
| 9 | +env: |
| 10 | + CARGO_TERM_COLOR: 'always' |
| 11 | + RUST_BACKTRACE: '1' |
| 12 | + NGX_CONFIGURE_CMD: >- |
| 13 | + auto/configure |
| 14 | + --with-compat |
| 15 | + --with-debug |
| 16 | + --with-http_realip_module |
| 17 | + --with-http_ssl_module |
| 18 | + --with-http_v2_module |
| 19 | + --with-stream |
| 20 | + --with-stream_realip_module |
| 21 | + --with-stream_ssl_module |
| 22 | +
|
| 23 | + NGX_CONFIGURE_UNIX: >- |
| 24 | + --with-http_v3_module |
| 25 | + --with-threads |
| 26 | +
|
| 27 | + NGX_CONFIGURE_DYNAMIC_MODULES: >- |
| 28 | + --add-dynamic-module=${{ github.workspace }} |
| 29 | + NGX_CONFIGURE_STATIC_MODULES: >- |
| 30 | + --add-module=${{ github.workspace }} |
| 31 | +
|
| 32 | + NGX_TEST_FILES: t |
| 33 | + NGX_TEST_GLOBALS_DYNAMIC: >- |
| 34 | + load_module ${{ github.workspace }}/nginx/objs/ngx_http_acme_module.so; |
| 35 | +
|
| 36 | +jobs: |
| 37 | + linux: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + |
| 40 | + strategy: |
| 41 | + fail-fast: false |
| 42 | + matrix: |
| 43 | + nginx-ref: |
| 44 | + - master |
| 45 | + - stable-1.28 |
| 46 | + module: |
| 47 | + - static |
| 48 | + - dynamic |
| 49 | + |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 52 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 53 | + with: |
| 54 | + ref: ${{ matrix.nginx-ref }} |
| 55 | + repository: 'nginx/nginx' |
| 56 | + path: 'nginx' |
| 57 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 58 | + with: |
| 59 | + repository: 'nginx/nginx-tests' |
| 60 | + path: 'nginx/tests' |
| 61 | + sparse-checkout: | |
| 62 | + lib |
| 63 | +
|
| 64 | + - uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b |
| 65 | + with: |
| 66 | + toolchain: stable |
| 67 | + |
| 68 | + - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 |
| 69 | + with: |
| 70 | + path: | |
| 71 | + ~/.cargo/bin/ |
| 72 | + ~/.cargo/registry/index/ |
| 73 | + ~/.cargo/registry/cache/ |
| 74 | + ~/.cargo/git/db/ |
| 75 | + nginx/objs/**/CACHEDIR.TAG |
| 76 | + nginx/objs/**/ngx-debug |
| 77 | + nginx/objs/**/ngx-release |
| 78 | + key: ${{ runner.os }}-nginx-${{ hashFiles('**/Cargo.lock') }} |
| 79 | + restore-keys: ${{ runner.os }}-nginx- |
| 80 | + |
| 81 | + - name: Configure nginx with static modules |
| 82 | + if: matrix.module == 'static' |
| 83 | + working-directory: nginx |
| 84 | + run: | |
| 85 | + ${NGX_CONFIGURE_CMD} \ |
| 86 | + ${NGX_CONFIGURE_UNIX} \ |
| 87 | + ${NGX_CONFIGURE_STATIC_MODULES} |
| 88 | +
|
| 89 | + - name: Configure nginx with dynamic modules |
| 90 | + if: matrix.module != 'static' |
| 91 | + working-directory: nginx |
| 92 | + run: | |
| 93 | + ${NGX_CONFIGURE_CMD} \ |
| 94 | + ${NGX_CONFIGURE_UNIX} \ |
| 95 | + ${NGX_CONFIGURE_DYNAMIC_MODULES} |
| 96 | + echo TEST_NGINX_GLOBALS="$NGX_TEST_GLOBALS_DYNAMIC" >> "$GITHUB_ENV" |
| 97 | +
|
| 98 | + - name: Build nginx |
| 99 | + working-directory: nginx |
| 100 | + run: make -j$(nproc) |
| 101 | + |
| 102 | + - name: Run tests |
| 103 | + env: |
| 104 | + PERL5LIB: ${{ github.workspace }}/nginx/tests/lib |
| 105 | + TEST_NGINX_BINARY: ${{ github.workspace }}/nginx/objs/nginx |
| 106 | + TEST_NGINX_MODULES: ${{ github.workspace }}/nginx/objs |
| 107 | + TEST_NGINX_VERBOSE: 1 |
| 108 | + run: | |
| 109 | + prove -j$(nproc) --state=save ${NGX_TEST_FILES} || prove -v --state=failed |
0 commit comments