-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (30 loc) · 981 Bytes
/
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
PACKAGE=niteo.co/subsetter
.PHONY: run
run:
go run "${PACKAGE}/$(filter-out $@,$(MAKECMDGOALS))"
.PHONY: up
up:
process-compose up -t=false -p=0
.PHONY: is-postgres-running
is-postgres-running:
@(pg_isready -h localhost) || (echo "# ==> Startis postgres by running 'make up'" && exit 2)
.PHONY: pgweb
pgweb: is-postgres-running
if [ -n "$(filter-out $@,$(MAKECMDGOALS))" ]; then \
pgweb --url "$(filter-out $@,$(MAKECMDGOALS))"; \
else \
pgweb --url "postgres://test_target@localhost:5432/test_target?sslmode=disable"; \
fi;
build:
rm -rf dist
goreleaser build --snapshot --clean
lint:
golangci-lint run
dump:
pg_dump --no-acl --schema-only -n public -x -O -c -f ./dump.sql $(filter-out $@,$(MAKECMDGOALS))
restore:
psql -f ./dump.sql "postgres://test_target@localhost:5432/test_target?sslmode=disable"
clear:
psql -c "DROP OWNED BY CURRENT_USER;" "postgres://test_target@localhost:5432/test_target?sslmode=disable"
test:
go test -timeout 30s -v ./...