1
0
Fork 0

🔀 Merge branch 'feature/pipeline-tweaks' into 'develop'

* enable go module support in pipeline
This commit is contained in:
Maxim Lebedev 2019-08-21 18:26:23 +00:00
commit 5f0d7efc61
3 changed files with 25 additions and 17 deletions

7
.gitignore vendored
View File

@ -24,4 +24,9 @@ _testmain.go
*.prof
ffjson-inception*
*_ffjson_expose.go
*_ffjson_expose.go
.DS_Store
# IDE stuff
.idea/

View File

@ -1,17 +1,25 @@
image: golang:alpine
variables:
GO111MOD: "on"
CGO_ENABLED: "0"
GOOS: "linux"
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- /var/cache/apk
- /go/pkg/mod
stages:
- test
- review
before_script:
- apk add --no-cache git build-base bash make
- mkdir -p /go/src/gitlab.com/$CI_PROJECT_NAMESPACE /go/src/_/builds
- cp -r $CI_PROJECT_DIR /go/src/gitlab.com/$CI_PROJECT_PATH
- ln -s /go/src/gitlab.com/$CI_PROJECT_NAMESPACE /go/src/_/builds/$CI_PROJECT_NAMESPACE
- apk add --no-cache git make
- go get github.com/golangci/golangci-lint/cmd/golangci-lint
- go install github.com/golangci/golangci-lint/cmd/golangci-lint
- make dep
- make tidy
unit_tests:
stage: test

View File

@ -1,14 +1,9 @@
PROJECT_NAMESPACE := $(CI_PROJECT_NAMESPACE)
PROJECT_NAME := $(CI_PROJECT_NAME)
PROJECT_PATH := "$(PROJECT_NAMESPACE)/$(PROJECT_NAME)"
PACKAGE_NAME := "gitlab.com/$(PROJECT_PATH)"
PACKAGE_PATH := "$(GOPATH)/src/$(PACKAGE_NAME)"
PACKAGE_NAME := "gitlab.com/toby3d/telegram"
PACKAGE_LIST := $(shell go list $(PACKAGE_NAME)/... | grep -v /vendor/)
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)
.PHONY: all lint test rase coverage dep
.PHONY: all lint test rase coverage tidy
all: dep test race lint
all: tidy test race lint
lint: ## Lint the files
@golangci-lint run ./...
@ -16,14 +11,14 @@ lint: ## Lint the files
test: ## Run unittests
@go test -short $(PACKAGE_NAME)/...
race: dep ## Run data race detector
race: tidy ## Run data race detector
@go test -race -short ${PACKAGE_LIST}
coverage: ## Generate global code coverage report
@go test -cover -v -coverpkg=$(PACKAGE_NAME)/... ${PACKAGE_LIST}
dep: ## Get the dependencies
@go get -v -d -t $(PACKAGE_NAME)/...
tidy: ## Get the dependencies
@go mod tidy
help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'