This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git
View the commit online: https://github.com/apache/incubator-apisix/commit/227eeaef48cce77a7ee7f44c4ebbe79c56ecbf65 The following commit(s) were added to refs/heads/master by this push: new 227eeae Split check target into lint & license-check targets in Makefile. (#887) 227eeae is described below commit 227eeaef48cce77a7ee7f44c4ebbe79c56ecbf65 Author: agile6v <agil...@agile6v.com> AuthorDate: Wed Nov 20 19:23:16 2019 -0600 Split check target into lint & license-check targets in Makefile. (#887) --- .travis/linux_openresty_runner.sh | 2 +- .travis/linux_tengine_runner.sh | 2 +- Makefile | 41 ++++++++++++++++++++++++--------------- doc/dev-manual-cn.md | 23 +++++++++++----------- doc/dev-manual.md | 23 +++++++++++----------- 5 files changed, 51 insertions(+), 40 deletions(-) diff --git a/.travis/linux_openresty_runner.sh b/.travis/linux_openresty_runner.sh index 872a744..251b288 100755 --- a/.travis/linux_openresty_runner.sh +++ b/.travis/linux_openresty_runner.sh @@ -123,7 +123,7 @@ script() { ./bin/apisix stop sleep 1 - make check || exit 1 + make lint && make license-check || exit 1 APISIX_ENABLE_LUACOV=1 prove -Itest-nginx/lib -r t } diff --git a/.travis/linux_tengine_runner.sh b/.travis/linux_tengine_runner.sh index 4cdb12b..a058667 100755 --- a/.travis/linux_tengine_runner.sh +++ b/.travis/linux_tengine_runner.sh @@ -195,7 +195,7 @@ script() { sleep 1 ./bin/apisix stop sleep 1 - make check || exit 1 + make lint && make license-check || exit 1 APISIX_ENABLE_LUACOV=1 prove -Itest-nginx/lib -r t } diff --git a/Makefile b/Makefile index 06e8fef..8112520 100644 --- a/Makefile +++ b/Makefile @@ -24,14 +24,13 @@ UNAME ?= $(shell uname) OR_EXEC ?= $(shell which openresty) LUA_JIT_DIR ?= $(shell ${OR_EXEC} -V 2>&1 | grep prefix | grep -Eo 'prefix=(.*?)/nginx' | grep -Eo '/.*/')luajit LUAROCKS_VER ?= $(shell luarocks --version | grep -E -o "luarocks [0-9]+.") -lj-releng-exist = $(shell if [ -f 'utils/lj-releng' ]; then echo "exist"; else echo "not_exist"; fi;) .PHONY: default default: -### help: Show Makefile rules. +### help: Show Makefile rules. .PHONY: help help: @echo Makefile rules: @@ -39,7 +38,7 @@ help: @grep -E '^### [-A-Za-z0-9_]+:' Makefile | sed 's/###/ /' -### deps: Installation dependencies +### deps: Installation dependencies .PHONY: deps deps: ifeq ($(UNAME),Darwin) @@ -51,19 +50,18 @@ else endif -### utils: Installation tools +### utils: Installation tools .PHONY: utils utils: -ifeq ($(lj-releng-exist), not_exist) +ifeq ("$(wildcard utils/lj-releng)", "") wget -O utils/lj-releng https://raw.githubusercontent.com/iresty/openresty-devel-utils/iresty/lj-releng chmod a+x utils/lj-releng endif -### check: Check Lua source code -.PHONY: check -check: - .travis/openwhisk-utilities/scancode/scanCode.py --config .travis/ASF-Release.cfg ./ +### lint: Lint Lua source code +.PHONY: lint +lint: utils luacheck -q lua ./utils/lj-releng lua/*.lua \ lua/apisix/*.lua \ @@ -77,14 +75,14 @@ check: /tmp/check.log 2>&1 || (cat /tmp/check.log && exit 1) -### init: Initialize the runtime environment +### init: Initialize the runtime environment .PHONY: init init: ./bin/apisix init ./bin/apisix init_etcd -### run: Start the apisix server +### run: Start the apisix server .PHONY: run run: mkdir -p logs @@ -96,7 +94,7 @@ endif $(OR_EXEC) -p $$PWD/ -c $$PWD/conf/nginx.conf -### stop: Stop the apisix server +### stop: Stop the apisix server .PHONY: stop stop: ifeq ($(OR_EXEC), ) @@ -106,13 +104,13 @@ endif $(OR_EXEC) -p $$PWD/ -c $$PWD/conf/nginx.conf -s stop -### clean: Remove generated files +### clean: Remove generated files .PHONY: clean clean: rm -rf logs/ -### reload: Reload the apisix server +### reload: Reload the apisix server .PHONY: reload reload: ifeq ($(OR_EXEC), ) @@ -122,7 +120,7 @@ endif $(OR_EXEC) -p $$PWD/ -c $$PWD/conf/nginx.conf -s reload -### install: Install the apisix +### install: Install the apisix .PHONY: install install: $(INSTALL) -d /usr/local/apisix/logs/ @@ -174,10 +172,21 @@ install: $(INSTALL) bin/apisix $(INST_BINDIR)/apisix -### test: Run the test case +### test: Run the test case test: ifeq ($(UNAME),Darwin) prove -I../test-nginx/lib -I./ -r -s t/ else prove -I../test-nginx/lib -r -s t/ endif + + +### license-check: Check Lua source code for Apache License +.PHONY: license-check +license-check: +ifeq ("$(wildcard .travis/openwhisk-utilities/scancode/scanCode.py)", "") + git clone https://github.com/apache/openwhisk-utilities.git .travis/openwhisk-utilities + cp .travis/ASF* .travis/openwhisk-utilities/scancode/ +endif + .travis/openwhisk-utilities/scancode/scanCode.py --config .travis/ASF-Release.cfg ./ + diff --git a/doc/dev-manual-cn.md b/doc/dev-manual-cn.md index 5675968..607c651 100644 --- a/doc/dev-manual-cn.md +++ b/doc/dev-manual-cn.md @@ -100,17 +100,18 @@ $ make stop $ make help Makefile rules: - help: Show Makefile rules. - deps: Installation dependencies - utils: Installation utils - check: Check Lua source code - init: Initialize the runtime environment - run: Start the apisix server - stop: Stop the apisix server - clean: Remove generated files - reload: Reload the apisix server - install: Install the apisix - test: Run the test case + help: Show Makefile rules. + deps: Installation dependencies + utils: Installation tools + lint: Lint Lua source code + init: Initialize the runtime environment + run: Start the apisix server + stop: Stop the apisix server + clean: Remove generated files + reload: Reload the apisix server + install: Install the apisix + test: Run the test case + license-check: Check lua souce code for Apache License ``` ## 运行测试案例 diff --git a/doc/dev-manual.md b/doc/dev-manual.md index a423d9d..4aed7dc 100644 --- a/doc/dev-manual.md +++ b/doc/dev-manual.md @@ -100,17 +100,18 @@ $ make stop $ make help Makefile rules: - help: Show Makefile rules. - deps: Installation dependencies - utils: Installation utils - check: Check Lua source code - init: Initialize the runtime environment - run: Start the apisix server - stop: Stop the apisix server - clean: Remove generated files - reload: Reload the apisix server - install: Install the apisix - test: Run the test case + help: Show Makefile rules. + deps: Installation dependencies + utils: Installation tools + lint: Lint Lua source code + init: Initialize the runtime environment + run: Start the apisix server + stop: Stop the apisix server + clean: Remove generated files + reload: Reload the apisix server + install: Install the apisix + test: Run the test case + license-check: Check lua souce code for Apache License ``` ## Test