-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (62 loc) · 2.11 KB
/
Makefile
File metadata and controls
82 lines (62 loc) · 2.11 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
SHELL := /bin/bash
# Load .env if present.
ifneq (,$(wildcard .env))
include .env
export
endif
DATABASE_URL ?= postgres://timetrak:timetrak@localhost:5432/timetrak?sslmode=disable
.PHONY: run build test lint migrate-up migrate-down migrate-redo dev-seed backfill-rate-snapshots check-rate-snapshots db-up db-down fmt vet tidy browser-install test-browser
run:
go run ./cmd/web
build:
mkdir -p bin
go build -o bin/web ./cmd/web
go build -o bin/migrate ./cmd/migrate
test:
# -p 1 serializes test packages so integration tests that TRUNCATE don't
# race with each other against the shared Postgres database.
go test -p 1 ./...
lint:
go vet ./...
fmt:
gofmt -w .
vet:
go vet ./...
tidy:
go mod tidy
migrate-up:
go run ./cmd/migrate up
migrate-down:
go run ./cmd/migrate down
migrate-redo:
go run ./cmd/migrate redo
dev-seed:
go run ./cmd/migrate seed
# Populate time_entries.rate_rule_id / hourly_rate_minor / currency_code for
# closed entries missing a snapshot. Idempotent. Use DRY_RUN=1 to probe without
# writing.
backfill-rate-snapshots:
ifeq ($(DRY_RUN),1)
go run ./cmd/migrate backfill-rate-snapshots --dry-run
else
go run ./cmd/migrate backfill-rate-snapshots
endif
# Deploy gate: fails non-zero when any closed billable entry has a NULL rate
# snapshot. Intended to run in CI / pre-deploy after backfill-rate-snapshots.
check-rate-snapshots:
go run ./cmd/migrate check-rate-snapshots
db-up:
docker compose up -d postgres
db-down:
docker compose down
# Browser-driven UI contract tests (Playwright + Chromium). Gated behind
# the `browser` Go build tag so the default `make test` stays hermetic and
# does not require browser binaries. Run `make browser-install` once to
# fetch the driver + Chromium (~200MB) before the first `make test-browser`.
# The pinned Playwright-Go version lives in go.mod and is documented at the
# top of internal/e2e/browser/harness.go — upgrades require their own
# OpenSpec change.
browser-install:
go run github.com/playwright-community/playwright-go/cmd/playwright@v0.5700.1 install --with-deps chromium
test-browser:
go test -tags=browser -p 1 ./internal/e2e/browser/...