-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (59 loc) · 2.29 KB
/
Copy pathMakefile
File metadata and controls
75 lines (59 loc) · 2.29 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
.PHONY: all
all: test check coverage build
# templ version used to generate *_templ.go from *.templ. Keep in sync with the
# github.com/a-h/templ require in go.mod.
TEMPL_VERSION := v0.3.1020
.PHONY: build
build: templ livesim2 dashfetcher cmaf-ingest-receiver
.PHONY: templ
templ:
go run github.com/a-h/templ/cmd/templ@$(TEMPL_VERSION) generate
# templ-check regenerates the templ code and fails if it differs from what is
# committed. Use in CI/pre-commit so generated *_templ.go never goes stale.
.PHONY: templ-check
templ-check:
go run github.com/a-h/templ/cmd/templ@$(TEMPL_VERSION) generate
git diff --exit-code -- '*_templ.go'
.PHONY: prepare
prepare:
go mod tidy
livesim2 dashfetcher cmaf-ingest-receiver:
go build -ldflags "-X github.com/Dash-Industry-Forum/livesim2/internal.commitVersion=$$(git describe --tags HEAD) -X github.com/Dash-Industry-Forum/livesim2/internal.commitDate=$$(git log -1 --format=%ct)" -o out/$@ ./cmd/$@/main.go
forlinux: prepare
GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/Dash-Industry-Forum/livesim2/internal.commitVersion=$$(git describe --tags HEAD) -X github.com/Dash-Industry-Forum/livesim2/internal.commitDate=$$(git log -1 --format=%ct)" -o out-linux/livesim2 ./cmd/livesim2/main.go
GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/Dash-Industry-Forum/livesim2/internal.commitVersion=$$(git describe --tags HEAD) -X github.com/Dash-Industry-Forum/livesim2/internal.commitDate=$$(git log -1 --format=%ct)" -o out-linux/dashfetcher ./cmd/dashfetcher/main.go
.PHONY: test
test: prepare templ
go test ./...
.PHONY: coverage
coverage:
# Ignore (allow) packages without any tests
set -o pipefail
go test ./... -coverprofile coverage.out
set +o pipefail
go tool cover -html=coverage.out -o coverage.html
go tool cover -func coverage.out -o coverage.txt
tail -1 coverage.txt
.PHONY: check
check: prepare templ
golangci-lint run
.PHONY: clean
clean:
rm -f out/*
rm -r examples-out/*
.PHONY: install
install: all
cp out/* $(GOPATH)/bin/
.PHONY: venv
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install pre-commit==4.2.0
.PHONY: pre-commit
pre-commit: venv
source venv/bin/activate && venv/bin/pre-commit run --all-files
.PHONY: update
update:
go get -t -u ./...
.PHONY: check-licenses
check-licenses: prepare
wwhrd check