-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (66 loc) · 2.1 KB
/
Copy pathMakefile
File metadata and controls
87 lines (66 loc) · 2.1 KB
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
85
86
87
.PHONY: build build-no-ui build-release test test-integration fmt lint clean docker-up docker-down migrate-up migrate-down ui-dev ui-dev-ja ui-build ui-test ui-lint ui-i18n-extract
# Variables
BINARY_NAME=mayu
DATABASE_URL?=postgres://mayu:mayu@localhost:5432/mayu?sslmode=disable
VERSION?=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
# Build (with embedded Web UI — same as release binaries)
build: ui-build
rm -rf internal/uiassets/dist
cp -r ui/dist/mayu/browser internal/uiassets/dist
touch internal/uiassets/dist/.gitkeep
go build -tags uiembed -ldflags "-X main.version=$(VERSION)" -o bin/$(BINARY_NAME) ./cmd/mayu
# Build without Web UI (Go only, faster for backend-only development)
build-no-ui:
go build -ldflags "-X main.version=$(VERSION)" -o bin/$(BINARY_NAME) ./cmd/mayu
build-release: ui-build
rm -rf internal/uiassets/dist
cp -r ui/dist/mayu/browser internal/uiassets/dist
touch internal/uiassets/dist/.gitkeep
go build -tags uiembed -ldflags "-s -w -X main.version=$(VERSION)" -o bin/$(BINARY_NAME) ./cmd/mayu
# Test
test:
go test ./... -v -count=1
test-integration:
go test ./... -v -count=1 -tags=integration -p 1
# Format
fmt:
go fmt ./...
# Lint
lint:
$(shell go env GOBIN)/golangci-lint run ./...
# Clean
clean:
rm -rf bin/
go clean
# Docker
docker-up:
docker compose up -d
@echo "Waiting for PostgreSQL to be ready..."
@docker compose exec postgres sh -c 'until pg_isready -U mayu; do sleep 1; done'
@echo "PostgreSQL is ready."
docker-down:
docker compose down
docker-clean:
docker compose down -v
# Migrations
migrate-up:
migrate -database "$(DATABASE_URL)" -path migrations up
migrate-down:
migrate -database "$(DATABASE_URL)" -path migrations down
migrate-create:
@read -p "Migration name: " name; \
migrate create -ext sql -dir migrations -seq $$name
# UI (Angular)
ui-dev:
pnpm --prefix ui run start
ui-dev-ja:
pnpm --prefix ui run start:ja
ui-build:
pnpm --prefix ui install
pnpm --prefix ui run build
ui-test:
pnpm --prefix ui run test --watch=false
ui-lint:
pnpm --prefix ui run ng lint
ui-i18n-extract:
cd ui && pnpm exec ng extract-i18n