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

CI: collect golang unit test code coverage #654

Merged
merged 8 commits into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from 4 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
17 changes: 14 additions & 3 deletions .github/workflows/test-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./...
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
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,18 @@
# limitations under the License.
#

export GO111MODULE=on

### license-check: Check apisix-dashboard source codes for Apache License
.PHONY: license-check
license-check:
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 ./
.actions/openwhisk-utilities/scancode/scanCode.py --config .actions/ASF-Release.cfg ./


.PHONY: api-test
api-test:
cd api/ && go test -v -race -cover -coverprofile=coverage.txt -covermode=atomic ./...