-
Notifications
You must be signed in to change notification settings - Fork 7
/
GNUmakefile
64 lines (46 loc) · 1.57 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
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
TEST?=$$(go list ./...)
PKG_NAME=jupiterone
DIR=~/.terraform.d/plugins
JUPITERONE_ACCOUNT_ID?=fake
JUPITERONE_API_KEY?=fake
JUPITERONE_REGION?=fake
export JUPITERONE_ACCOUNT_ID JUPITERONE_API_KEY JUPITERONE_REGION
default: build
build: fmtcheck
go build ./...
install: fmtcheck
go install .
test:
go test $(TEST) -v $(TESTARGS) -timeout 120m
testacc: fmtcheck
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m
cassettes: fmtcheck
rm -f jupiterone/cassettes/*.yaml
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m
fmt:
@echo "==> Fixing source code with gofmt..."
gofmt -w -s .
fmtcheck:
@./scripts/fmtcheck.sh
lint:
@echo "==> Checking source code against linters..."
@golangci-lint run ./$(PKG_NAME)/...
tools:
@echo "==> installing required tooling..."
go install github.com/client9/misspell/cmd/misspell
go install github.com/golangci/golangci-lint/cmd/golangci-lint
test-compile:
@if [ "$(TEST)" = "./..." ]; then \
echo "ERROR: Set TEST to a specific package. For example,"; \
echo " make test-compile TEST=./$(PKG_NAME)"; \
exit 1; \
fi
go test -c $(TEST) $(TESTARGS)
docs:
go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
jupiterone/internal/client/schema.graphql:
@scripts/get_current_schema.bash
jupiterone/internal/client/generated.go: jupiterone/internal/client/*.graphql jupiterone/internal/client/genqlient.yaml
@go run github.com/Khan/genqlient ./jupiterone/internal/client/genqlient.yaml
generate-client: jupiterone/internal/client/generated.go
.PHONY: build test testacc cassettes fmtcheck lint tools test-compile docs