Merge pull request #2809 from yousong/feature/yousong-circleci-check

.circleci: 构建前check
This commit is contained in:
Yousong Zhou
2019-09-09 17:52:45 +08:00
committed by GitHub
3 changed files with 51 additions and 9 deletions
+16
View File
@@ -3,7 +3,20 @@
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2
jobs:
check:
docker:
- image: yunionio/onecloud-ci:v1.0.2
environment:
ONECLOUD_CI_BUILD: "1"
working_directory: /home/build/go/src/yunion.io/x/onecloud
steps:
- checkout
- run:
command: |
make check
build:
requires:
- check
docker:
- image: yunionio/onecloud-ci:v1.0.2
environment:
@@ -35,6 +48,8 @@ jobs:
path: _output/
test:
requires:
- check
docker:
- image: yunionio/onecloud-ci:v1.0.2
environment:
@@ -59,5 +74,6 @@ workflows:
version: 2
build_and_test:
jobs:
- check
- build
- test
+34 -9
View File
@@ -74,9 +74,6 @@ install: prepare_dir
done
gendoc:
@sh build/gendoc.sh
gencopyright:
@sh scripts/gencopyright.sh pkg cmd
@@ -86,16 +83,16 @@ test:
vet:
go vet ./...
cmd/%: prepare_dir fmt
cmd/%: prepare_dir
$(GO_BUILD) -o $(BIN_DIR)/$(shell basename $@) $(REPO_PREFIX)/$@
rpm/%: cmd/%
$(BUILD_SCRIPT) $*
pkg/%: prepare_dir fmt
pkg/%: prepare_dir
$(GO_INSTALL) $(REPO_PREFIX)/$@
build: gendoc
build:
$(MAKE) $(cmdTargets)
rpm:
@@ -115,7 +112,7 @@ output_dir:
@mkdir -p $(BUILD_DIR)
.PHONY: all build prepare_dir clean fmt rpm
.PHONY: all build prepare_dir clean rpm
clean:
@@ -123,8 +120,36 @@ clean:
fmt:
@$(if $(ONECLOUD_CI_BUILD),:,find) . -type f -name "*.go" -not -path "./_output/*" \
-not -path "./vendor/*" | xargs $(XARGS_FLAGS) gofmt -s -w
@git ls-files --exclude '*' '*.go' \
| grep -v '^vendor/' \
| xargs $(XARGS_FLAGS) gofmt -w
fmt-check: fmt
@if git status --short | grep -E '^.M .*/[^.]+.go'; then \
echo "$@: working tree modified (possibly by gofmt)" >&2 ; \
false ; \
fi
.PHONY: fmt fmt-check
gendocgo:
@sh build/gendoc.sh
cleandocgo:
@git ls-files --others '*/doc.go' | xargs $(XARGS_FLAGS) -- rm -vf
gendocgo-check: gendocgo
@n="$$(git ls-files --others '*/doc.go' | wc -l)"; \
if test "$$n" -gt 0; then \
git ls-files --others '*/doc.go' | sed -e 's/^/ /'; \
echo "$@: untracked doc.go file(s) exist in working directory" >&2 ; \
false ; \
fi
.PHONY: gendocgo cleandocgo gendocgo-check
check: fmt-check
check: gendocgo-check
.PHONY: check
define depDeprecated
OneCloud now requires using go-mod for dependency management. dep target,
+1
View File
@@ -0,0 +1 @@
package cas // import "yunion.io/x/onecloud/pkg/keystone/driver/cas"