-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
72 lines (56 loc) · 2.2 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
SHELL=/bin/bash -o pipefail
BUILD_INFO_PACKAGE_PATH=github.com/qonto/postgresql-partition-manager/internal/infra/build
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
GIT_COMMIT_SHA=$(shell git rev-parse HEAD)
BINARY=postgresql-partition-manager
ARCHITECTURE=$(shell uname -m)
HELM_CHART_NAME=postgresql-partition-manager-chart
RELEASE_VERSION=$(shell jq .tag dist/metadata.json)
AWS_ECR_PUBLIC_ORGANIZATION=qonto
all: build
.PHONY: format
format:
gofumpt -l -w .
.PHONY: build
build:
CGO_ENABLED=0 go build -v -ldflags="-X '$(BUILD_INFO_PACKAGE_PATH).Version=development' -X '$(BUILD_INFO_PACKAGE_PATH).CommitSHA=$(GIT_COMMIT_SHA)' -X '$(BUILD_INFO_PACKAGE_PATH).Date=$(BUILD_DATE)'" -o $(BINARY)
.PHONY: run
run:
./$(BINARY) $(args)
.PHONY: install
install: build
GOBIN=/usr/local/bin/ go install -v -ldflags="-X '$(BUILD_INFO_PACKAGE_PATH).Version=development' -X '$(BUILD_INFO_PACKAGE_PATH).CommitSHA=$(GIT_COMMIT_SHA)' -X '$(BUILD_INFO_PACKAGE_PATH).Date=$(BUILD_DATE)'"
.PHONY: bats-test
bats-test:
cd scripts/bats && bats *.bats
.PHONY: helm-test
helm-test:
helm unittest configs/helm
.PHONY: helm-release
helm-release:
./scripts/helm-release.sh $(HELM_CHART_NAME) configs/helm $(RELEASE_VERSION) $(AWS_ECR_PUBLIC_ORGANIZATION)
.PHONY: kubeconform-test
kubeconform-test:
./scripts/kubeconform-test.sh configs/helm
.PHONY: goreleaser-check
goreleaser-check:
goreleaser check
debian-test:
GORELEASER_CURRENT_TAG=0.0.0 goreleaser release --clean --skip-publish --skip-docker --snapshot
docker build configs/debian/tests -t test
docker run -v ./dist/postgresql-partition-manager_0.0.1~next_$(ARCHITECTURE).deb:/mnt/postgresql-partition-manager.deb test
debian-test-ci:
docker build configs/debian/tests -t test
docker run -v ./dist/postgresql-partition-manager_0.0.1~next_amd64.deb:/mnt/postgresql-partition-manager.deb test
checkcov:
checkov --directory .
.PHONY: test
test:
go test -race -v ./... -coverprofile=coverage.txt -covermode atomic
go run github.com/boumenot/gocover-cobertura@latest < coverage.txt > coverage.xml
go tool cover -html coverage.txt -o cover.html
.PHONY: lint
lint:
golangci-lint run --verbose --timeout 2m
.PHONY: all-tests
all-tests: test helm-test kubeconform-test goreleaser-check