diff --git a/.circleci/config.yml b/.circleci/config.yml index 30a5c5344f..6bf16e749e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 @@ -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