Skip to content

Commit 35aafc9

Browse files
committed
ci: test windows builds
1 parent c94b78c commit 35aafc9

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
@@ -9,7 +9,7 @@ on:
99
env:
1010
CARGO_TERM_COLOR: 'always'
1111
RUST_BACKTRACE: '1'
12-
NGX_CONFIGURE: >-
12+
NGX_CONFIGURE_CMD: >-
1313
auto/configure
1414
--with-compat
1515
--with-debug
@@ -19,10 +19,35 @@ env:
1919
--with-stream
2020
--with-stream_realip_module
2121
--with-stream_ssl_module
22+
23+
NGX_CONFIGURE_UNIX: >-
2224
--with-threads
2325
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+
OPENSSL_VERSION: '3.0.16'
46+
PCRE2_VERSION: '10.45'
47+
ZLIB_VERSION: '1.3.1'
48+
2449
jobs:
25-
test:
50+
linux:
2651
runs-on: ubuntu-latest
2752

2853
strategy:
@@ -68,14 +93,15 @@ jobs:
6893
- name: Update configure arguments
6994
if: matrix.nginx-ref != 'stable-1.24'
7095
run: |
71-
echo NGX_CONFIGURE="${NGX_CONFIGURE} --with-http_v3_module" \
96+
echo NGX_CONFIGURE_UNIX="${NGX_CONFIGURE_UNIX} --with-http_v3_module" \
7297
>> "$GITHUB_ENV"
7398
7499
- name: Configure nginx with static modules
75100
if: matrix.module == 'static'
76101
working-directory: nginx
77102
run: |
78-
${NGX_CONFIGURE} \
103+
${NGX_CONFIGURE_CMD} \
104+
${NGX_CONFIGURE_UNIX} \
79105
--add-module=${{ github.workspace }}/examples
80106
81107
- name: Configure nginx with dynamic modules
@@ -88,7 +114,8 @@ jobs:
88114
load_module ${{ github.workspace }}/nginx/objs/ngx_http_curl_module.so;
89115
load_module ${{ github.workspace }}/nginx/objs/ngx_http_upstream_custom_module.so;
90116
run: |
91-
${NGX_CONFIGURE} \
117+
${NGX_CONFIGURE_CMD} \
118+
${NGX_CONFIGURE_UNIX} \
92119
--add-dynamic-module=${{ github.workspace }}/examples
93120
echo "TEST_NGINX_GLOBALS=$TEST_NGINX_GLOBALS" >> $GITHUB_ENV
94121
@@ -98,8 +125,97 @@ jobs:
98125

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

0 commit comments

Comments
 (0)