Makefile RawHistoryFolder
1.PHONY: install test test-installer lint mocks demo remote-acceptance protocol protocol-check
2
3install:
4 go install .
5 @bin="$$(go env GOBIN)"; \
6 if [ -z "$$bin" ]; then bin="$$(go env GOPATH)/bin"; fi; \
7 mkdir -p "$$bin"; \
8 install -m 0755 scripts/vev-bar-top-right scripts/vev-bar-bottom-right "$$bin"
9
10test:
11 go test ./... -race
12 python3 -m unittest discover -s scripts/remote-resilience-harness -p '*_test.py'
13
14test-installer:
15 sh scripts/install_platform_test.sh
16
17# Generated *.pb.go files are byte-reproducible via protocol-check and
18# are never edited; protoc-gen-go import grouping is not
19# goimports-clean, so lint covers hand-written sources only.
20lint:
21 @test -z "$$(for f in $$(git ls-files --cached --others --exclude-standard '*.go' | grep -v '\.pb\.go$$'); do test -f "$$f" && printf '%s\n' "$$f"; done | xargs -r goimports -l)"
22 go vet ./...
23
24mocks:
25 @version="$$(mockery version 2>/dev/null || true)"; \
26 if [ "$$version" != "v3.8.0" ]; then \
27 echo "mockery v3.8.0 required; install with: go install github.com/vektra/mockery/v3@v3.8.0" >&2; \
28 exit 1; \
29 fi
30 mockery
31
32remote-acceptance:
33 scripts/remote-picker-harness/run.sh
34
35.PHONY: remote-resilience-visual
36remote-resilience-visual:
37 python3 scripts/remote-resilience-harness/visual.py
38
39# protocol regenerates the Protobuf wire contract from
40# internal/protocol/wire/schema using the pinned Go tools (buf + protoc-gen-go).
41protocol:
42 go tool buf lint
43 go tool buf format --diff --exit-code
44 go tool buf generate
45
46# protocol-check verifies the checked-in generated code is current: it
47# regenerates into a temporary directory and diffs the full file set.
48protocol-check:
49 go tool buf lint
50 go tool buf format --diff --exit-code
51 tmp="$$(mktemp -d)"; \
52 trap 'rm -rf "$$tmp"' EXIT; \
53 go tool buf generate --output "$$tmp"; \
54 genfile="$$(find "$$tmp" -name 'envelope.pb.go' -print -quit)"; \
55 test -n "$$genfile" || { echo "buf generate produced no envelope.pb.go"; exit 1; }; \
56 genroot="$$(dirname "$$genfile")"; \
57 for f in internal/protocol/wire/*.pb.go; do b="$$(basename "$$f")"; cmp -s "$$genroot/$$b" "$$f" || { echo "stale generated file: $$f"; exit 1; }; done; \
58 genfiles="$$(cd "$$genroot" && ls *.pb.go | sort)"; \
59 repofiles="$$(cd internal/protocol/wire && ls *.pb.go | sort)"; \
60 test "$$genfiles" = "$$repofiles" || { echo "generated file set differs"; echo "generated: $$genfiles"; echo "checked in: $$repofiles"; exit 1; }; \
61 test -z "$$(git status --porcelain -- internal/protocol/wire/*.pb.go)"
62
63demo:
64 go build -o build/vev .
65 docker build -f scripts/demo/Dockerfile -t vev-demo .
66 ./scripts/demo/run.sh demo.tape
67 # vhs cannot emit a transparent margin, so cut the window out after the
68 # fact: everything outside the rounded window rect becomes GIF
69 # transparency, plus a 2px edge stroked along the window. The geometry
70 # mirrors demo.tape (1200x750 canvas, margin 20, border radius 10); keep
71 # them in sync. ffmpeg streams the clip frame by frame, so peak memory
72 # stays flat; the previous imagemagick -coalesce pipeline needed the whole
73 # ~22GiB uncompressed clip at once and either crawled for an hour on its
74 # disk cache or got OOM-killed — do not go back to it.
75 docker run --rm --entrypoint magick -v "$(CURDIR)/scripts/demo/out:/out" vev-demo \
76 -size 1200x750 xc:none -fill none -stroke "#30363D" -strokewidth 2 \
77 -draw "roundrectangle 21,21 1178,728 9,9" /out/border.png
78 docker run --rm --entrypoint magick -v "$(CURDIR)/scripts/demo/out:/out" vev-demo \
79 -size 1200x750 xc:black -fill white \
80 -draw "roundrectangle 20,20 1179,729 10,10" /out/mask.png
81 # alphamerge applies the mask after the border overlay so the mask clips
82 # the stroke's antialiased overflow, which a GIF's 1-bit alpha cannot
83 # represent; paletteuse's alpha_threshold folds the rest into that 1-bit
84 # alpha (palettegen reserves the transparent slot).
85 docker run --rm --entrypoint ffmpeg -v "$(CURDIR)/scripts/demo/out:/out" vev-demo \
86 -y -v error -i /out/demo.gif -i /out/border.png -i /out/mask.png \
87 -filter_complex "[0:v][1:v]overlay=0:0[bordered];[2:v]format=gray[m];[bordered][m]alphamerge,split[a][b];[a]palettegen=reserve_transparent=1[p];[b][p]paletteuse=alpha_threshold=128" \
88 /out/demo-masked.gif
89 # Keep the final GIF lossless: the streaming FFmpeg pass has already
90 # bounded memory, and preserving terminal chrome avoids color banding.
91 docker run --rm --entrypoint gifsicle -v "$(CURDIR)/scripts/demo/out:/out" vev-demo --no-conserve-memory -O3 -o /out/demo.gif /out/demo-masked.gif
92 # Temp files are owned by the container's subuid, so remove them from
93 # inside a container rather than the host.
94 docker run --rm --entrypoint sh -v "$(CURDIR)/scripts/demo/out:/out" vev-demo -c 'rm /out/demo-masked.gif /out/mask.png /out/border.png'
95 mkdir -p docs/assets
96 cp scripts/demo/out/demo.gif docs/assets/demo.gif