-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
55 lines (46 loc) · 1.59 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
OUTPUT_DIR?=/usr/local/bin
PACKAGE_NAME := github.com/turbot/powerpipe
GOLANG_CROSS_VERSION ?= v1.22.4
.PHONY: build
build:
$(eval MAJOR := $(shell cat internal/version/version.json | jq '.major'))
$(eval MINOR := $(shell cat internal/version/version.json | jq '.minor'))
$(eval PATCH := $(shell cat internal/version/version.json | jq '.patch'))
$(eval TIMESTAMP := $(shell date +%Y%m%d%H%M%S))
go build -o $(OUTPUT_DIR) -ldflags "-X main.version=$(MAJOR).$(MINOR).$(PATCH)-dev.$(TIMESTAMP)" .
dashboard_assets:
$(MAKE) -C ui/dashboard
.PHONY: all
all:
$(MAKE) build
$(MAKE) dashboard_assets
.PHONY: release-dry-run
release-dry-run:
@docker run \
--rm \
-e CGO_ENABLED=1 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/powerpipe \
-v `pwd`/../pipe-fittings:/go/src/pipe-fittings \
-w /go/src/powerpipe \
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
--clean --skip=validate --skip=publish --snapshot
.PHONY: release
release:
@if [ ! -f ".release-env" ]; then \
echo ".release-env is required for release";\
exit 1;\
fi
docker run \
--rm \
-e CGO_ENABLED=1 \
--env-file .release-env \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/powerpipe \
-v `pwd`/../pipe-fittings:/go/src/pipe-fittings \
-w /go/src/powerpipe \
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
release --clean --skip=validate
# Run the test generator to create the acceptance tests(update the paths in main function in tests/acceptance/test_generator/generate.go)
build-tests:
go run tests/acceptance/test_generator/generate.go