-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (55 loc) · 1.28 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
BINARY_NAME=gommitizen
TAG=$(shell git describe --tags --always --dirty)
all: build install
build:
@echo "Building..."
@go build -o bin/$(BINARY_NAME) -v
docker:
@echo "Building docker image..."
@docker build -t $(BINARY_NAME):$(TAG) .
@echo
@echo "Done!"
@echo "May the docker be with you..."
@echo
@echo " # docker run -it $(BINARY_NAME):$(TAG) help"
@echo
install: build
@echo "Installing..."
@go install
@echo
@echo "Done!"
scan: start-sonar
@echo "Scanning..."
@curl -X POST -u admin:admin 'http://localhost:9000/api/users/create?login=user&password=password&name=user'
@sonar-scanner \
-Dsonar.projectKey=${BINARY_NAME} \
-Dsonar.sources=. \
-Dsonar.host.url=http://localhost:9000 \
-Dsonar.login=user \
-Dsonar.password=password
@golangci-lint run
@echo
@echo "Done!"
start-sonar:
@docker-compose up -d --wait sonarqube
stop-sonar:
@docker-compose down
mocks: regenerate_mocks
regenerate_mocks:
mockgen -package mockGit -destination git/mockGit/mock_interface.go gommitizen/git GitI
test: tests
tests:
@echo "Running tests..."
@go test -v ./...
@echo
@echo "Done!"
coverage:
@echo "Running tests..."
@go test -v ./... --cover --coverprofile=coverage.out
@echo
@echo "Done!"
clean: stop-sonar
@echo "Cleaning..."
@rm -rf bin/*
@echo
@echo "Done!"