-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (49 loc) · 1.49 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
all: depend test
SHELL := /bin/bash
.DEFAULT_GOAL := all
DIR_PATH=$(shell dirname `pwd`)
BIN_DIR=$(shell echo $${GOPATH:-~/go} | awk -F':' '{ print $$1 "/bin"}')
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
GOLANG_VERSION = 1.17.6
GINKGO=$(GOPATH)/bin/ginkgo
DEST = .
GOFLAGS :=
.PHONY: test lint goimports golangci-lint gofmt unit coverage depend set-dev set-prod
test: lint unit
lint:
$(MAKE) goimports gofmt golangci-lint
goimports:
docker run --rm -i -v "${PWD}":/data -w /data unibeautify/goimports -w -l /data
golangci-lint:
docker run --rm -v ${PWD}:/data -w /data golangci/golangci-lint golangci-lint run -v
gofmt:
docker run --rm -v ${PWD}:/data cytopia/gofmt --ci .
$(GINKGO):
go install github.com/onsi/ginkgo/v2/ginkgo@latest
unit: $(GINKGO)
ginkgo -r --keep-going --randomize-suites --randomize-all cluster dbconn gplog iohelper structmatcher conv 2>&1
coverage :
@./show_coverage.sh
depend:
go mod download
clean :
# Test artifacts
rm -rf /tmp/go-build*
rm -rf /tmp/gexec_artifacts*
rm -rf /tmp/ginkgo*
# Code coverage files
rm -rf /tmp/cover*
rm -rf /tmp/unit*
##### Pipeline targets #####
set-dev:
fly --target dev set-pipeline --check-creds \
--pipeline=dev-gp-common-go-libs-${BRANCH}-${USER} \
-c ci/pipeline.yml \
--var=branch=${BRANCH} \
--var=golang-version=${GOLANG_VERSION}
set-prod:
fly --target prod set-pipeline --check-creds \
--pipeline=gp-common-go-libs \
-c ci/pipeline.yml \
--var=branch=main\
--var=golang-version=${GOLANG_VERSION}