-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (57 loc) · 2.8 KB
/
Makefile
File metadata and controls
67 lines (57 loc) · 2.8 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
.PHONY: build test gate docker-build run smoke-buildinfo chaostest chaostest-propagation chaostest-lease-recovery
# Build-time metadata injected into instant.dev/common/buildinfo via -ldflags.
# Override on the make line if needed. GIT_SHA falls back to "dev" when not
# in a git checkout (e.g. CI tarball builds).
GIT_SHA ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo dev)
BUILD_TIME ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
VERSION ?= dev
build:
go build ./...
test:
go test ./... -race -count=1
# PR/deploy gate: runs EXACTLY what .github/workflows/deploy.yml runs as its
# test gate (`go test ./... -short -count=1`, see the deploy.yml "Run unit
# tests" step), preceded by build + vet as a fast-fail. A green `make gate`
# locally == a green CI test step — the local gate cannot pass while CI fails.
gate:
go build ./...
go vet ./...
go test ./... -short -count=1
@echo "gate: green — matches deploy.yml test step"
docker-build:
docker build -f Dockerfile -t instant-worker:local \
--build-arg GIT_SHA=$(GIT_SHA) \
--build-arg BUILD_TIME=$(BUILD_TIME) \
--build-arg VERSION=$(VERSION) \
..
run:
go run .
# Verifies the -ldflags injection wires through to instant.dev/common/buildinfo.
# Builds the smoke helper with override values and asserts they appear at
# runtime. CI runs this on every PR to catch a regression where someone
# breaks the ldflag path.
smoke-buildinfo:
@tmpdir=$$(mktemp -d) && \
go build -ldflags "-X instant.dev/common/buildinfo.GitSHA=smoke-sha -X instant.dev/common/buildinfo.BuildTime=smoke-time -X instant.dev/common/buildinfo.Version=smoke-ver" \
-o $$tmpdir/smoke ./cmd/smoke-buildinfo && \
out=$$($$tmpdir/smoke) && \
echo "$$out" | grep -q "GitSHA=smoke-sha" || (echo "FAIL: $$out" && exit 1) && \
echo "$$out" | grep -q "BuildTime=smoke-time" || (echo "FAIL: $$out" && exit 1) && \
echo "$$out" | grep -q "Version=smoke-ver" || (echo "FAIL: $$out" && exit 1) && \
echo "smoke-buildinfo: OK ($$out)" && \
rm -rf $$tmpdir
# ── chaostest targets (CHAOS-DRILL-2026-05-20) ──
# These targets are convenience shims — the actual chaos tests live in
# api/e2e/{propagation,lease_recovery}_chaos_test.go (the api repo owns
# the e2e harness; the worker repo owns the stub job + workers wiring).
#
# `make chaostest` from this repo runs BOTH drills via the api Makefile.
# Requires the api repo to be a sibling on disk at ../api (the standard
# `~/Documents/InstaNode/{api,worker}` layout).
chaostest: chaostest-propagation chaostest-lease-recovery
chaostest-propagation:
@: $${E2E_PLATFORM_DB_URL:?set E2E_PLATFORM_DB_URL — see CHAOS-DRILL-2026-05-20.md}
$(MAKE) -C ../api chaostest-propagation
chaostest-lease-recovery:
@: $${E2E_PLATFORM_DB_URL:?set E2E_PLATFORM_DB_URL — see CHAOS-DRILL-2026-05-20.md}
$(MAKE) -C ../api chaostest-lease-recovery