Skip to content

Commit 15000ee

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

File tree

1 file changed

+123
-7
lines changed

1 file changed

+123
-7
lines changed

.github/workflows/nginx.yaml

Lines changed: 123 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
env:
88
CARGO_TERM_COLOR: 'always'
99
RUST_BACKTRACE: '1'
10-
NGX_CONFIGURE: >-
10+
NGX_CONFIGURE_CMD: >-
1111
auto/configure
1212
--with-compat
1313
--with-debug
@@ -17,10 +17,35 @@ env:
1717
--with-stream
1818
--with-stream_realip_module
1919
--with-stream_ssl_module
20+
21+
NGX_CONFIGURE_UNIX: >-
2022
--with-threads
2123
24+
NGX_CONFIGURE_WINDOWS: >-
25+
--with-cc=cl
26+
--prefix=
27+
--conf-path=conf/nginx.conf
28+
--pid-path=logs/nginx.pid
29+
--http-log-path=logs/access.log
30+
--error-log-path=logs/error.log
31+
--sbin-path=nginx.exe
32+
--http-client-body-temp-path=temp/client_body_temp
33+
--http-proxy-temp-path=temp/proxy_temp
34+
--http-fastcgi-temp-path=temp/fastcgi_temp
35+
--http-scgi-temp-path=temp/scgi_temp
36+
--http-uwsgi-temp-path=temp/uwsgi_temp
37+
--with-cc-opt=-DFD_SETSIZE=1024
38+
--with-pcre=objs/lib/pcre
39+
--with-zlib=objs/lib/zlib
40+
--with-openssl=objs/lib/openssl
41+
--with-openssl-opt="no-asm no-module no-tests -D_WIN32_WINNT=0x0601"
42+
43+
OPENSSL_VERSION: '3.0.16'
44+
PCRE2_VERSION: '10.45'
45+
ZLIB_VERSION: '1.3.1'
46+
2247
jobs:
23-
test:
48+
linux:
2449
runs-on: ubuntu-latest
2550

2651
strategy:
@@ -63,14 +88,15 @@ jobs:
6388
- name: Update configure arguments
6489
if: matrix.nginx-ref != 'stable-1.24'
6590
run: |
66-
echo NGX_CONFIGURE="${NGX_CONFIGURE} --with-http_v3_module" \
91+
echo NGX_CONFIGURE_UNIX="${NGX_CONFIGURE_UNIX} --with-http_v3_module" \
6792
>> "$GITHUB_ENV"
6893
6994
- name: Configure nginx with static modules
7095
if: matrix.module == 'static'
7196
working-directory: nginx
7297
run: |
73-
${NGX_CONFIGURE} \
98+
${NGX_CONFIGURE_CMD} \
99+
${NGX_CONFIGURE_UNIX} \
74100
--add-module=${{ github.workspace }}/examples
75101
76102
- name: Configure nginx with dynamic modules
@@ -83,7 +109,8 @@ 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+
${NGX_CONFIGURE_CMD} \
113+
${NGX_CONFIGURE_UNIX} \
87114
--add-dynamic-module=${{ github.workspace }}/examples
88115
echo "TEST_NGINX_GLOBALS=$TEST_NGINX_GLOBALS" >> $GITHUB_ENV
89116
@@ -93,8 +120,97 @@ jobs:
93120

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

0 commit comments

Comments
 (0)