generated from steadybit/extension-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·91 lines (79 loc) · 2.77 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
91
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
.PHONY: help
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
## licenses-report: generate a report of all licenses
.PHONY: licenses-report
licenses-report:
ifeq ($(SKIP_LICENSES_REPORT), true)
@echo "Skipping licenses report"
rm -rf ./licenses && mkdir -p ./licenses
else
@echo "Generating licenses report"
rm -rf ./licenses
go run github.com/google/go-licenses@v1.6.0 save . --save_path ./licenses
go run github.com/google/go-licenses@v1.6.0 report . > ./licenses/THIRD-PARTY.csv
cp LICENSE ./licenses/LICENSE.txt
endif
# ==================================================================================== #
# QUALITY CONTROL
# ==================================================================================== #
## tidy: format code and tidy modfile
.PHONY: tidy
tidy:
go fmt ./...
go mod tidy -v
## audit: run quality control checks
.PHONY: audit
audit:
go vet ./...
go run honnef.co/go/tools/cmd/staticcheck@latest -checks=all,-ST1000,-ST1003,-U1000 ./...
go test -race -vet=off -coverprofile=coverage.out -timeout 30m ./...
go mod verify
## charttesting: Run Helm chart unit tests
.PHONY: charttesting
charttesting:
@set -e; \
for dir in charts/steadybit-extension-*; do \
echo "Unit Testing $$dir"; \
helm unittest $$dir; \
done
## chartlint: Lint charts
.PHONY: chartlint
chartlint:
ct lint --config chartTesting.yaml
## chart-bump-version: Bump the patch version and optionally set the appVersion
.PHONY: chart-bump-version
chart-bump-version:
@set -e; \
for dir in charts/steadybit-extension-*; do \
if [ ! -z "$(APP_VERSION)" ]; then \
yq -i ".appVersion = strenv(APP_VERSION)" $$dir/Chart.yaml; \
fi; \
CHART_VERSION=$$(semver -i patch $$(yq '.version' $$dir/Chart.yaml)) \
yq -i ".version = strenv(CHART_VERSION)" $$dir/Chart.yaml; \
grep -e "^version:" -e "^appVersion:" $$dir/Chart.yaml; \
done
# ==================================================================================== #
# BUILD
# ==================================================================================== #
## build: build the extension
.PHONY: build
build:
goreleaser build --clean --snapshot --single-target -o extension
## run: run the extension
.PHONY: run
run: tidy build
./extension
## container: build the container image
.PHONY: container
container:
docker buildx build --build-arg BUILD_WITH_COVERAGE="true" --build-arg SKIP_LICENSES_REPORT="true" -t extension-http:latest --output=type=docker .
## linuxpkg: build the linux packages
.PHONY: linuxpkg
linuxpkg:
goreleaser release --clean --snapshot --skip=sign