forked from transcend-io/terragrunt-atlantis-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (58 loc) · 1.49 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
VERSION=1.21.6
PATH_BUILD=build/
FILE_COMMAND=terragrunt-atlantis-config
FILE_ARCH=$(shell go env GOOS)_$(shell go env GOARCH)
# Determine the arch/os combos we're building for
XC_ARCH=amd64 arm64
XC_OS=linux darwin windows
.PHONY: clean
clean:
rm -rf ./build
rm -rf "$(HOME)/.local/bin/$(FILE_COMMAND)"
.PHONY: build
build: clean
CGO_ENABLED=0 \
go build \
-trimpath \
-mod=readonly \
-modcacherw \
-ldflags "-X main.VERSION=$(VERSION)" \
-o $(PATH_BUILD)$(VERSION)/$(FILE_COMMAND)_$(VERSION)_$(FILE_ARCH)
.PHONY: build-all
build-all: clean
for arch in $(XC_ARCH); do \
for os in $(XC_OS); do \
echo "Building for '$$os/$$arch'" ; \
ext="" ; [ "$$os" = "windows" ] && ext=".exe" ; \
CGO_ENABLED=0 \
GOARCH=$$arch \
GOOS=$$os \
go build \
-trimpath \
-mod=readonly \
-modcacherw \
-ldflags "-X main.VERSION=$(VERSION)" \
-o $(PATH_BUILD)$(VERSION)/$(FILE_COMMAND)_$(VERSION)_$${os}_$${arch}$${ext} ; \
done \
done
.PHONY: gotestsum
gotestsum:
mkdir -p cmd/test_artifacts
gotestsum
rm -rf cmd/test_artifacts
.PHONY: test
test:
mkdir -p cmd/test_artifacts
go test -v ./...
rm -rf cmd/test_artifacts
.PHONY: version
version:
@echo $(VERSION)
.PHONY: sign
sign: build-all
rm -f $(PATH_BUILD)$(VERSION)/SHA256SUMS
shasum -a256 $(PATH_BUILD)$(VERSION)/* > $(PATH_BUILD)$(VERSION)/SHA256SUMS
.PHONY: install
install:
install -d -m 755 '$(HOME)/.local/bin/'
install $(PATH_BUILD)$(VERSION)/$(FILE_COMMAND)_$(VERSION)_$(FILE_ARCH) '$(HOME)/.local/bin/$(FILE_COMMAND)'