forked from crainte/terraform-provider-resty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakefile
39 lines (30 loc) · 1.1 KB
/
GNUmakefile
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
VERSION=0.0.7
TEST?=$$(go list ./...)
GOFMT_FILES?=$$(gofmt -l `find . -name '*.go'`)
default: build
build: fmtcheck
go build -o build/bin/terraform-provider-resty
release: fmtcheck
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/bin/terraform-provider-resty_$(VERSION)-linux-amd64
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/bin/terraform-provider-resty_$(VERSION)-darwin-amd64
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o build/bin/terraform-provider-resty_$(VERSION)-darwin-arm64
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o build/bin/terraform-provider-resty_$(VERSION)-windows-amd64
test: fmtcheck
@go test -i $(TEST) || exit 1
@echo " >> Running tests"
@go test -v $(TEST)
gotest: fmtcheck
@gotestsum --format testname $(TEST)
fmt:
gofmt -w $(GOFMT_FILES)
fmtcheck:
@echo " >> Checking that code follows gofmt"
ifeq ($(GOFMT_FILES),)
@echo "gofmt needs to be run on the following files:"
@echo "$(GOFMT_FILES)"
@echo "You can use the command 'make fmt' to reformat code."
@exit 1
endif
clean:
rm build/bin/*
.PHONY: build release test gotest fmt fmtcheck clean