forked from RedHatInsights/cloud-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (45 loc) · 1.58 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
CONNECTOR_SERVICE_BINARY=cloud-connector
CONNECTED_CLIENT_BINARY=test_client
MIGRATE_DB_BINARY=migrate_db
DB_SCHEMA_DUMPER_BINARY=db_schema_dumper
DOCKER_COMPOSE_CFG=dev.yml
COVERAGE_OUTPUT=coverage.out
COVERAGE_HTML=coverage.html
.PHONY: test clean deps coverage
build:
go build -o $(CONNECTOR_SERVICE_BINARY) cmd/$(CONNECTOR_SERVICE_BINARY)/*.go
go build -o $(CONNECTED_CLIENT_BINARY) cmd/$(CONNECTED_CLIENT_BINARY)/*.go
go build -o $(MIGRATE_DB_BINARY) cmd/$(MIGRATE_DB_BINARY)/main.go
go build -o $(DB_SCHEMA_DUMPER_BINARY) cmd/$(DB_SCHEMA_DUMPER_BINARY)/main.go
go build -o stage_db_fixer cmd/stage_db_fixer/main.go
run-pendo-transmitter:
./$(CONNECTOR_SERVICE_BINARY) connection_count_per_account_reporter -r pendo
deps:
go get -u golang.org/x/lint/golint
test:
# Use the following command to run specific tests (not the entire suite)
# TEST_ARGS="-run TestReadMessage -v" make test
go test $(TEST_ARGS) ./...
test-sql: migrate
go test $(TEST_ARGS) ./... -tags=sql
migrate: $(MIGRATE_DB_BINARY)
./$(MIGRATE_DB_BINARY) upgrade
$(MIGRATE_DB_BINARY): build
coverage:
go test -v -coverprofile=$(COVERAGE_OUTPUT) ./...
go tool cover -html=$(COVERAGE_OUTPUT) -o $(COVERAGE_HTML)
@echo "file://$(PWD)/$(COVERAGE_HTML)"
start-test-env:
podman-compose -f $(DOCKER_COMPOSE_CFG) up
stop-test-env:
podman-compose -f $(DOCKER_COMPOSE_CFG) down
build_image:
podman build . -t cloud-connector
fmt:
go fmt ./...
lint:
$(GOPATH)/bin/golint ./...
clean:
go clean
rm -f $(CONNECTOR_SERVICE_BINARY) $(CONNECTED_CLIENT_BINARY) $(MIGRATE_DB_BINARY)
rm -f $(COVERAGE_OUTPUT) $(COVERAGE_HTML)