|
9 | 9 | env:
|
10 | 10 | CARGO_TERM_COLOR: 'always'
|
11 | 11 | RUST_BACKTRACE: '1'
|
12 |
| - NGX_CONFIGURE: >- |
| 12 | + NGX_CONFIGURE_CMD: >- |
13 | 13 | auto/configure
|
14 | 14 | --with-compat
|
15 | 15 | --with-debug
|
|
19 | 19 | --with-stream
|
20 | 20 | --with-stream_realip_module
|
21 | 21 | --with-stream_ssl_module
|
| 22 | +
|
| 23 | + NGX_CONFIGURE_UNIX: >- |
22 | 24 | --with-threads
|
23 | 25 |
|
| 26 | + NGX_CONFIGURE_WINDOWS: >- |
| 27 | + --with-cc=cl |
| 28 | + --prefix= |
| 29 | + --conf-path=conf/nginx.conf |
| 30 | + --pid-path=logs/nginx.pid |
| 31 | + --http-log-path=logs/access.log |
| 32 | + --error-log-path=logs/error.log |
| 33 | + --sbin-path=nginx.exe |
| 34 | + --http-client-body-temp-path=temp/client_body_temp |
| 35 | + --http-proxy-temp-path=temp/proxy_temp |
| 36 | + --http-fastcgi-temp-path=temp/fastcgi_temp |
| 37 | + --http-scgi-temp-path=temp/scgi_temp |
| 38 | + --http-uwsgi-temp-path=temp/uwsgi_temp |
| 39 | + --with-cc-opt=-DFD_SETSIZE=1024 |
| 40 | + --with-pcre=objs/lib/pcre |
| 41 | + --with-zlib=objs/lib/zlib |
| 42 | + --with-openssl=objs/lib/openssl |
| 43 | + --with-openssl-opt="no-asm no-module no-tests -D_WIN32_WINNT=0x0601" |
| 44 | +
|
| 45 | + NGX_CONFIGURE_DYNAMIC_MODULES: >- |
| 46 | + --add-dynamic-module=${{ github.workspace }}/examples |
| 47 | + NGX_CONFIGURE_STATIC_MODULES: >- |
| 48 | + --add-module=${{ github.workspace }}/examples |
| 49 | +
|
| 50 | + NGX_TEST_FILES: examples/t |
| 51 | + NGX_TEST_GLOBALS_DYNAMIC: >- |
| 52 | + load_module ${{ github.workspace }}/nginx/objs/ngx_http_async_module.so; |
| 53 | + load_module ${{ github.workspace }}/nginx/objs/ngx_http_awssigv4_module.so; |
| 54 | + load_module ${{ github.workspace }}/nginx/objs/ngx_http_curl_module.so; |
| 55 | + load_module ${{ github.workspace }}/nginx/objs/ngx_http_upstream_custom_module.so; |
| 56 | +
|
| 57 | + OPENSSL_VERSION: '3.0.16' |
| 58 | + PCRE2_VERSION: '10.45' |
| 59 | + ZLIB_VERSION: '1.3.1' |
| 60 | + |
24 | 61 | jobs:
|
25 |
| - test: |
| 62 | + linux: |
26 | 63 | runs-on: ubuntu-latest
|
27 | 64 |
|
28 | 65 | strategy:
|
@@ -61,45 +98,134 @@ jobs:
|
61 | 98 | ~/.cargo/registry/index/
|
62 | 99 | ~/.cargo/registry/cache/
|
63 | 100 | ~/.cargo/git/db/
|
64 |
| - nginx/objs/ngx_rust_examples |
65 |
| - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
66 |
| - restore-keys: ${{ runner.os }}-cargo- |
| 101 | + nginx/objs/**/CACHEDIR.TAG |
| 102 | + nginx/objs/**/ngx-debug |
| 103 | + nginx/objs/**/ngx-release |
| 104 | + key: ${{ runner.os }}-nginx-${{ hashFiles('**/Cargo.lock') }} |
| 105 | + restore-keys: ${{ runner.os }}-nginx- |
67 | 106 |
|
68 | 107 | - name: Update configure arguments
|
69 | 108 | if: matrix.nginx-ref != 'stable-1.24'
|
70 | 109 | run: |
|
71 |
| - echo NGX_CONFIGURE="${NGX_CONFIGURE} --with-http_v3_module" \ |
| 110 | + echo NGX_CONFIGURE_UNIX="${NGX_CONFIGURE_UNIX} --with-http_v3_module" \ |
72 | 111 | >> "$GITHUB_ENV"
|
73 | 112 |
|
74 | 113 | - name: Configure nginx with static modules
|
75 | 114 | if: matrix.module == 'static'
|
76 | 115 | working-directory: nginx
|
77 | 116 | run: |
|
78 |
| - ${NGX_CONFIGURE} \ |
79 |
| - --add-module=${{ github.workspace }}/examples |
| 117 | + ${NGX_CONFIGURE_CMD} \ |
| 118 | + ${NGX_CONFIGURE_UNIX} \ |
| 119 | + ${NGX_CONFIGURE_STATIC_MODULES} |
80 | 120 |
|
81 | 121 | - name: Configure nginx with dynamic modules
|
82 | 122 | if: matrix.module != 'static'
|
83 | 123 | working-directory: nginx
|
84 |
| - env: |
85 |
| - TEST_NGINX_GLOBALS: >- |
86 |
| - load_module ${{ github.workspace }}/nginx/objs/ngx_http_async_module.so; |
87 |
| - load_module ${{ github.workspace }}/nginx/objs/ngx_http_awssigv4_module.so; |
88 |
| - load_module ${{ github.workspace }}/nginx/objs/ngx_http_curl_module.so; |
89 |
| - load_module ${{ github.workspace }}/nginx/objs/ngx_http_upstream_custom_module.so; |
90 | 124 | run: |
|
91 |
| - ${NGX_CONFIGURE} \ |
92 |
| - --add-dynamic-module=${{ github.workspace }}/examples |
93 |
| - echo "TEST_NGINX_GLOBALS=$TEST_NGINX_GLOBALS" >> $GITHUB_ENV |
| 125 | + ${NGX_CONFIGURE_CMD} \ |
| 126 | + ${NGX_CONFIGURE_UNIX} \ |
| 127 | + ${NGX_CONFIGURE_DYNAMIC_MODULES} |
| 128 | + echo TEST_NGINX_GLOBALS="$NGX_TEST_GLOBALS_DYNAMIC" >> "$GITHUB_ENV" |
94 | 129 |
|
95 | 130 | - name: Build nginx
|
96 | 131 | working-directory: nginx
|
97 | 132 | run: make -j$(nproc)
|
98 | 133 |
|
99 | 134 | - name: Run tests
|
100 | 135 | env:
|
| 136 | + PERL5LIB: ${{ github.workspace }}/nginx/tests/lib |
101 | 137 | TEST_NGINX_BINARY: ${{ github.workspace }}/nginx/objs/nginx
|
102 | 138 | TEST_NGINX_MODULES: ${{ github.workspace }}/nginx/objs
|
| 139 | + TEST_NGINX_VERBOSE: 1 |
| 140 | + run: | |
| 141 | + prove -j$(nproc) --state=save ${NGX_TEST_FILES} || prove -v --state=failed |
| 142 | +
|
| 143 | + windows: |
| 144 | + runs-on: windows-2022 |
| 145 | + env: |
| 146 | + TEMP: "C:\\TEMP" |
| 147 | + TMP: "C:\\TEMP" |
| 148 | + TMPDIR: "C:\\TEMP" |
| 149 | + VCARCH: x64 |
| 150 | + |
| 151 | + strategy: |
| 152 | + fail-fast: false |
| 153 | + matrix: |
| 154 | + nginx-ref: |
| 155 | + - master |
| 156 | + module: |
| 157 | + - static |
| 158 | + |
| 159 | + steps: |
| 160 | + - uses: actions/checkout@v4 |
| 161 | + - uses: actions/checkout@v4 |
| 162 | + with: |
| 163 | + ref: ${{ matrix.nginx-ref }} |
| 164 | + repository: 'nginx/nginx' |
| 165 | + path: 'nginx' |
| 166 | + - uses: actions/checkout@v4 |
| 167 | + with: |
| 168 | + repository: 'nginx/nginx-tests' |
| 169 | + path: 'nginx/tests' |
| 170 | + sparse-checkout: | |
| 171 | + lib |
| 172 | +
|
| 173 | + - uses: dtolnay/rust-toolchain@stable |
| 174 | + |
| 175 | + - uses: actions/cache@v4 |
| 176 | + with: |
| 177 | + path: | |
| 178 | + ~/.cargo/bin/ |
| 179 | + ~/.cargo/registry/index/ |
| 180 | + ~/.cargo/registry/cache/ |
| 181 | + ~/.cargo/git/db/ |
| 182 | + nginx/objs/**/CACHEDIR.TAG |
| 183 | + nginx/objs/**/ngx-debug |
| 184 | + nginx/objs/**/ngx-release |
| 185 | + key: ${{ runner.os }}-nginx-${{ hashFiles('**/Cargo.lock') }} |
| 186 | + restore-keys: ${{ runner.os }}-nginx- |
| 187 | + |
| 188 | + - name: Prepare build environment |
| 189 | + shell: bash |
| 190 | + working-directory: nginx |
| 191 | + run: | |
| 192 | + # Disable dynamic lookup of WSAPoll(); it crashes if the symbol is already imported by |
| 193 | + # Rust stdlib. |
| 194 | + sed 's/\(_WIN32_WINNT\s*\) 0x0501/\1 0x0601/' -i src/os/win32/ngx_win32_config.h |
| 195 | +
|
| 196 | + echo VCVARSALL="$('C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" \ |
| 197 | + >> "$GITHUB_ENV" |
| 198 | +
|
| 199 | + mkdir -p $TEMP |
| 200 | + mkdir -p objs/lib |
| 201 | +
|
| 202 | + curl -sLO https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.tar.gz |
| 203 | + tar -C objs/lib --transform "s/pcre2-$PCRE2_VERSION/pcre/" -xzf ./pcre2-$PCRE2_VERSION.tar.gz |
| 204 | + echo '#include <stdint.h>' > objs/lib/pcre/src/inttypes.h |
| 205 | +
|
| 206 | + curl -sLO https://github.com/madler/zlib/releases/download/v$ZLIB_VERSION/zlib-$ZLIB_VERSION.tar.gz |
| 207 | + tar -C objs/lib --transform "s/zlib-$ZLIB_VERSION/zlib/" -xzf ./zlib-$ZLIB_VERSION.tar.gz |
| 208 | +
|
| 209 | + curl -sLO https://github.com/openssl/openssl/releases/download/openssl-$OPENSSL_VERSION/openssl-$OPENSSL_VERSION.tar.gz |
| 210 | + tar -C objs/lib --transform "s/openssl-$OPENSSL_VERSION/openssl/" -xzf ./openssl-$OPENSSL_VERSION.tar.gz |
| 211 | +
|
| 212 | + - name: Configure and build nginx |
| 213 | + shell: cmd |
| 214 | + working-directory: nginx |
| 215 | + run: | |
| 216 | + @echo on |
| 217 | + call "%VCVARSALL%" %VCARCH% |
| 218 | + bash.exe ^ |
| 219 | + %NGX_CONFIGURE_CMD% ^ |
| 220 | + %NGX_CONFIGURE_WINDOWS% ^ |
| 221 | + %NGX_CONFIGURE_STATIC_MODULES% |
| 222 | + nmake -f objs/Makefile |
| 223 | +
|
| 224 | + - name: Run tests |
| 225 | + shell: cmd |
| 226 | + env: |
| 227 | + PERL5LIB: "${{ github.workspace }}\\nginx\\tests\\lib" |
| 228 | + TEST_NGINX_BINARY: "${{ github.workspace }}\\nginx\\objs\\nginx.exe" |
| 229 | + TEST_NGINX_VERBOSE: 1 |
103 | 230 | run: |
|
104 |
| - prove -v -j$(nproc) -Inginx/tests/lib --state=save examples/t \ |
105 |
| - || prove -v -Inginx/tests/lib --state=failed |
| 231 | + prove --state=save %NGX_TEST_FILES% || prove -v --state=failed |
0 commit comments