forked from danvergara/dblab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
84 lines (68 loc) · 2.12 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
PLATFORM=linux/amd64
.PHONY: test
## test: Runs the tests
test:
go test -v -race ./...
.PHONY: unit-test
## unit-test: Runs the tests with the short flag
unit-test:
go test -v -short -race ./...
.PHONY: int-test
## int-test: Runs the integration tests
int-test:
docker-compose run --entrypoint=make dblab test
.PHONY: linter
## linter: Runs the golangci-lint command
linter:
golangci-lint run --enable=golint --enable=godot --enable=gofmt ./...
.PHONY: test-all
## test-all: Runs the integration testing bash script with different database docker image versions
test-all:
@./scripts/test_all.sh
.PHONY: docker-build
## docker-build: Builds de Docker image
docker-build:
@docker build --target bin --output bin/ --platform ${PLATFORM} -t dblab .
.PHONY: build
## build: Builds the Go program
build:
CGO_ENABLED=0 \
go build -o dblab .
.PHONY: build-sqlite3
## build-sqlite3: Builds the Go program with CGO_ENABLED enabled.
build-sqlite3:
go build -o dblab .
.PHONY: run
## run: Runs the application
run: build
./dblab --host localhost --user postgres --db users --pass password --ssl disable --port 5432 --driver postgres --limit 50
.PHONY: run-mysql
## run-mysql: Runs the application with a connection to mysql
run-mysql: build
./dblab --host localhost --user myuser --db mydb --pass 5@klkbN#ABC --ssl enable --port 3306 --driver mysql
.PHONY: run-sqlite3
## run-sqlite3: Runs the application with a connection to sqlite3
run-sqlite3: build
docker-compose run --rm dblab-sqlite3
./dblab --db db/dblab.db --driver sqlite3
.PHONY: run-url
## run-url: Runs the app passing the url as parameter
run-url: build
./dblab --url postgres://postgres:password@localhost:5432/users?sslmode=disable
.PHONY: up
## up: Runs all the containers listed in the docker-compose.yml file
up:
docker-compose up --build -d
.PHONY: down
## down: Shut down all the containers listed in the docker-compose.yml file
down:
docker-compose down
.PHONY: form
## form: Runs the application with no arguments
form: build
./dblab
.PHONY: help
## help: Prints this help message
help:
@echo "Usage:"
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'