You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2021/05/10 03:10:09 UTC

[apisix] branch master updated: ci: move code lint to separate job (#4204)

This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new cc577d2  ci: move code lint to separate job (#4204)
cc577d2 is described below

commit cc577d26989f6a11980cee89324cad604815b65c
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Mon May 10 11:09:59 2021 +0800

    ci: move code lint to separate job (#4204)
---
 .github/workflows/code-lint.yml     | 28 ++++++++++++++++++++++++++++
 ci/linux_openresty_common_runner.sh | 12 +-----------
 ci/linux_openresty_mtls_runner.sh   | 12 +-----------
 ci/linux_tengine_runner.sh          | 12 +-----------
 4 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/.github/workflows/code-lint.yml b/.github/workflows/code-lint.yml
new file mode 100644
index 0000000..60dde7f
--- /dev/null
+++ b/.github/workflows/code-lint.yml
@@ -0,0 +1,28 @@
+name: Code Lint
+
+on:
+  pull_request:
+    branches: [master]
+    paths-ignore:
+      - 'docs/**'
+
+jobs:
+  lint:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - name: Install
+      run: |
+        . ./ci/common.sh
+        export_or_prefix
+        export OPENRESTY_VERSION=default
+
+        ./utils/linux-install-openresty.sh
+        sudo ./utils/linux-install-luarocks.sh
+        sudo luarocks install luacheck
+
+    - name: Script
+      run: |
+        . ./ci/common.sh
+        export_or_prefix
+        make lint
diff --git a/ci/linux_openresty_common_runner.sh b/ci/linux_openresty_common_runner.sh
index b2aff0e..e0e597c 100755
--- a/ci/linux_openresty_common_runner.sh
+++ b/ci/linux_openresty_common_runner.sh
@@ -31,16 +31,6 @@ do_install() {
 
     ./utils/linux-install-luarocks.sh
 
-    for (( i = 0; i < 10; i++ )); do
-        if [[ "$i" -eq 10 ]]; then
-            echo "failed to install luacheck in time"
-            cat build.log && exit 1
-            exit 1
-        fi
-        sudo luarocks install luacheck > build.log 2>&1 && break
-        i=$(( i + 1 ))
-    done
-
     ./utils/linux-install-etcd-client.sh
 
     create_lua_deps
@@ -129,7 +119,7 @@ apisix:
 
     sudo bash ./utils/check-plugins-code.sh
 
-    make lint && make license-check || exit 1
+    make license-check || exit 1
 
     # APISIX_ENABLE_LUACOV=1 PERL5LIB=.:$PERL5LIB prove -Itest-nginx/lib -r t
     FLUSH_ETCD=1 PERL5LIB=.:$PERL5LIB prove -Itest-nginx/lib -r t
diff --git a/ci/linux_openresty_mtls_runner.sh b/ci/linux_openresty_mtls_runner.sh
index c1fb063..47c014d 100755
--- a/ci/linux_openresty_mtls_runner.sh
+++ b/ci/linux_openresty_mtls_runner.sh
@@ -29,16 +29,6 @@ do_install() {
 
     ./utils/linux-install-luarocks.sh
 
-    for (( i = 0; i < 10; i++ )); do
-        if [[ "$i" -eq 10 ]]; then
-            echo "failed to install luacheck in time"
-            cat build.log && exit 1
-            exit 1
-        fi
-        sudo luarocks install luacheck > build.log 2>&1 && break
-        i=$(( i + 1 ))
-    done
-
     ./utils/linux-install-etcd-client.sh
 
     create_lua_deps
@@ -122,7 +112,7 @@ apisix:
     ./bin/apisix stop
     sleep 1
 
-    make lint && make license-check || exit 1
+    make license-check || exit 1
 }
 
 after_success() {
diff --git a/ci/linux_tengine_runner.sh b/ci/linux_tengine_runner.sh
index 0f8cbd2..9c1271c 100755
--- a/ci/linux_tengine_runner.sh
+++ b/ci/linux_tengine_runner.sh
@@ -205,16 +205,6 @@ do_install() {
 
     create_lua_deps
 
-    for (( i = 0; i < 10; i++ )); do
-        if [[ "$i" -eq 10 ]]; then
-            echo "failed to install luacheck in time"
-            cat build.log && exit 1
-            exit 1
-        fi
-        sudo luarocks install luacheck > build.log 2>&1 && break
-        i=$(( i + 1 ))
-    done
-
     ./utils/linux-install-etcd-client.sh
 
     git clone https://github.com/iresty/test-nginx.git test-nginx
@@ -241,7 +231,7 @@ script() {
     sleep 1
     ./bin/apisix stop
     sleep 1
-    make lint && make license-check || exit 1
+    make license-check || exit 1
     # APISIX_ENABLE_LUACOV=1 PERL5LIB=.:$PERL5LIB prove -Itest-nginx/lib -r t
 }