forked from odedniv/terraform-provider-sql
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
63 lines (48 loc) · 1.57 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
VERSION=1.1.2
VERSION_PARTS := $(subst ., ,$(VERSION))
MAJOR := $(word 1,$(VERSION_PARTS))
MINOR := $(word 2,$(VERSION_PARTS))
PATCH := $(word 3,$(VERSION_PARTS))
OS ?= linux
ARCH ?= amd64
PKGDIR ?= pkg
TEST ?= $$(go list ./...)
ifndef POSTGRES_DATA_SOURCE
export POSTGRES_DATA_SOURCE=postgres://postgres@/terraform_provider_sql?sslmode=disable
endif
ifndef MYSQL_DATA_SOURCE
export MYSQL_DATA_SOURCE=root@/terraform_provider_sql
endif
default: build
help:
@echo "Main commands:"
@echo " help - show this message"
@echo " build (default) - build the terraform provider"
@echo " test - runs unit tests"
@echo " testacc - runs acceptance tests"
build:
go build
test:
go test $(TEST) -v $(TESTARGS)
install:
go mod download
testacc:
TF_ACC=1 go test $(TEST) -v $(TESTARGS)
release-patch: guard
@make release PATCH=$$(( $(PATCH) + 1 ))
release-minor: guard
@make release MINOR=$$(( $(MINOR) + 1 )) PATCH=0
release-major: guard
@make release MAJOR=$$(( $(MAJOR) + 1 )) MINOR=0 PATCH=0
release: guard
@sed -i'.bak' 's/^VERSION=.*$$/VERSION=$(MAJOR).$(MINOR).$(PATCH)/' Makefile
@rm Makefile.bak
@git add Makefile
@git commit -m 'bump version to $(MAJOR).$(MINOR).$(PATCH)'
@git tag -a v$(MAJOR).$(MINOR).$(PATCH) -m 'v$(MAJOR).$(MINOR).$(PATCH)'
@git push --follow-tags
guard:
@git diff-index --quiet HEAD || (echo "There are changes in the repo, won't release. Commit everything and run this from a clean repo"; exit 1)
ifneq ($(shell echo `git branch --show-current`),master)
@echo "Releases can only be done from master" && exit 1
endif