Skip to content

ci: test windows builds #22

ci: test windows builds

ci: test windows builds #22

Workflow file for this run

name: NGINX
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: 'always'
RUST_BACKTRACE: '1'
NGX_CONFIGURE_COMMON: >-
--with-compat
--with-debug
--with-http_realip_module
--with-http_ssl_module
--with-http_v2_module
--with-stream
--with-stream_realip_module
--with-stream_ssl_module
NGX_CONFIGURE_UNIX: >-
--with-threads
NGX_CONFIGURE_WINDOWS: >-
--prefix=
--conf-path=conf/nginx.conf
--pid-path=logs/nginx.pid
--http-log-path=logs/access.log
--error-log-path=logs/error.log
--sbin-path=nginx.exe
--http-client-body-temp-path=temp/client_body_temp
--http-proxy-temp-path=temp/proxy_temp
--http-fastcgi-temp-path=temp/fastcgi_temp
--with-cc=cl
--with-cc-opt=-DFD_SETSIZE=1024
--with-openssl-opt='no-asm no-module no-tests -D_WIN32_WINNT=0x0601'
OPENSSL_VERSION: '3.0.16'
PCRE2_VERSION: '10.45'
ZLIB_VERSION: '1.3.1'
jobs:
linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
nginx-ref:
- master
# - stable-1.28
module:
- static
- dynamic
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
ref: ${{ matrix.nginx-ref }}
repository: 'nginx/nginx'
path: 'nginx'
- uses: actions/checkout@v4
with:
repository: 'nginx/nginx-tests'
path: 'nginx/tests'
sparse-checkout: |
lib
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
nginx/objs/ngx_rust_examples
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Update configure arguments
if: matrix.nginx-ref != 'stable-1.24'
run: |
echo NGX_CONFIGURE_UNIX="${NGX_CONFIGURE_UNIX} --with-http_v3_module" \
>> "$GITHUB_ENV"
- name: Configure nginx with static modules
if: matrix.module == 'static'
working-directory: nginx
run: |
auto/configure \
${NGX_CONFIGURE_COMMON} \
${NGX_CONFIGURE_UNIX} \
--add-module=${{ github.workspace }}/examples
- name: Configure nginx with dynamic modules
if: matrix.module != 'static'
working-directory: nginx
env:
TEST_NGINX_GLOBALS: >-
load_module ${{ github.workspace }}/nginx/objs/ngx_http_async_module.so;
load_module ${{ github.workspace }}/nginx/objs/ngx_http_awssigv4_module.so;
load_module ${{ github.workspace }}/nginx/objs/ngx_http_curl_module.so;
load_module ${{ github.workspace }}/nginx/objs/ngx_http_upstream_custom_module.so;
run: |
auto/configure \
${NGX_CONFIGURE_COMMON} \
${NGX_CONFIGURE_UNIX} \
--add-dynamic-module=${{ github.workspace }}/examples
echo "TEST_NGINX_GLOBALS=$TEST_NGINX_GLOBALS" >> $GITHUB_ENV
- name: Build nginx
working-directory: nginx
run: make -j$(nproc)
- name: Run tests
env:
TEST_NGINX_BINARY: ${{ github.workspace }}/nginx/objs/nginx
TEST_NGINX_MODULES: ${{ github.workspace }}/nginx/objs
run: |
prove -v -j$(nproc) -Inginx/tests/lib --state=save examples/t \
|| prove -v -Inginx/tests/lib --state=failed
windows:
runs-on: windows-2022
env:
VCARCH: x64
defaults:
run:
shell: "C:\\msys64\\msys2_shell.cmd -defterm -no-start -where . -full-path -shell bash.exe -Eeo pipefail -x '{0}'"
strategy:
fail-fast: false
matrix:
nginx-ref:
- master
# stable-1.28
module:
- static
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
ref: ${{ matrix.nginx-ref }}
repository: 'nginx/nginx'
path: 'nginx'
- uses: actions/checkout@v4
with:
repository: 'nginx/nginx-tests'
path: 'nginx/tests'
sparse-checkout: |
lib
# uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
nginx/objs/ngx_rust_examples
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Prepare build environment
working-directory: nginx
run: |
# Disable dynamic lookup of WSAPoll(); it crashes if the symbol is already imported by
# Rust stdib.
sed 's/\(_WIN32_WINNT\s*\) 0x0501/\1 0x0600/' -i src/os/win32/ngx_win32_config.h
echo "VCVARSALL=$('C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" \
>> "$GITHUB_ENV"
- name: Download and unpack dependencies
working-directory: nginx
run: |
mkdir objs
mkdir objs/lib
curl -sLO https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.tar.gz
tar -C objs/lib --transform "s/pcre2-$PCRE2_VERSION/pcre/" -xzf ./pcre2-$PCRE2_VERSION.tar.gz
echo '#include "stdint.h"' > objs/lib/pcre/src/inttypes.h
curl -sLO https://zlib.net/fossils/zlib-${{ env.ZLIB_VERSION }}.tar.gz
tar -C objs/lib --transform "s/zlib-$ZLIB_VERSION/zlib/" -xzf ./zlib-$ZLIB_VERSION.tar.gz
curl -sLO https://github.com/openssl/openssl/releases/download/openssl-$OPENSSL_VERSION/openssl-$OPENSSL_VERSION.tar.gz
tar -C objs/lib --transform "s/openssl-$OPENSSL_VERSION/openssl/" -xzf ./openssl-$OPENSSL_VERSION.tar.gz
echo NGX_CONFIGURE_WINDOWS="${NGX_CONFIGURE_WINDOWS} --with-openssl=objs/lib/openssl --with-pcre=objs/lib/pcre --with-zlib=objs/lib/zlib" \
>> "$GITHUB_ENV"
- name: Configure and build nginx
working-directory: nginx
shell: cmd
run: |
@echo on
call "%VCVARSALL%" %VCARCH%
bash.exe ^
auto/configure ^
%NGX_CONFIGURE_COMMON% ^
%NGX_CONFIGURE_WINDOWS% ^
--add-module=${{ github.workspace }}/examples
nmake -f objs/Makefile
- name: Run tests
env:
TEST_NGINX_BINARY: ${{ github.workspace }}/nginx/objs/nginx.exe
TEST_NGINX_MODULES: ${{ github.workspace }}/nginx/objs
run: |
prove -v -j$(nproc) -Inginx/tests/lib --state=save examples/t \
|| prove -v -Inginx/tests/lib --state=failed