|
| 1 | +name: test nginx core |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master, update/* ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build-and-test: |
| 11 | + runs-on: "ubuntu-20.04" |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + compiler: |
| 16 | + - { compiler: GNU, CC: gcc, CXX: g++} |
| 17 | + - { compiler: LLVM, CC: clang, CXX: clang++} |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + - name: get dependencies |
| 21 | + run: | |
| 22 | + sudo apt update |
| 23 | + sudo apt remove nginx libgd3 |
| 24 | + sudo apt install -y libgd-dev libgeoip-dev libxslt1-dev libpcre++0v5 libpcre++-dev liblua5.1-0-dev lua5.1 libperl-dev cpanminus libssl-dev |
| 25 | + # for building nginx core |
| 26 | + sudo apt install -y libgoogle-perftools-dev |
| 27 | + # for running cases in nginx-tests |
| 28 | + sudo apt install -y uwsgi-plugin-python3 uwsgi ffmpeg memcached libsofthsm2-dev |
| 29 | + - name: 'checkout luajit2' |
| 30 | + uses: actions/checkout@v3 |
| 31 | + with: |
| 32 | + repository: openresty/luajit2 |
| 33 | + path: luajit2 |
| 34 | + - name: 'build luajit2' |
| 35 | + working-directory: luajit2 |
| 36 | + run: | |
| 37 | + make |
| 38 | + sudo make install |
| 39 | + - name: build |
| 40 | + env: |
| 41 | + CC: ${{ matrix.compiler.CC }} |
| 42 | + CXX: ${{ matrix.compiler.CXX }} |
| 43 | + LUAJIT_LIB: /usr/local/lib |
| 44 | + LUAJIT_INC: /usr/local/include/luajit-2.1 |
| 45 | + run: | |
| 46 | + # TODO: fix https://github.com/alibaba/tengine/issues/1720, then remove "-D T_NGX_HTTP_IMAGE_FILTER=0" |
| 47 | +
|
| 48 | + # NOTE: |
| 49 | + # For "-D T_NGX_MODIFY_DEFAULT_VALUE=0", we dont compile the source included in this macro, otherwise some nginx-tests cases tests will fail. |
| 50 | + # For "-D T_NGX_SERVER_INFO=0", it makes some cases pass, such as userid.t. |
| 51 | + # For "-D T_NGX_HTTP_UPSTREAM_RANDOM=0", it makes some cases pass, such as image_filter_finalize.t. |
| 52 | + ./configure \ |
| 53 | + --with-cc-opt="-D T_NGX_MODIFY_DEFAULT_VALUE=0 -D T_NGX_HTTP_IMAGE_FILTER=0 -D T_NGX_SERVER_INFO=0 -D T_NGX_HTTP_UPSTREAM_RANDOM=0" \ |
| 54 | + --with-ld-opt="-Wl,-rpath,/usr/local/lib" \ |
| 55 | + --with-openssl-async \ |
| 56 | + --with-pcre \ |
| 57 | + --with-http_ssl_module \ |
| 58 | + --with-http_image_filter_module \ |
| 59 | + --with-http_v2_module \ |
| 60 | + --with-http_addition_module \ |
| 61 | + --with-http_mp4_module \ |
| 62 | + --with-http_realip_module \ |
| 63 | + --with-http_xslt_module \ |
| 64 | + --with-http_geoip_module \ |
| 65 | + --with-http_sub_module \ |
| 66 | + --with-http_dav_module \ |
| 67 | + --with-http_flv_module \ |
| 68 | + --with-http_gunzip_module \ |
| 69 | + --with-http_gzip_static_module \ |
| 70 | + --with-http_auth_request_module \ |
| 71 | + --with-http_random_index_module \ |
| 72 | + --with-http_secure_link_module \ |
| 73 | + --with-http_degradation_module \ |
| 74 | + --with-http_slice_module \ |
| 75 | + --with-http_stub_status_module \ |
| 76 | + --with-mail \ |
| 77 | + --with-mail_ssl_module \ |
| 78 | + --with-stream \ |
| 79 | + --with-stream_ssl_module \ |
| 80 | + --with-stream_realip_module \ |
| 81 | + --with-stream_geoip_module \ |
| 82 | + --with-stream_ssl_preread_module \ |
| 83 | + --with-google_perftools_module \ |
| 84 | + --with-cpp_test_module \ |
| 85 | + --with-compat \ |
| 86 | + --add-module=modules/mod_config \ |
| 87 | + --add-module=modules/mod_dubbo \ |
| 88 | + --add-module=modules/ngx_backtrace_module \ |
| 89 | + --add-module=modules/ngx_debug_timer \ |
| 90 | + --add-module=modules/ngx_http_concat_module \ |
| 91 | + --add-module=modules/ngx_http_footer_filter_module \ |
| 92 | + --add-module=modules/ngx_http_lua_module \ |
| 93 | + --add-module=modules/ngx_http_proxy_connect_module \ |
| 94 | + --add-module=modules/ngx_http_reqstat_module \ |
| 95 | + --add-module=modules/ngx_http_sysguard_module \ |
| 96 | + --add-module=modules/ngx_http_trim_filter_module \ |
| 97 | + --add-module=modules/ngx_http_upstream_check_module \ |
| 98 | + --add-module=modules/ngx_http_upstream_consistent_hash_module \ |
| 99 | + --add-module=modules/ngx_http_upstream_dynamic_module \ |
| 100 | + --add-module=modules/ngx_http_upstream_session_sticky_module \ |
| 101 | + --add-module=modules/ngx_http_upstream_vnswrr_module \ |
| 102 | + --add-module=modules/ngx_http_user_agent_module \ |
| 103 | + --add-module=modules/ngx_multi_upstream_module \ |
| 104 | + --add-module=modules/ngx_slab_stat \ |
| 105 | + --add-module=modules/ngx_http_upstream_dyups_module \ |
| 106 | + --with-http_perl_module \ |
| 107 | + --with-stream_sni \ |
| 108 | + --with-openssl-async \ |
| 109 | + --with-debug |
| 110 | + # skip ngx_debug_pool, it modified NGX_MIN_POOL_SIZE, which made some test case failed (http_header_buffers.t) |
| 111 | + # skip tengine upstream keepalive module |
| 112 | + #--without-http_upstream_keepalive_module \ |
| 113 | + #--add-module=modules/ngx_http_upstream_keepalive_module \ |
| 114 | + # skip tengine slice module |
| 115 | + #--add-module=modules/ngx_http_slice_module \ |
| 116 | + make -j2 |
| 117 | + sudo make install |
| 118 | + - name: run cases in nginx-tests |
| 119 | + working-directory: tests/nginx-tests |
| 120 | + env: |
| 121 | + TEST_NGINX_BINARY: /usr/local/nginx/sbin/nginx |
| 122 | + TEST_NGINX_UNSAFE: yes |
| 123 | + run: | |
| 124 | + # prepare perl library for test case |
| 125 | + sudo cpanm --notest SCGI Protocol::WebSocket Net::SSLeay IO::Socket::SSL Cache::Memcached Cache::Memcached::Fast Net::DNS::Nameserver GD > build.log 2>&1 || (cat build.log && exit 1) |
| 126 | + # fixed http_method.t for tengine proxy_connect module |
| 127 | + sed -i -e "s+405 Not Allowed(?!.*200 OK)/s, 'connect'+400 Bad Request(?!.*200 OK)/s, 'connect'+" nginx-tests/http_method.t |
| 128 | + # run cases in nginx-tests |
| 129 | + prove -I nginx-tests/lib nginx-tests/ |
| 130 | + # It must be root for some cases. |
| 131 | + sudo groupadd wheel # for proxy_bind_transparent.t |
| 132 | + sudo TEST_NGINX_BINARY=/usr/local/nginx/sbin/nginx TEST_NGINX_UNSAFE=yes prove -I nginx-tests/lib nginx-tests/proxy_bind_transparent.t nginx-tests/proxy_bind_transparent_capability.t |
| 133 | +
|
0 commit comments