forked from jonasbroms/hbm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (73 loc) · 2.14 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
84
85
86
87
88
89
90
TARGETS := $(shell ls scripts | grep -vE 'clean|dev|dockerlint|help|release|run-test|shellcheck|tag')
TMUX := $(shell command -v tmux 2> /dev/null)
.PHONY: .dapper
.dapper:
@echo Downloading dapper
@curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m|sed 's/v7l//'` > .dapper.tmp
@@chmod +x .dapper.tmp
@./.dapper.tmp -v
@mv .dapper.tmp .dapper
.PHONY: .github-release
.github-release:
@echo Downloading github-release
@curl -sL https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2 | tar xjO > .github-release.tmp
@@chmod +x .github-release.tmp
@./.github-release.tmp -v
@mv .github-release.tmp .github-release
.PHONY: .tmass
.tmass:
@echo Downloading tmass
@curl -sL https://github.com/juliengk/tmass/releases/download/0.3.0/tmass -o .tmass.tmp
@@chmod +x .tmass.tmp
@./.tmass.tmp version
@mv .tmass.tmp .tmass
.PHONY: $(TARGETS)
$(TARGETS): .dapper
./.dapper $@
.PHONY: clean
clean:
@./scripts/clean
.PHONY: dev
dev: .dapper .tmass
ifndef TMUX
$(error "tmux is not available, please install it")
endif
./.tmass load -l scripts/dev/tmux/ hbm
tmux a -d -t hbm
.PHONY: help
help:
@./scripts/help
.PHONY: release
release: .github-release
./scripts/release
.PHONY: run-test
run-test:
./scripts/run-test
.PHONY: tag
tag:
./scripts/tag
.PHONY: shellcheck
shellcheck:
@for file in $(shell find . -type f -executable -not -path "./.git/*" -not -path "./vendor/*"); do \
echo "Validating : $$file"; \
docker container run --rm --mount type=bind,src=$$PWD,dst=/mnt,ro koalaman/shellcheck -e SC2086 -e SC2046 -e SC1090 "$$file"; \
if [ $$? -gt 0 ]; then \
continue; \
fi; \
done;
.PHONY: dockerlint
dockerlint:
@for file in $(shell find . -name 'Dockerfile*'); do \
echo "Validating : $$file"; \
docker container run -i --rm hadolint/hadolint hadolint --ignore DL3018 --ignore DL3013 - < $$file; \
done;
.PHONY: format
format:
@for file in $(shell find . -name '*.go' -type f -not -path "./.git/*" -not -path "./vendor/*"); do \
echo "Formatting: $$file"; \
gofmt -l -s -w "$$file"; \
if [ $$? -gt 0 ]; then \
continue; \
fi; \
done;
.DEFAULT_GOAL := ci