-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (58 loc) · 1.74 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
.SILENT:
.DEFAULT-GOAL:= help
## help: справка
.PHONY: help
help:
@echo 'Single Sign-On (SSO)'
@echo ''
@echo 'Usage:'
@echo ' make <command>'
@echo ''
@echo 'The commands are:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
## init: установка требуемых утилит
.PHONY: init
init:
go install github.com/pressly/goose/v3/cmd/[email protected]
go install github.com/vektra/mockery/[email protected]
## migration: новая миграция
.PHONY: migration
migration:
@read -p "Введите название миграции: " migration_name; \
goose -dir=./scripts/migrations create $$migration_name go
## lint: статический анализ
.PHONY: lint
lint:
golangci-lint run ./...
## mockery: генерация mocks
.PHONY: mockery
mockery:
mockery
## test: запуск всех тестов
.PHONY: test
test:
go test -v -race -count=1 -coverpkg=./... -coverprofile=./coverage.out ./...
#go tool cover -html=./coverage.out
rm ./coverage.out
## test-unit: запуск unit тестов
.PHONY: test-unit
test-unit:
go test -v -race -count=1 -coverprofile=./coverage.out ./internal/... ./pkg/...
#go tool cover -func=./coverage.out
#go tool cover -html=./coverage.out
rm ./coverage.out
## test-integration: запуск integration тестов
.PHONY: test-integration
test-integration:
go test -v -coverpkg=./... -count=1 -coverprofile=./coverage.out ./tests/...
#go tool cover -html=./coverage.out
rm ./coverage.out
## audit: проверка зависимостей
.PHONY: audit
audit:
go mod download
go mod verify
## build: сборка проекта
.PHONY: build
build: audit
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags='-w -s' -o ./sso-server ./cmd/server