Skip to content

Commit 65affc1

Browse files
committed
ci: test windows builds
1 parent 9080fd9 commit 65affc1

File tree

1 file changed

+126
-8
lines changed

1 file changed

+126
-8
lines changed

.github/workflows/nginx.yaml

Lines changed: 126 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ on:
77
env:
88
CARGO_TERM_COLOR: 'always'
99
RUST_BACKTRACE: '1'
10-
NGX_CONFIGURE: >-
11-
auto/configure
10+
NGX_CONFIGURE_COMMON: >-
1211
--with-compat
1312
--with-debug
1413
--with-http_realip_module
@@ -17,10 +16,35 @@ env:
1716
--with-stream
1817
--with-stream_realip_module
1918
--with-stream_ssl_module
19+
20+
NGX_CONFIGURE_UNIX: >-
2021
--with-threads
2122
23+
NGX_CONFIGURE_WINDOWS: >-
24+
--with-cc=cl
25+
--prefix=
26+
--conf-path=conf/nginx.conf
27+
--pid-path=logs/nginx.pid
28+
--http-log-path=logs/access.log
29+
--error-log-path=logs/error.log
30+
--sbin-path=nginx.exe
31+
--http-client-body-temp-path=temp/client_body_temp
32+
--http-proxy-temp-path=temp/proxy_temp
33+
--http-fastcgi-temp-path=temp/fastcgi_temp
34+
--http-scgi-temp-path=temp/scgi_temp
35+
--http-uwsgi-temp-path=temp/uwsgi_temp
36+
--with-cc-opt=-DFD_SETSIZE=1024
37+
--with-pcre=objs/lib/pcre
38+
--with-zlib=objs/lib/zlib
39+
--with-openssl=objs/lib/openssl
40+
--with-openssl-opt="no-asm no-module no-tests -D_WIN32_WINNT=0x0601"
41+
42+
OPENSSL_VERSION: '3.0.16'
43+
PCRE2_VERSION: '10.45'
44+
ZLIB_VERSION: '1.3.1'
45+
2246
jobs:
23-
test:
47+
linux:
2448
runs-on: ubuntu-latest
2549

2650
strategy:
@@ -63,14 +87,16 @@ jobs:
6387
- name: Update configure arguments
6488
if: matrix.nginx-ref != 'stable-1.24'
6589
run: |
66-
echo NGX_CONFIGURE="${NGX_CONFIGURE} --with-http_v3_module" \
90+
echo NGX_CONFIGURE_UNIX="${NGX_CONFIGURE_UNIX} --with-http_v3_module" \
6791
>> "$GITHUB_ENV"
6892
6993
- name: Configure nginx with static modules
7094
if: matrix.module == 'static'
7195
working-directory: nginx
7296
run: |
73-
${NGX_CONFIGURE} \
97+
auto/configure \
98+
${NGX_CONFIGURE_COMMON} \
99+
${NGX_CONFIGURE_UNIX} \
74100
--add-module=${{ github.workspace }}/examples
75101
76102
- name: Configure nginx with dynamic modules
@@ -83,7 +109,9 @@ jobs:
83109
load_module ${{ github.workspace }}/nginx/objs/ngx_http_curl_module.so;
84110
load_module ${{ github.workspace }}/nginx/objs/ngx_http_upstream_custom_module.so;
85111
run: |
86-
${NGX_CONFIGURE} \
112+
auto/configure \
113+
${NGX_CONFIGURE_COMMON} \
114+
${NGX_CONFIGURE_UNIX} \
87115
--add-dynamic-module=${{ github.workspace }}/examples
88116
echo "TEST_NGINX_GLOBALS=$TEST_NGINX_GLOBALS" >> $GITHUB_ENV
89117
@@ -93,8 +121,98 @@ jobs:
93121

94122
- name: Run tests
95123
env:
124+
PERL5LIB: ${{ github.workspace }}/nginx/tests/lib
96125
TEST_NGINX_BINARY: ${{ github.workspace }}/nginx/objs/nginx
97126
TEST_NGINX_MODULES: ${{ github.workspace }}/nginx/objs
127+
TEST_NGINX_VERBOSE: 1
128+
run: |
129+
prove -j$(nproc) --state=save examples/t || prove -v --state=failed
130+
131+
windows:
132+
runs-on: windows-2022
133+
env:
134+
TEMP: "C:\\TEMP"
135+
TMP: "C:\\TEMP"
136+
TMPDIR: "C:\\TEMP"
137+
VCARCH: x64
138+
139+
strategy:
140+
fail-fast: false
141+
matrix:
142+
nginx-ref:
143+
- master
144+
module:
145+
- static
146+
147+
steps:
148+
- uses: actions/checkout@v4
149+
- uses: actions/checkout@v4
150+
with:
151+
ref: ${{ matrix.nginx-ref }}
152+
repository: 'nginx/nginx'
153+
path: 'nginx'
154+
- uses: actions/checkout@v4
155+
with:
156+
repository: 'nginx/nginx-tests'
157+
path: 'nginx/tests'
158+
sparse-checkout: |
159+
lib
160+
161+
# uses: dtolnay/rust-toolchain@stable
162+
163+
- uses: actions/cache@v4
164+
with:
165+
path: |
166+
~/.cargo/bin/
167+
~/.cargo/registry/index/
168+
~/.cargo/registry/cache/
169+
~/.cargo/git/db/
170+
nginx/objs/ngx_rust_examples
171+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
172+
restore-keys: ${{ runner.os }}-cargo-
173+
174+
- name: Prepare build environment
175+
shell: bash
176+
working-directory: nginx
177+
run: |
178+
# Disable dynamic lookup of WSAPoll(); it crashes if the symbol is already imported by
179+
# Rust stdib.
180+
sed 's/\(_WIN32_WINNT\s*\) 0x0501/\1 0x0601/' -i src/os/win32/ngx_win32_config.h
181+
182+
echo "VCVARSALL=$('C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" \
183+
>> "$GITHUB_ENV"
184+
185+
mkdir -p $TEMP
186+
mkdir -p objs/lib
187+
188+
curl -sLO https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.tar.gz
189+
tar -C objs/lib --transform "s/pcre2-$PCRE2_VERSION/pcre/" -xzf ./pcre2-$PCRE2_VERSION.tar.gz
190+
echo '#include <stdint.h>' > objs/lib/pcre/src/inttypes.h
191+
192+
curl -sLO https://github.com/madler/zlib/releases/download/v$ZLIB_VERSION/zlib-$ZLIB_VERSION.tar.gz
193+
tar -C objs/lib --transform "s/zlib-$ZLIB_VERSION/zlib/" -xzf ./zlib-$ZLIB_VERSION.tar.gz
194+
195+
curl -sLO https://github.com/openssl/openssl/releases/download/openssl-$OPENSSL_VERSION/openssl-$OPENSSL_VERSION.tar.gz
196+
tar -C objs/lib --transform "s/openssl-$OPENSSL_VERSION/openssl/" -xzf ./openssl-$OPENSSL_VERSION.tar.gz
197+
198+
- name: Configure and build nginx
199+
shell: cmd
200+
working-directory: nginx
201+
run: |
202+
@echo on
203+
call "%VCVARSALL%" %VCARCH%
204+
bash.exe ^
205+
auto/configure ^
206+
%NGX_CONFIGURE_COMMON% ^
207+
%NGX_CONFIGURE_WINDOWS% ^
208+
--add-module=${{ github.workspace }}/examples
209+
nmake -f objs/Makefile
210+
211+
- name: Run tests
212+
shell: cmd
213+
env:
214+
TEST_NGINX_BINARY: "${{ github.workspace }}\\nginx\\objs\\nginx.exe"
215+
TEST_NGINX_VERBOSE: 1
216+
PERL5LIB: "${{ github.workspace }}\\nginx\\tests\\lib"
98217
run: |
99-
prove -v -j$(nproc) -Inginx/tests/lib --state=save examples/t \
100-
|| prove -v -Inginx/tests/lib --state=failed
218+
prove --state=save examples/t || prove -v --state=failed

0 commit comments

Comments
 (0)