Skip to content

Commit c8856cd

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

File tree

1 file changed

+122
-6
lines changed

1 file changed

+122
-6
lines changed

.github/workflows/nginx.yaml

Lines changed: 122 additions & 6 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,30 @@ 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+
--prefix=
25+
--conf-path=conf/nginx.conf
26+
--pid-path=logs/nginx.pid
27+
--http-log-path=logs/access.log
28+
--error-log-path=logs/error.log
29+
--sbin-path=nginx.exe
30+
--http-client-body-temp-path=temp/client_body_temp
31+
--http-proxy-temp-path=temp/proxy_temp
32+
--http-fastcgi-temp-path=temp/fastcgi_temp
33+
--with-cc=cl
34+
--with-cc-opt=-DFD_SETSIZE=1024
35+
--with-openssl-opt='no-asm no-module no-tests -D_WIN32_WINNT=0x0601'
36+
37+
OPENSSL_VERSION: '3.0.16'
38+
PCRE2_VERSION: '10.45'
39+
ZLIB_VERSION: '1.3.1'
40+
2241
jobs:
23-
test:
42+
linux:
2443
runs-on: ubuntu-latest
2544

2645
strategy:
@@ -63,14 +82,16 @@ jobs:
6382
- name: Update configure arguments
6483
if: matrix.nginx-ref != 'stable-1.24'
6584
run: |
66-
echo NGX_CONFIGURE="${NGX_CONFIGURE} --with-http_v3_module" \
85+
echo NGX_CONFIGURE_UNIX="${NGX_CONFIGURE_UNIX} --with-http_v3_module" \
6786
>> "$GITHUB_ENV"
6887
6988
- name: Configure nginx with static modules
7089
if: matrix.module == 'static'
7190
working-directory: nginx
7291
run: |
73-
${NGX_CONFIGURE} \
92+
auto/configure \
93+
${NGX_CONFIGURE_COMMON} \
94+
${NGX_CONFIGURE_UNIX} \
7495
--add-module=${{ github.workspace }}/examples
7596
7697
- name: Configure nginx with dynamic modules
@@ -83,7 +104,9 @@ jobs:
83104
load_module ${{ github.workspace }}/nginx/objs/ngx_http_curl_module.so;
84105
load_module ${{ github.workspace }}/nginx/objs/ngx_http_upstream_custom_module.so;
85106
run: |
86-
${NGX_CONFIGURE} \
107+
auto/configure \
108+
${NGX_CONFIGURE_COMMON} \
109+
${NGX_CONFIGURE_UNIX} \
87110
--add-dynamic-module=${{ github.workspace }}/examples
88111
echo "TEST_NGINX_GLOBALS=$TEST_NGINX_GLOBALS" >> $GITHUB_ENV
89112
@@ -98,3 +121,96 @@ jobs:
98121
run: |
99122
prove -v -j$(nproc) -Inginx/tests/lib --state=save examples/t \
100123
|| prove -v -Inginx/tests/lib --state=failed
124+
125+
windows:
126+
runs-on: windows-2022
127+
128+
env:
129+
VCARCH: x64
130+
131+
defaults:
132+
run:
133+
shell: C:\Tools\msys64\msys2_shell.cmd -defterm -no-start -where . -full-path -shell bash.exe -Eeo pipefail -x '{0}'
134+
135+
strategy:
136+
fail-fast: false
137+
matrix:
138+
nginx-ref:
139+
- master
140+
# stable-1.28
141+
module:
142+
- static
143+
144+
steps:
145+
- uses: actions/checkout@v4
146+
- uses: actions/checkout@v4
147+
with:
148+
ref: ${{ matrix.nginx-ref }}
149+
repository: 'nginx/nginx'
150+
path: 'nginx'
151+
- uses: actions/checkout@v4
152+
with:
153+
repository: 'nginx/nginx-tests'
154+
path: 'nginx/tests'
155+
sparse-checkout: |
156+
lib
157+
158+
# uses: dtolnay/rust-toolchain@stable
159+
160+
- uses: actions/cache@v4
161+
with:
162+
path: |
163+
~/.cargo/bin/
164+
~/.cargo/registry/index/
165+
~/.cargo/registry/cache/
166+
~/.cargo/git/db/
167+
nginx/objs/ngx_rust_examples
168+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
169+
restore-keys: ${{ runner.os }}-cargo-
170+
171+
- name: Prepare build environment
172+
working-directory: nginx
173+
run: |
174+
# Disable dynamic lookup of WSAPoll(); it crashes if the symbol is already imported by
175+
# Rust stdib.
176+
sed 's/\(_WIN32_WINNT\s*\) 0x0501/\1 0x0600/' -i src/os/win32/ngx_win32_config.h
177+
178+
echo "VCVARSALL=$('C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
179+
180+
- name: Download and unpack dependencies
181+
working-directory: nginx
182+
run: |
183+
mkdir objs
184+
mkdir objs/lib
185+
curl -sLO https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.tar.gz
186+
tar -C objs/lib --transform "s/pcre2-$PCRE2_VERSION/pcre/" -xzf ./pcre2-$PCRE2_VERSION.tar.gz
187+
echo '#include "stdint.h"' > objs/lib/pcre/src/inttypes.h
188+
189+
curl -sLO https://zlib.net/fossils/zlib-${{ env.ZLIB_VERSION }}.tar.gz
190+
tar -C objs/lib --transform "s/zlib-$ZLIB_VERSION/zlib/" -xzf ./zlib-$ZLIB_VERSION.tar.gz
191+
192+
curl -sLO https://github.com/openssl/openssl/releases/download/openssl-$OPENSSL_VERSION/openssl-$OPENSSL_VERSION.tar.gz
193+
tar -C objs/lib --transform "s/openssl-$OPENSSL_VERSION/openssl/" -xzf ./openssl-$OPENSSL_VERSION.tar.gz
194+
195+
echo NGX_CONFIGURE_WINDOWS="${NGX_CONFIGURE_WINDOWS} --with-openssl=objs/lib/openssl --with-pcre=objs/lib/pcre --with-zlib=objs/lib/zlib" >> $GITHUB_ENV
196+
197+
- name: Configure and build nginx
198+
working-directory: nginx
199+
shell: cmd
200+
run: |
201+
@echo on
202+
call "%VCVARSALL%" %VCARCH%
203+
bash.exe ^
204+
auto/configure ^
205+
%NGX_CONFIGURE_COMMON% ^
206+
%NGX_CONFIGURE_WINDOWS% ^
207+
--add-module=${{ github.workspace }}/examples
208+
nmake -f objs/Makefile
209+
210+
- name: Run tests
211+
env:
212+
TEST_NGINX_BINARY: ${{ github.workspace }}/nginx/objs/nginx.exe
213+
TEST_NGINX_MODULES: ${{ github.workspace }}/nginx/objs
214+
run: |
215+
prove -v -j$(nproc) -Inginx/tests/lib --state=save examples/t \
216+
|| prove -v -Inginx/tests/lib --state=failed

0 commit comments

Comments
 (0)