|
| 1 | +name: NGINX |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + |
| 9 | +env: |
| 10 | + CARGO_TERM_COLOR: 'always' |
| 11 | + RUST_BACKTRACE: '1' |
| 12 | + NGX_CONFIGURE: | |
| 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-http_v3_module |
| 20 | + --with-stream |
| 21 | + --with-stream_realip_module |
| 22 | + --with-stream_ssl_module |
| 23 | + --with-threads |
| 24 | +
|
| 25 | +jobs: |
| 26 | + test: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + |
| 29 | + strategy: |
| 30 | + fail-fast: false |
| 31 | + matrix: |
| 32 | + module: |
| 33 | + # static |
| 34 | + - dynamic |
| 35 | + nginx-ref: |
| 36 | + # master |
| 37 | + - stable-1.26 |
| 38 | + |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + with: |
| 43 | + ref: ${{ matrix.nginx-ref }} |
| 44 | + repository: 'nginx/nginx' |
| 45 | + path: 'nginx' |
| 46 | + - uses: actions/checkout@v4 |
| 47 | + with: |
| 48 | + repository: 'nginx/nginx-tests' |
| 49 | + path: 'nginx/tests' |
| 50 | + sparse-checkout: | |
| 51 | + lib |
| 52 | +
|
| 53 | + - uses: dtolnay/rust-toolchain@stable |
| 54 | + |
| 55 | + - uses: actions/cache@v4 |
| 56 | + with: |
| 57 | + path: | |
| 58 | + ~/.cargo/bin/ |
| 59 | + ~/.cargo/registry/index/ |
| 60 | + ~/.cargo/registry/cache/ |
| 61 | + ~/.cargo/git/db/ |
| 62 | + nginx/objs/ngx_rust_examples |
| 63 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 64 | + restore-keys: ${{ runner.os }}-cargo- |
| 65 | + |
| 66 | + - name: Configure nginx with static modules |
| 67 | + if: matrix.module == 'static' |
| 68 | + working-directory: nginx |
| 69 | + run: | |
| 70 | + ${NGX_CONFIGURE} \ |
| 71 | + --add-module=${{ github.workspace }}/examples |
| 72 | +
|
| 73 | + - name: Configure nginx with dynamic modules |
| 74 | + if: matrix.module != 'static' |
| 75 | + working-directory: nginx |
| 76 | + env: |
| 77 | + TEST_NGINX_GLOBALS: >- |
| 78 | + load_module ${{ github.workspace }}/nginx/objs/ngx_http_awssigv4_module.so; |
| 79 | + load_module ${{ github.workspace }}/nginx/objs/ngx_http_curl_module.so; |
| 80 | + load_module ${{ github.workspace }}/nginx/objs/ngx_http_upstream_custom_module.so; |
| 81 | + run: | |
| 82 | + ${NGX_CONFIGURE} \ |
| 83 | + --add-dynamic-module=${{ github.workspace }}/examples |
| 84 | + echo "TEST_NGINX_GLOBALS=$TEST_NGINX_GLOBALS" >> $GITHUB_ENV |
| 85 | +
|
| 86 | + - name: Build nginx |
| 87 | + working-directory: nginx |
| 88 | + run: make -j$(nproc) |
| 89 | + |
| 90 | + - name: Run tests |
| 91 | + env: |
| 92 | + TEST_NGINX_BINARY: ${{ github.workspace }}/nginx/objs/nginx |
| 93 | + TEST_NGINX_MODULES: ${{ github.workspace }}/nginx/objs |
| 94 | + run: | |
| 95 | + prove -v -j$(nproc) -Inginx/tests/lib --state=save examples/t \ |
| 96 | + || prove -v -Inginx/tests/lib --state=failed |
0 commit comments