-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (34 loc) · 876 Bytes
/
Copy pathMakefile
File metadata and controls
44 lines (34 loc) · 876 Bytes
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
include .env
export
DB_URL=postgres://${DB_USER}:${DB_PASSWORD}@localhost:5432/${DB_NAME}?sslmode=disable
VERSION ?= dev
BINARY_NAME = ct-api
BUILD_LOC = ./bin/$(BINARY_NAME)
.DEFAULT_GOAL := build
.PHONY: migrate-up
migrate-up:
migrate -path db/migrations -database "$(DB_URL)" up
.PHONY: migrate-down
migrate-down:
migrate -path db/migrations -database "$(DB_URL)" down 1
.PHONY: migrate-create
migrate-create:
migrate create -ext sql -dir db/migrations -seq $(name)
.PHONY: db-seed
db-seed:
psql "$(DB_URL)" -f db/seed.sql
.PHONY: fix
fix:
gofmt -s -w .
goimports -w .
actionlint .github/workflows/*.yml
golangci-lint run --fix
.PHONY: build
build:
go build -trimpath -ldflags "-X main.version=$(VERSION) -w -s" -o $(BUILD_LOC) ./cmd/api
.PHONY: lint-migrations
lint-migrations:
squawk db/migrations/*.sql
.PHONY: test
test:
go test -v ./internal/...