diff --git a/.github/workflows/test-api.yml b/.github/workflows/test-api.yml index eac166c1f3..788ed25133 100644 --- a/.github/workflows/test-api.yml +++ b/.github/workflows/test-api.yml @@ -42,14 +42,25 @@ jobs: sudo apt install golang-1.14-go - name: run test + run: | + make api-test + + - name: upload coverage profile working-directory: ./api - run: go test $(go list ./... | grep -v /e2e) + run: | + bash <(curl -s https://codecov.io/bash) - name: run with custom port working-directory: ./api run: | - sed -i 's/8080/\# 8088/' conf/conf.json - go run main.go & + export GO111MOUDULE=on + export APISIX_CONF_PATH=$PWD/conf + sed -i 's/8080/8088/' conf/conf.json + go build -o ./manager-api + ./manager-api > ./api.log 2>&1 & + sleep 2 + cat ./api.log + cat conf/conf.json - name: run with custom port working-directory: ./api diff --git a/Makefile b/Makefile index c55fedbec8..90b7a348b0 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,8 @@ # limitations under the License. # +export GO111MODULE=on + ### license-check: Check apisix-dashboard source codes for Apache License .PHONY: license-check license-check: @@ -22,4 +24,18 @@ ifeq ("$(wildcard .actions/openwhisk-utilities/scancode/scanCode.py)", "") git clone https://github.com/apache/openwhisk-utilities.git .actions/openwhisk-utilities cp .actions/ASF* .actions/openwhisk-utilities/scancode/ endif - .actions/openwhisk-utilities/scancode/scanCode.py --config .actions/ASF-Release.cfg ./ \ No newline at end of file + .actions/openwhisk-utilities/scancode/scanCode.py --config .actions/ASF-Release.cfg ./ + + +### api-test: Run the tests of manager-api +.PHONY: api-test +api-test: + cd api/ && go test -v -race -cover -coverprofile=coverage.txt -covermode=atomic ./... + + +### help: Show Makefile rules +.PHONY: help +help: default + @echo Makefile rules: + @echo + @grep -E '^### [-A-Za-z0-9_]+:' Makefile | sed 's/###/ /'