diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 4e65e23..0000000 --- a/.drone.yml +++ /dev/null @@ -1,25 +0,0 @@ -image: clever/drone-go:1.7 -notify: - email: - recipients: - - drone@clever.com - slack: - on_failure: true - on_started: false - on_success: false - webhook_url: $$slack_webhook -publish: - github: - artifacts: - - release - repo: csvlint - script: - - make release - tag: v$(cat VERSION) - token: $$github_token - user: Clever - when: - branch: master - report_card: {} -script: -- make test diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000..5da3ce2 --- /dev/null +++ b/circle.yml @@ -0,0 +1,22 @@ +machine: + post: + - cd $HOME && git clone --depth 1 -v git@github.com:clever/ci-scripts.git && cd ci-scripts && git show --oneline -s + - $HOME/ci-scripts/circleci/golang-install 1.7 + services: + - docker +checkout: + post: + - $HOME/ci-scripts/circleci/golang-move-project +test: + override: + - make test + post: + - $HOME/ci-scripts/circleci/report-card $RC_DOCKER_USER $RC_DOCKER_PASS "$RC_DOCKER_EMAIL" $RC_GITHUB_TOKEN +deployment: + all: + branch: master + owner: Clever + commands: + - make release && $HOME/ci-scripts/circleci/github-release $GH_RELEASE_TOKEN release +general: + build_dir: ../.go_workspace/src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME diff --git a/golang.mk b/golang.mk index 8a6e106..65b4451 100644 --- a/golang.mk +++ b/golang.mk @@ -1,10 +1,13 @@ # This is the default Clever Golang Makefile. # Please do not alter this file directly. -GOLANG_MK_VERSION := 0.1.0 +GOLANG_MK_VERSION := 0.1.3 SHELL := /bin/bash .PHONY: golang-godep-vendor golang-test-deps $(GODEP) +# if the gopath includes several directories, use only the first +GOPATH=$(shell echo $$GOPATH | cut -d: -f1) + # This block checks and confirms that the proper Go toolchain version is installed. # arg1: golang version define golang-version-check @@ -63,7 +66,7 @@ golang-lint-deps: $(GOLINT) # arg1: pkg path define golang-lint @echo "LINTING $(1)..." -@$(GOLINT) $(GOPATH)/src/$(1)/*.go +@find $(GOPATH)/src/$(1)/*.go -type f | grep -v gen_ | xargs $(GOLINT) endef # golang-lint-deps-strict requires the golint tool for golang linting. @@ -74,7 +77,7 @@ golang-lint-deps-strict: $(GOLINT) $(FGT) # arg1: pkg path define golang-lint-strict @echo "LINTING $(1)..." -@$(FGT) $(GOLINT) $(GOPATH)/src/$(1)/*.go +@find $(GOPATH)/src/$(1)/*.go -type f | grep -v gen_ | xargs $(FGT) $(GOLINT) endef # golang-test-deps is here for consistency @@ -131,3 +134,8 @@ $(call golang-lint-strict,$(1)) $(call golang-vet,$(1)) $(call golang-test-strict,$(1)) endef + +# golang-update-makefile downloads latest version of golang.mk +golang-update-makefile: + @wget https://raw.githubusercontent.com/Clever/dev-handbook/master/make/golang.mk -O /tmp/golang.mk 2>/dev/null + @if ! grep -q $(GOLANG_MK_VERSION) /tmp/golang.mk; then cp /tmp/golang.mk golang.mk && echo "golang.mk updated"; else echo "golang.mk is up-to-date"; fi