Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split check target into lint & license-check targets in Makefile. #887

Merged
merged 2 commits into from
Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis/linux_openresty_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion .travis/linux_tengine_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
41 changes: 25 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,21 @@ 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:
@echo
@grep -E '^### [-A-Za-z0-9_]+:' Makefile | sed 's/###/ /'


### deps: Installation dependencies
### deps: Installation dependencies
.PHONY: deps
deps:
ifeq ($(UNAME),Darwin)
Expand All @@ -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 \
Expand All @@ -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
Expand All @@ -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), )
Expand All @@ -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), )
Expand All @@ -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/
Expand Down Expand Up @@ -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 ./

23 changes: 12 additions & 11 deletions doc/dev-manual-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

## 运行测试案例
Expand Down
23 changes: 12 additions & 11 deletions doc/dev-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down