This repository has been archived by the owner on Dec 4, 2023. It is now read-only.
forked from Versent/unicreds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (57 loc) · 2.13 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
NAME=unicreds
ARCH=$(shell uname -m)
VERSION=1.7.0
GO15VENDOREXPERIMENT := 1
ITERATION := 1
test:
go test -cover -v ./...
integration:
go test -v integration/integration_test.go
compile:
@rm -rf build/
@gox -ldflags "-X main.Version=$(VERSION)" \
-osarch="darwin/amd64" \
-osarch="darwin/arm64" \
-osarch="linux/arm64" \
-osarch="linux/amd64" \
-osarch="windows/amd64" \
-output "build/{{.Dir}}_$(VERSION)_{{.OS}}_{{.Arch}}/$(NAME)" \
./...
install:
go install ./cmd/unicreds
dist: compile
$(eval FILES := $(shell ls build))
@rm -rf dist && mkdir dist
@for f in $(FILES); do \
(cd $(shell pwd)/build/$$f && tar -cvzf ../../dist/$$f.tar.gz *); \
(cd $(shell pwd)/dist && shasum -a 512 $$f.tar.gz > $$f.sha512); \
echo $$f; \
done
release: dist
@latest_tag=$$(git describe --tags `git rev-list --tags --max-count=1`); \
comparison="$$latest_tag..HEAD"; \
if [ -z "$$latest_tag" ]; then comparison=""; fi; \
changelog=$$(git log $$comparison --oneline --no-merges --reverse); \
$(GOPATH)/bin/github-release Versent/$(NAME) $(VERSION) "$$(git rev-parse --abbrev-ref HEAD)" "**Changelog**<br/>$$changelog" 'dist/*'; \
git pull
deps: go_download
go install github.com/mitchellh/gox
# go get -u github.com/c4milo/github-release
# go get -u github.com/aws/aws-sdk-go
# go get -u github.com/vektra/mockery
go_download:
go mod download
watch:
scantest
packages:
rm -rf package && mkdir package
rm -rf stage && mkdir -p stage/usr/bin
cp build/unicreds_$(VERSION)_linux_amd64/unicreds stage/usr/bin
fpm --name $(NAME) -a x86_64 -t rpm -s dir --version $(VERSION) --iteration $(ITERATION) -C stage -p package/$(NAME)-$(VERSION)_$(ITERATION).x86_64.rpm usr
rm -rf stage && mkdir -p stage/usr/bin
cp build/unicreds_$(VERSION)_linux_arm64/unicreds stage/usr/bin
fpm --name $(NAME) -a aarch64 -t rpm -s dir --version $(VERSION) --iteration $(ITERATION) -C stage -p package/$(NAME)-$(VERSION)_$(ITERATION).aarch64.rpm usr
generate-mocks:
mockery --dir "../../aws/aws-sdk-go/service/kms/kmsiface" --all
mockery --dir "../../aws/aws-sdk-go/service/dynamodb/dynamodbiface" --all
.PHONY: build fmt test install integration watch release packages