Location: a leave decided its destination before taking the device lock, so a "leave home" racing an "arrive gym" could undo the arrival. The decision (now ingest.Destination) runs inside MoveTo under the lock. Transition external IDs were device|label|time, which collided (500) when out-of-order events were clamped to the same start; they now name the interval being closed. hypr-agent: a control command arriving during shutdown no longer blocks its goroutine forever. Tests: internal/testdb gives each database test its own throwaway database, so they run in parallel and no longer truncate the dev data. New store tests cover both location bugs. CI starts a Postgres container so these tests actually run, and adds gofmt, staticcheck (pinned as a go tool) and -race. `make check` runs the same locally. Co-Authored-By: Claude Opus 5.5 <[email protected]>
52 lines
1.4 KiB
Makefile
52 lines
1.4 KiB
Makefile
COMPOSE := docker compose -f deploy/docker-compose.yml
|
|
DEV_DB := postgres://tracker:tracker@localhost:5432/tracker?sslmode=disable
|
|
|
|
.PHONY: web web-dev build check lint test test-integration run up down docker migrate install-agent
|
|
|
|
# Builds the Vue app into internal/web/dist/app, which the binary embeds.
|
|
web:
|
|
cd web && { [ -d node_modules ] || npm ci; } && npm run build
|
|
|
|
# Vite dev server with hot reload; it proxies /api to `make run` on :8080.
|
|
web-dev:
|
|
cd web && npm run dev
|
|
|
|
build: web
|
|
go build -o bin/ ./cmd/...
|
|
|
|
# Everything CI checks. Database tests run if the compose Postgres is up
|
|
# (`make up`); each gets its own throwaway database, so your data is safe.
|
|
check: lint test-integration
|
|
cd web && { [ -d node_modules ] || npm ci; } && npm run typecheck
|
|
|
|
lint:
|
|
@test -z "$$(gofmt -l .)" || { echo "gofmt needed:"; gofmt -l .; exit 1; }
|
|
go vet ./...
|
|
go tool staticcheck ./...
|
|
|
|
test:
|
|
go test ./...
|
|
|
|
test-integration:
|
|
TEST_DATABASE_URL='$(DEV_DB)' go test -race -count=1 ./...
|
|
|
|
run: web
|
|
AUTH_MODE=dev DEV_MODE=true DATABASE_URL='$(DEV_DB)' go run ./cmd/tracker serve
|
|
|
|
up:
|
|
$(COMPOSE) up -d --build
|
|
|
|
down:
|
|
$(COMPOSE) down
|
|
|
|
docker:
|
|
docker build -f deploy/Dockerfile -t activity-tracker .
|
|
|
|
migrate:
|
|
DATABASE_URL='$(DEV_DB)' go run ./cmd/tracker migrate
|
|
|
|
install-agent:
|
|
go build -o $(HOME)/.local/bin/hypr-agent ./cmd/hypr-agent
|
|
install -Dm644 deploy/systemd/hypr-agent.service $(HOME)/.config/systemd/user/hypr-agent.service
|
|
systemctl --user daemon-reload
|