Add activity tracker server, Hyprland agent and Gitea image publishing
Test and publish / test (push) Successful in 2m38s
Test and publish / publish (push) Failing after 2m30s

The Go API on PostgreSQL ingests desktop, browser, presence, manual and
Health Auto Export events and serves activities and daily goal summaries.
The Hyprland agent records window focus, idle and lock intervals.

The CI workflow publishes adam-french.co.uk/adamf/activity-tracker to the
Gitea registry and rolls the web_server stack onto it. The image probes
itself through a new `tracker healthcheck` command, because distroless
has no wget.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-14 20:38:12 +01:00
co-authored by Claude Opus 5.5
parent 0cbbb76dee
commit f4ce04875c
29 changed files with 2810 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
package summary
import (
"testing"
"time"
"ccp/internal/store"
)
func TestEvaluate(t *testing.T) {
totals := []store.Total{
{Kind: "tab_focus", Label: "youtube.com", Seconds: 5400},
{Kind: "tab_focus", Label: "github.com", Seconds: 1800},
{Kind: "walk", Label: "Outdoor Walk", Seconds: 1200},
}
goals := []store.Goal{
{ID: 1, Kind: "tab_focus", Label: "youtube.com", Op: "<=", TargetS: 3600},
{ID: 2, Kind: "walk", Op: ">=", TargetS: 1800},
{ID: 3, Kind: "tab_focus", Op: ">=", TargetS: 7200}, // empty label = all labels
}
got := Evaluate(totals, goals)
want := []struct {
actual int64
met bool
}{{5400, false}, {1200, false}, {7200, true}}
for i, w := range want {
if got[i].ActualS != w.actual || got[i].Met != w.met {
t.Errorf("goal %d: got actual=%d met=%v, want %+v", goals[i].ID, got[i].ActualS, got[i].Met, w)
}
}
}
func TestDayBoundsDST(t *testing.T) {
loc, err := time.LoadLocation("America/New_York")
if err != nil {
t.Skip("no tzdata:", err)
}
// 2026-03-08 is the spring-forward day: only 23 hours long.
from, to := DayBounds(time.Date(2026, 3, 8, 15, 0, 0, 0, loc), loc)
if to.Sub(from) != 23*time.Hour || from.Hour() != 0 {
t.Fatalf("got %v - %v", from, to)
}
}