-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (37 loc) · 1.45 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
include app-dev.env
DB_URL ?= postgres://postgres:postgres@localhost:5433/url_shortener?sslmode=disable
DB_URL_TEST ?= postgres://postgres:postgres@localhost:5434/url_shortener_test?sslmode=disable
############################### Requirements ###############################
setup:
go install github.com/swaggo/swag/cmd/swag@latest
go install golang.org/x/perf/cmd/benchstat@latest
brew install golang-migrate
python3 -m venv ./.venv
./.venv/bin/pip install bzt
############################### Migrate ###############################
create-migration:
@read -p "Enter migration name: " migration_name; \
migrate create -ext sql -dir internal/database/migrations -seq $$migration_name
migrate-up:
migrate -database ${DB_URL} -path internal/database/migrations up
migrate -database ${DB_URL_TEST} -path internal/database/migrations up
migrate-down:
migrate -database ${DB_URL} -path internal/database/migrations down
############################### Sqlc ###############################
sqlc:
docker run --rm -v ${PWD}:/src -w /src kjconroy/sqlc generate
############################### Docs ###############################
gen-docs:
swag init
############################### App ###############################
run-dev:
go run main.go
stop-b-and-r:
killall -e url_shortener
build-and-run:
go build -o url_shortener main.go
./url_shortener
integration-tests:
go test ./tests/integration -cover
performance-tests:
go test -bench=. -benchmem ./tests/performance