-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
83 lines (70 loc) · 2.62 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Currently always builds for amd64
PLATFORM_ARCH=$(shell uname -m | tr '[:upper:]' '[:lower:]' | sed 's/x86_64/amd64/')
PLATFORM_NAME=$(shell uname -s | tr '[:upper:]' '[:lower:]')
VERSION_TAG=$(shell cat .go-version)
.PHONY: build
build:
GOARCH=$(PLATFORM_ARCH) go build -o terraform-provider-lightstep_v$(VERSION_TAG)
@rm -f .terraform.lock.hcl
@mkdir -p .terraform/providers/registry.terraform.io/lightstep/lightstep/$(VERSION_TAG)/$(PLATFORM_NAME)_$(PLATFORM_ARCH)/
@cp terraform-provider-lightstep_v$(VERSION_TAG) .terraform/providers/registry.terraform.io/lightstep/lightstep/$(VERSION_TAG)/$(PLATFORM_NAME)_$(PLATFORM_ARCH)/terraform-provider-lightstep_v$(VERSION_TAG)
@mkdir -p terraform.d/plugins/terraform.lightstep.com/lightstep-org/lightstep/$(VERSION_TAG)/$(PLATFORM_NAME)_$(PLATFORM_ARCH)/
@cp terraform-provider-lightstep_v$(VERSION_TAG) terraform.d/plugins/terraform.lightstep.com/lightstep-org/lightstep/$(VERSION_TAG)/$(PLATFORM_NAME)_$(PLATFORM_ARCH)/terraform-provider-lightstep
.PHONY: install
install:
terraform init
.PHONY: check-deps
check_deps:
go mod tidy -v
.PHONY: test
test:
go test ./...
.PHONY: fmt
fmt:
go fmt
.PHONY: docs
docs: build
$(MAKE) -C tfplugindocs_working generate-schema
tfplugindocs generate --providers-schema tfplugindocs_working/schema.json
.PHONY: install-golangci-lint
install-golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.23.8
.PHONY: lint
lint:
golangci-lint run --deadline 3m0s --no-config ./...
.PHONY: acc-test
acc-test:
ifndef LIGHTSTEP_API_KEY_PUBLIC
$(error LIGHTSTEP_API_KEY_PUBLIC must be defined for acc-test)
endif
@TF_ACC=true \
LIGHTSTEP_API_RATE_LIMIT=5 \
LIGHTSTEP_API_KEY=${LIGHTSTEP_API_KEY_PUBLIC} \
LIGHTSTEP_ORG="terraform-provider" \
LIGHTSTEP_PROJECT="terraform-provider-test" \
LIGHTSTEP_API_BASE_URL="https://api.lightstep.com" \
go test -v ./lightstep
.PHONY: test-local
test-local:
@TF_ACC=true \
LIGHTSTEP_API_BASE_URL=http://localhost:11000 \
LIGHTSTEP_API_KEY=${LIGHTSTEP_LOCAL_API_KEY} \
LIGHTSTEP_ORG="terraform-provider" \
LIGHTSTEP_PROJECT="terraform-provider-test" \
LIGHTSTEP_API_RATE_LIMIT=100 \
go test -v ./lightstep -test.run TestAccSAMLGroupMappings
.PHONY: test-staging
test-staging:
@TF_ACC=true \
LIGHTSTEP_API_BASE_URL=https://api-staging.lightstep.com \
LIGHTSTEP_API_KEY=${LIGHTSTEP_STAGING_API_KEY} \
LIGHTSTEP_ORG="terraform-provider" \
LIGHTSTEP_PROJECT="terraform-provider-test" \
go test -v ./lightstep
.PHONY: ensure-clean-repo
ensure-clean-repo:
scripts/ensure_clean_repo.sh
.PHONY: clean
clean:
-rm -rf terraform.d .terraform
-rm terraform-provider-lightstep_v*