Skip to content

Commit

Permalink
feature: add circleci parrallism testing to split unit-test and code-…
Browse files Browse the repository at this point in the history
…check

Signed-off-by: Allen Sun <allensun.shl@alibaba-inc.com>
  • Loading branch information
allencloud committed Apr 3, 2018
1 parent 70f9731 commit 3057627
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 15 deletions.
51 changes: 37 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2
jobs:
build:
markdown-lint-docs:
docker:
# specify the version
- image: allencloud/mdl:v0.4
Expand All @@ -24,18 +24,41 @@ jobs:
# specify any bash command here prefixed with `run: `
- run:
name: use markdownlint v0.4.0 to lint markdown file (https://github.com/markdownlint/markdownlint)
command: find ./ -name "*.md" | grep -v vendor | grep -v extra | grep -v commandline | grep -v .github | grep -v swagger | grep -v api | xargs mdl -r ~MD013,~MD024,~MD029,~MD033,~MD036
- run:
name: run unit test with coverage
command: |
cd /tmp/pouchbuild/src/github.com/alibaba/pouch
go test -i
for d in `go list ./... | grep -v 'github.com/alibaba/pouch/test' | grep -v 'github.com/alibaba/pouch/extra' | grep -v 'github.com/alibaba/pouch/vendor' `
do
go test -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ] ; then
cat profile.out >> coverage.txt
rm profile.out >/dev/null 2>&1
fi
done
find ./ -name "*.md" | grep -v vendor | grep -v extra | grep -v commandline | grep -v .github | grep -v swagger | grep -v api | xargs mdl -r ~MD013,~MD024,~MD029,~MD033,~MD036
code-check:
docker:
- image: golang:1.9.1
working_directory: /go/src/github.com/{{ORG_NAME}}/{{REPO_NAME}}
steps:
- checkout
- run:
name: install golint
command: go get github.com/golang/lint/golint
- run:
name: install swagger-0.12.0
command: |
wget --quiet -O /bin/swagger https://github.com/go-swagger/go-swagger/releases/download/0.12.0/swagger_linux_amd64
chmod +x /bin/swagger
- run:
name: use check target in Makefile to check code
command: make check

unit-test:
docker:
- image: golang:1.9.1
working_directory: /go/src/github.com/{{ORG_NAME}}/{{REPO_NAME}}
steps:
- checkout
- run:
name: unit test
command: make unit-test

workflows:
version: 2
ci:
jobs:
- markdown-lint-docs
- code-check
- unit-test
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ cri-test:

.PHONY: test
test:
@bash -c "env PATH=$(PATH) hack/make.sh check build unit-test integration-test cri-test"
@bash -c "env PATH=$(PATH) hack/make.sh build integration-test cri-test"

0 comments on commit 3057627

Please sign in to comment.