Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (72 loc) · 3.13 KB
/
Copy pathMakefile
File metadata and controls
96 lines (72 loc) · 3.13 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
88
89
90
91
92
93
94
95
96
.PHONY: dev dev-backend dev-frontend setup setup-backend setup-frontend migrate sqlc seed test build build-backend up down backend-dev backend-dev-seed backend-dev-down backend-dev-reset backend-encrypted-test backend-encrypted-down third-party-notices third-party-notices-check check-unstring unstring-update
export PATH := $(PATH):$(shell go env GOPATH)/bin
# Static guard against stringly-typed values, pinned to the published tool.
UNSTRING ?= go run github.com/peasant-labs/infra/unstring/cmd/unstring@v0.3.0
BUILD_REVISION ?= $(shell git rev-parse --short=12 HEAD 2>/dev/null)
BACKEND_REVISION_LDFLAGS = -X github.com/peasant-labs/village/backend/internal/handler.buildRevision=$(BUILD_REVISION)
# Local development (infra + app in Docker). All @peasant-labs/* packages
# resolve from the registry via the pnpm workspace (see pnpm-workspace.yaml);
# the vendored-tarball flow (frontend/vendor + vendor-shared) is gone.
dev:
docker compose up --build
setup: setup-backend setup-frontend
setup-backend:
@echo "Installing air..."
go install github.com/air-verse/air@latest
setup-frontend:
@echo "Installing frontend dependencies..."
pnpm install
# Database
migrate:
docker compose exec backend go run ./cmd/server -migrate-only
sqlc:
@echo "Generating sqlc code..."
sqlc generate
seed:
@echo "Seeding database..."
docker compose exec backend go run ./cmd/server -seed-core
docker exec -i $$(docker compose ps -q postgres) psql -U peasant -d peasant < scripts/seed.sql
docker compose exec backend go run ./cmd/server -seed-privacy
docker exec -i $$(docker compose ps -q postgres) psql -U peasant -d peasant < scripts/seed-privacy-features.sql
# Testing
test:
@echo "Running tests..."
cd backend && go test ./...
check-unstring:
$(UNSTRING) check
unstring-update:
$(UNSTRING) update
# Dependency license notices shipped in the backend image (backend/Dockerfile).
third-party-notices:
cd backend && ./scripts/gen-third-party-notices.sh
# CI gate: fail if the committed notices drift from the deps, and fail on any
# copyleft/unclassifiable license entering the backend binary's module set.
third-party-notices-check:
cd backend && ./scripts/gen-third-party-notices.sh
git diff --exit-code -- backend/THIRD_PARTY_NOTICES
cd backend && ./scripts/check-dep-licenses.sh
# Disposable, isolated PostgreSQL + RustFS proof of the encrypted backend.
# The script always removes its project and volumes unless KEEP_ENCRYPTED_TEST_STACK=1.
backend-encrypted-test:
./scripts/encrypted-backend-dev.sh test
backend-encrypted-down:
./scripts/encrypted-backend-dev.sh down
# Persistent, worktree-isolated encrypted backend development.
backend-dev:
./scripts/encrypted-backend-dev.sh dev
backend-dev-seed:
./scripts/encrypted-backend-dev.sh seed
backend-dev-down:
./scripts/encrypted-backend-dev.sh dev-down
backend-dev-reset:
CONFIRM=$(CONFIRM) ./scripts/encrypted-backend-dev.sh reset
# Docker (full stack)
up:
docker compose up --build -d
down:
docker compose down
build-backend:
cd backend && go build -ldflags '$(BACKEND_REVISION_LDFLAGS)' -o ./bin/server ./cmd/server
build: build-backend
@echo "Building production binaries..."
cd frontend && pnpm build