-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (40 loc) · 1.57 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
SHELL=/bin/bash -o pipefail
export PATH := $(PATH):$(shell go env GOPATH)/bin
TOOLS = \
"github.com/volatiletech/sqlboiler/v4@latest" \
"github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-psql@latest" \
"github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest" \
"github.com/google/wire/cmd/wire@latest" \
"github.com/golang/mock/[email protected]" \
"github.com/joho/godotenv/cmd/godotenv@latest" \
"github.com/cloudflare/cfssl/cmd/[email protected]" \
"github.com/cloudflare/cfssl/cmd/[email protected]" \
.make/install-tools: go.mod go.sum
@for tool in $(TOOLS); do \
echo "Installing $$tool..."; \
go install $$tool; \
done
touch $@
.PHONY: migrate-postgresql
migrate-postgresql: .make/install-tools
godotenv go run .github/workflows/migrate/pgsql.go
.PHONY: generate-all
generate-all: generate-sqlboiler generate-openapi-boilerplate generate-go generate-test-certificates
.PHONY: generate-go
generate-go: .make/install-tools
go generate ./...
.PHONY: generate-sqlboiler
generate-sqlboiler: .make/install-tools
godotenv sqlboiler psql -c sqlboiler.toml -o internal/db/postgresql/models -p models
.PHONY: generate-openapi-boilerplate
generate-openapi-boilerplate:
oapi-codegen -config .openapi/oapi-codegen.cfg.yaml .openapi/openapi.yaml
.PHONY: generate-test-certificates
generate-test-certificates:
bash testdata/certificates/generate.sh
.PHONY: go-test
go-test: .make/install-tools
godotenv go test -v ./...
.PHONY: go-test-coverage
go-test-coverage: .make/install-tools
godotenv go test -race -coverprofile=coverage.out -covermode=atomic -v ./...