-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGNUmakefile
35 lines (27 loc) · 1.28 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
.PHONY: all build deps generate help test openapi_generate
SWAGGER_SPEC=swagger.yml
help: ## Show this help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
all: deps openapi_generate generate test testacc # build
build: ## Build Terraform provider.
go install .
deps: ## Install dependencies.
go mod download
generate: ## Generate Terraform docs.
go generate
openapi_generate: ## Generate the go code from the OpenAPI spec.
docker run --rm \
-v ${PWD}:/local openapitools/openapi-generator-cli generate \
--additional-properties=disallowAdditionalPropertiesIfNotPresent=false,isGoSubmodule=true,packageName=netlifyapi,withGoMod=false \
--global-property apiDocs=false,modelDocs=false,apiTests=false,modelTests=false \
-i /local/openapi.json \
-g go \
-o /local/internal/netlifyapi ; \
sed -i '' 's/int32/int64/g' internal/netlifyapi/model_*.go ; \
sed -i '' 's/int32/int64/g' internal/netlifyapi/api_*.go ; \
sed -i '' 's/return e.error/return fmt.Sprintf("%s: %s", e.error, e.body)/g' internal/netlifyapi/client.go
test: ## Test the go code.
go test -v ./...
testacc: ## Test the go code and run acceptance tests.
TF_ACC=1 go test ./... -v $(TESTARGS)
# -timeout 120m