From 57304ca8f86b716bd577cbf45cd09dbe14524106 Mon Sep 17 00:00:00 2001 From: xfeep Date: Wed, 13 Nov 2019 13:09:31 +0800 Subject: [PATCH 1/4] ci:use travis-ci job stages --- .travis.yml | 86 +++++++++++++++++----------------- nginx-clojure-embed/.gitignore | 1 + 2 files changed, 43 insertions(+), 44 deletions(-) diff --git a/.travis.yml b/.travis.yml index f6e78f1a..44dc15f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,8 @@ env: services: - mysql + + before_install: - cat /etc/hosts @@ -57,52 +59,48 @@ before_script: - cd ${NGX_SRC} && ./configure --with-http_v2_module --with-select_module --with-http_ssl_module --with-ipv6 --with-http_geoip_module --with-http_auth_request_module --with-debug --add-module=${NC_PJ_HOME}/src/c --with-http_stub_status_module --prefix= --sbin-path=nginx --conf-path=conf/nginx.conf --error-log-path=logs/error.log --http-log-path=logs/access.log --pid-path=logs/nginx.pid --lock-path=logs/nginx.lock --http-client-body-temp-path=temp/client_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --http-uwsgi-temp-path=temp/uwsgi_temp --http-scgi-temp-path=temp/scgi_temp - make - cp objs/nginx ${NC_PJ_HOME}/test/nginx-working-dir - -script: - cd /home/who/git/nginx-clojure/ - mkdir bin - - lein with-profile +cljremotetest classpath - - lein install - - echo "******************************* Start Junit Test**********************************" - - lein with-profile unittest junit - - echo "******************************* Start Intergration Test (Plain Mode ) ************" - - cd /home/who/git/nginx-clojure/test/nginx-working-dir - - mkdir logs temp temp/client_temp temp/fastcgi_temp temp/proxy_temp temp/scgi_temp temp/uwsgi_temp - - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-plain.conf & -# - sudo iptables -A INPUT -p tcp --dport 8080 -j ACCEPT -# - sudo iptables -A INPUT -p tcp --dport 8081 -j ACCEPT -# - sudo iptables -A INPUT -p tcp --dport 8082 -j ACCEPT -# - sudo iptables -A INPUT -p tcp --dport 8181 -j ACCEPT -# - sudo iptables -A INPUT -p tcp --dport 8999 -j ACCEPT -# - sudo iptables --list -# - tail -f logs/error.log - - sleep 10 - - tail logs/error.log - - curl -v http://localhost:8080/clojure - - cd /home/who/git/nginx-clojure/ - - lein with-profile cljremotetest test :all - - cd /home/who/git/nginx-clojure/test/nginx-working-dir - - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-plain.conf -s stop - - sleep 10 - - echo "******************************* Start Intergration Test (Thread Pool Mode ) ************" - - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-threadpool.conf & - - sleep 10 - - tail logs/error.log - - curl -v http://localhost:8080/clojure - - cd /home/who/git/nginx-clojure/ - - lein with-profile cljremotetest test :no-async - - cd /home/who/git/nginx-clojure/test/nginx-working-dir - - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-threadpool.conf -s stop - - sleep 10 - - echo "******************************* Start Intergration Test (Coroutine Mode ) ************" - - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-coroutine.conf & - - sleep 30 - - tail logs/error.log - - curl -v http://localhost:8080/clojure - - cd /home/who/git/nginx-clojure/ - - lein with-profile cljremotetest test :all - - cd /home/who/git/nginx-clojure/test/nginx-working-dir - - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-coroutine.conf -s stop + - lein with-profile +cljremotetest classpath + - lein install + +jobs: + include: + - stage: unit test + script: + - lein with-profile unittest junit + - stage: integration test (plain mode) + script: + - cd /home/who/git/nginx-clojure/test/nginx-working-dir + - mkdir logs temp temp/client_temp temp/fastcgi_temp temp/proxy_temp temp/scgi_temp temp/uwsgi_temp + - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-plain.conf & + - sleep 10 + - tail logs/error.log + - curl -v http://localhost:8080/clojure + - cd /home/who/git/nginx-clojure/ + - lein with-profile cljremotetest test :all + - cd /home/who/git/nginx-clojure/test/nginx-working-dir + - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-plain.conf -s stop + - stage: integration test (thread pool mode) + script: + - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-threadpool.conf & + - sleep 10 + - tail logs/error.log + - curl -v http://localhost:8080/clojure + - cd /home/who/git/nginx-clojure/ + - lein with-profile cljremotetest test :no-async + - cd /home/who/git/nginx-clojure/test/nginx-working-dir + - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-threadpool.conf -s stop + - stage: integration test (coroutine mode) + script: + - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-coroutine.conf & + - sleep 30 + - tail logs/error.log + - curl -v http://localhost:8080/clojure + - cd /home/who/git/nginx-clojure/ + - lein with-profile cljremotetest test :all + - cd /home/who/git/nginx-clojure/test/nginx-working-dir + - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-coroutine.conf -s stop after_failure: - echo "******************************** Test Failed (Start of Nginx error.log)*****************" diff --git a/nginx-clojure-embed/.gitignore b/nginx-clojure-embed/.gitignore index 0d5f2eb0..fa39278e 100644 --- a/nginx-clojure-embed/.gitignore +++ b/nginx-clojure-embed/.gitignore @@ -11,3 +11,4 @@ /res /ngx-memoryleak /.lein-failures +/pom.xml.asc From f182668bb447f20fb41cf1eb626fa52bf96fe5ab Mon Sep 17 00:00:00 2001 From: xfeep Date: Wed, 13 Nov 2019 13:59:51 +0800 Subject: [PATCH 2/4] ci: make integration test run in parallel --- .travis.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 44dc15f5..06369a19 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,34 +69,35 @@ jobs: - stage: unit test script: - lein with-profile unittest junit - - stage: integration test (plain mode) + - stage: integration test (plain mode|thread pool mode|coroutine mode) script: - cd /home/who/git/nginx-clojure/test/nginx-working-dir - mkdir logs temp temp/client_temp temp/fastcgi_temp temp/proxy_temp temp/scgi_temp temp/uwsgi_temp - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-plain.conf & - sleep 10 - - tail logs/error.log + - tail -f logs/error.log & - curl -v http://localhost:8080/clojure + - killall tail - cd /home/who/git/nginx-clojure/ - lein with-profile cljremotetest test :all - cd /home/who/git/nginx-clojure/test/nginx-working-dir - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-plain.conf -s stop - - stage: integration test (thread pool mode) script: - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-threadpool.conf & - sleep 10 - - tail logs/error.log + - tail -f logs/error.log & - curl -v http://localhost:8080/clojure + - killall tail - cd /home/who/git/nginx-clojure/ - lein with-profile cljremotetest test :no-async - cd /home/who/git/nginx-clojure/test/nginx-working-dir - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-threadpool.conf -s stop - - stage: integration test (coroutine mode) script: - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-coroutine.conf & - sleep 30 - - tail logs/error.log + - tail -f logs/error.log & - curl -v http://localhost:8080/clojure + - killall tail - cd /home/who/git/nginx-clojure/ - lein with-profile cljremotetest test :all - cd /home/who/git/nginx-clojure/test/nginx-working-dir @@ -109,3 +110,8 @@ after_failure: notifications: email: false + +branches: + only: + - master + - stable From ca9fccdc1cac32b18f63a9c53e1687e4d3f65735 Mon Sep 17 00:00:00 2001 From: xfeep Date: Wed, 13 Nov 2019 14:18:22 +0800 Subject: [PATCH 3/4] ci: fix stage name --- .travis.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 06369a19..60d390da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,6 +59,8 @@ before_script: - cd ${NGX_SRC} && ./configure --with-http_v2_module --with-select_module --with-http_ssl_module --with-ipv6 --with-http_geoip_module --with-http_auth_request_module --with-debug --add-module=${NC_PJ_HOME}/src/c --with-http_stub_status_module --prefix= --sbin-path=nginx --conf-path=conf/nginx.conf --error-log-path=logs/error.log --http-log-path=logs/access.log --pid-path=logs/nginx.pid --lock-path=logs/nginx.lock --http-client-body-temp-path=temp/client_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --http-uwsgi-temp-path=temp/uwsgi_temp --http-scgi-temp-path=temp/scgi_temp - make - cp objs/nginx ${NC_PJ_HOME}/test/nginx-working-dir + - cd /home/who/git/nginx-clojure/test/nginx-working-dir + - mkdir logs temp temp/client_temp temp/fastcgi_temp temp/proxy_temp temp/scgi_temp temp/uwsgi_temp - cd /home/who/git/nginx-clojure/ - mkdir bin - lein with-profile +cljremotetest classpath @@ -69,10 +71,9 @@ jobs: - stage: unit test script: - lein with-profile unittest junit - - stage: integration test (plain mode|thread pool mode|coroutine mode) + - stage: integration test script: - cd /home/who/git/nginx-clojure/test/nginx-working-dir - - mkdir logs temp temp/client_temp temp/fastcgi_temp temp/proxy_temp temp/scgi_temp temp/uwsgi_temp - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-plain.conf & - sleep 10 - tail -f logs/error.log & @@ -81,8 +82,10 @@ jobs: - cd /home/who/git/nginx-clojure/ - lein with-profile cljremotetest test :all - cd /home/who/git/nginx-clojure/test/nginx-working-dir - - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-plain.conf -s stop + - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-plain.conf -s stop + - # stage name not required, will continue to use `integration test` script: + - cd /home/who/git/nginx-clojure/test/nginx-working-dir - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-threadpool.conf & - sleep 10 - tail -f logs/error.log & @@ -92,7 +95,9 @@ jobs: - lein with-profile cljremotetest test :no-async - cd /home/who/git/nginx-clojure/test/nginx-working-dir - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-threadpool.conf -s stop + - # stage name not required, will continue to use `integration test` script: + - cd /home/who/git/nginx-clojure/test/nginx-working-dir - ./nginx -c /home/who/git/nginx-clojure/test/nginx-working-dir/conf/nginx-coroutine.conf & - sleep 30 - tail -f logs/error.log & From 96e7a81d594a43b3c5932bccad1d95bc3fff5bbc Mon Sep 17 00:00:00 2001 From: xfeep Date: Wed, 13 Nov 2019 14:30:37 +0800 Subject: [PATCH 4/4] ci: compile test classes before test --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 60d390da..8e81eaa3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,7 +64,8 @@ before_script: - cd /home/who/git/nginx-clojure/ - mkdir bin - lein with-profile +cljremotetest classpath - - lein install + - lein install + - lein with-profile unittest junit compile jobs: include: