From 8e7ce3bb000485c8454190d328672d092bd07de1 Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov Date: Fri, 5 Apr 2024 13:27:37 -0700 Subject: [PATCH] Added CI based on GitHub Actions. --- .github/workflows/check-pr.yml | 86 ++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 11 +++++ 2 files changed, 97 insertions(+) create mode 100644 .github/workflows/check-pr.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml new file mode 100644 index 00000000..2f151197 --- /dev/null +++ b/.github/workflows/check-pr.yml @@ -0,0 +1,86 @@ +name: check-pr + +on: + pull_request: + +jobs: + build: + runs-on: [ ubuntu-latest ] + steps: + - name: checkout v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Set the defaults and set up environment + run: | + 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 + export DEB_BUILD_MAINT_OPTIONS="hardening=+all" + export DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" + export DEB_LDFLAGS_MAINT_APPEND=""-Wl,--as-needed"" + echo CC_OPT=$(dpkg-buildflags --get CFLAGS) >> $GITHUB_ENV + echo LD_OPT=$(dpkg-buildflags --get LDFLAGS) >> $GITHUB_ENV + echo MAKE_UTILITY=make >> $GITHUB_ENV + + - name: Install build dependencies + run: | + sudo apt-get update + sudo apt-get install \ + libssl-dev zlib1g-dev libpcre2-dev libxslt1-dev libgeoip-dev \ + libgd-dev libxml2-dev libedit-dev libperl-dev libtest-harness-perl \ + libgd-perl libgeoip-dev expect + + - name: Check out nginx + run: | + git clone https://github.com/nginx/nginx nginx-source + + - name: Check out nginx tests + run: | + git clone https://github.com/nginx/nginx-tests + + - name: Check out and build quickjs + run: | + git clone https://github.com/bellard/quickjs + cd quickjs && curl -OL http://pp.nginx.com/pluknet/quickjs.patch && git apply quickjs.patch + CFLAGS=$CC_OPT LDFLAGS=$LD_OPT $MAKE_UTILITY -j$(nproc) libquickjs.a + + - name: Configure and make njs + run: | + ./configure \ + --cc-opt="$CC_OPT" \ + --ld-opt="$LD_OPT" \ + || cat build/autoconf.err + $MAKE_UTILITY -j$(nproc) + + - name: Test njs + run: | + $MAKE_UTILITY test + $MAKE_UTILITY clean + + - name: Configure and make njs with quickjs + run: | + ./configure \ + --with-quickjs \ + --cc-opt="$CC_OPT -Iquickjs" \ + --ld-opt="$LD_OPT -Lquickjs" \ + || cat build/autoconf.err + $MAKE_UTILITY -j$(nproc) + + - name: Test njs with quickjs + run: | + $MAKE_UTILITY test + $MAKE_UTILITY clean + + - name: Configure and build nginx and njs modules + run: | + cd nginx-source + $NGINX_CONFIGURE_CMD --with-cc-opt="$CC_OPT" --with-ld-opt="$LD_OPT" --add-dynamic-module=../nginx || cat objs/autoconf.err + $MAKE_UTILITY -j$(nproc) modules + $MAKE_UTILITY -j$(nproc) + + - name: Test njs modules + run: | + ulimit -c unlimited + prove -v -j$(nproc) -Inginx-tests/lib --state=save nginx/t . || prove -v -Inginx-tests/lib --state=failed + env: + TEST_NGINX_BINARY: "${{ github.workspace }}/nginx-source/objs/nginx" + 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;" + TEST_NGINX_VERBOSE: 1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..3d5a1ace --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,11 @@ +name: CI + +on: + workflow_dispatch: + push: + branches: + - master + +jobs: + buildbot: + uses: nginx/ci-self-hosted/.github/workflows/njs-buildbot.yml@main -- 2.47.3