forked from GoogleCloudPlatform/terraform-validator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (27 loc) · 1.11 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
PLATFORMS := linux windows darwin
BUILD_DIR=./bin
NAME=terraform-validator
RELEASE_BUCKET=terraform-validator
DATE=`date +%Y-%m-%d`
LDFLAGS="-X github.com/GoogleCloudPlatform/terraform-validator/tfgcv.buildVersion=${DATE}"
test:
# Skip integration tests in ./test/ using -short flag
GO111MODULE=on go test -short ./...
run-docker:
docker run -it -v `pwd`:/terraform-validator -v ${GOOGLE_APPLICATION_CREDENTIALS}:/terraform-validator/credentials.json --entrypoint=/bin/bash --env TEST_PROJECT=${PROJECT_ID} --env TEST_CREDENTIALS=./credentials.json terraform-validator;
test-integration:
go version
terraform --version
go test -v -run=CLI ./test
build-docker:
docker build -f ./Dockerfile -t terraform-validator .
build:
GO111MODULE=on go build -ldflags ${LDFLAGS} -o ${BUILD_DIR}/${NAME}
release: $(PLATFORMS)
publish:
gsutil cp ${BUILD_DIR}/*-amd64 gs://${RELEASE_BUCKET}/releases/${DATE}
$(PLATFORMS):
GO111MODULE=on GOOS=$@ GOARCH=amd64 CGO_ENABLED=0 go build -ldflags ${LDFLAGS} -o "${BUILD_DIR}/${NAME}-$@-amd64" .
clean:
rm bin/${NAME}*
.PHONY: test test-e2e build build-docker release $(PLATFORMS) clean publish