|
| 1 | +name: check-pr |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + runs-on: [ ubuntu-latest ] |
| 9 | + steps: |
| 10 | + - name: checkout v4 |
| 11 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 12 | + |
| 13 | + - name: Set the defaults and set up environment |
| 14 | + run: | |
| 15 | + echo NGINX_CONFIGURE_CMD="auto/configure --prefix=/tmp --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-select_module --with-poll_module --with-http_auth_request_module --with-http_v2_module --with-http_slice_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_realip_module --with-threads --with-cpp_test_module --with-compat --with-http_degradation_module --with-http_xslt_module --with-http_image_filter_module --with-http_perl_module --with-http_geoip_module --with-stream_geoip_module" >> $GITHUB_ENV |
| 16 | + export DEB_BUILD_MAINT_OPTIONS="hardening=+all" |
| 17 | + export DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" |
| 18 | + export DEB_LDFLAGS_MAINT_APPEND=""-Wl,--as-needed"" |
| 19 | + echo CC_OPT=$(dpkg-buildflags --get CFLAGS) >> $GITHUB_ENV |
| 20 | + echo LD_OPT=$(dpkg-buildflags --get LDFLAGS) >> $GITHUB_ENV |
| 21 | + echo MAKE_UTILITY=make >> $GITHUB_ENV |
| 22 | +
|
| 23 | + - name: Install build dependencies |
| 24 | + run: | |
| 25 | + sudo apt-get update |
| 26 | + sudo apt-get install \ |
| 27 | + libssl-dev zlib1g-dev libpcre2-dev libxslt1-dev libgeoip-dev \ |
| 28 | + libgd-dev libxml2-dev libedit-dev libperl-dev libtest-harness-perl \ |
| 29 | + libgd-perl libgeoip-dev expect |
| 30 | +
|
| 31 | + - name: Check out nginx |
| 32 | + run: | |
| 33 | + git clone https://github.com/nginx/nginx nginx-source |
| 34 | +
|
| 35 | + - name: Check out nginx tests |
| 36 | + run: | |
| 37 | + git clone https://github.com/nginx/nginx-tests |
| 38 | +
|
| 39 | + - name: Check out and build quickjs |
| 40 | + run: | |
| 41 | + git clone https://github.com/bellard/quickjs |
| 42 | + cd quickjs && curl -OL http://pp.nginx.com/pluknet/quickjs.patch && git apply quickjs.patch |
| 43 | + CFLAGS=$CC_OPT LDFLAGS=$LD_OPT $MAKE_UTILITY -j$(nproc) libquickjs.a |
| 44 | +
|
| 45 | + - name: Configure and make njs |
| 46 | + run: | |
| 47 | + ./configure \ |
| 48 | + --cc-opt="$CC_OPT" \ |
| 49 | + --ld-opt="$LD_OPT" \ |
| 50 | + || cat build/autoconf.err |
| 51 | + $MAKE_UTILITY -j$(nproc) |
| 52 | +
|
| 53 | + - name: Test njs |
| 54 | + run: | |
| 55 | + $MAKE_UTILITY test |
| 56 | + $MAKE_UTILITY clean |
| 57 | +
|
| 58 | + - name: Configure and make njs with quickjs |
| 59 | + run: | |
| 60 | + ./configure \ |
| 61 | + --with-quickjs \ |
| 62 | + --cc-opt="$CC_OPT -Iquickjs" \ |
| 63 | + --ld-opt="$LD_OPT -Lquickjs" \ |
| 64 | + || cat build/autoconf.err |
| 65 | + $MAKE_UTILITY -j$(nproc) |
| 66 | +
|
| 67 | + - name: Test njs with quickjs |
| 68 | + run: | |
| 69 | + $MAKE_UTILITY test |
| 70 | + $MAKE_UTILITY clean |
| 71 | +
|
| 72 | + - name: Configure and build nginx and njs modules |
| 73 | + run: | |
| 74 | + cd nginx-source |
| 75 | + $NGINX_CONFIGURE_CMD --with-cc-opt="$CC_OPT" --with-ld-opt="$LD_OPT" --add-dynamic-module=../nginx || cat objs/autoconf.err |
| 76 | + $MAKE_UTILITY -j$(nproc) modules |
| 77 | + $MAKE_UTILITY -j$(nproc) |
| 78 | +
|
| 79 | + - name: Test njs modules |
| 80 | + run: | |
| 81 | + ulimit -c unlimited |
| 82 | + prove -v -j$(nproc) -Inginx-tests/lib --state=save nginx/t . || prove -v -Inginx-tests/lib --state=failed |
| 83 | + env: |
| 84 | + TEST_NGINX_BINARY: "${{ github.workspace }}/nginx-source/objs/nginx" |
| 85 | + TEST_NGINX_GLOBALS: "load_module ${{ github.workspace }}/nginx-source/objs/ngx_http_js_module.so; load_module ${{ github.workspace }}/nginx-source/objs/ngx_stream_js_module.so;" |
| 86 | + TEST_NGINX_VERBOSE: 1 |
0 commit comments