-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile
58 lines (48 loc) · 1.99 KB
/
Makefile
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
version := $(shell git describe --tags)
.PHONY: prepare_test
prepare_test:
curl https://raw.githubusercontent.com/OdyseeTeam/gody-cdn/master/db-init.sql -o init.sql
cp config.example.json config.json
@if command -v docker-compose >/dev/null 2>&1; then \
docker-compose up -d mysql; \
else \
docker compose up -d mysql; \
fi
# rm init.sql
.PHONY: test
test:
go test -cover ./...
.PHONY: test_ci
test_ci:
go install golang.org/x/tools/cmd/cover@latest
go install github.com/mattn/goveralls@latest
go install github.com/jandelgado/gcov2lcov@latest
go test -covermode=count -coverprofile=coverage.out ./...
gcov2lcov -infile=coverage.out -outfile=coverage.lcov
linux:
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -o dist/linux_amd64/odysee_player -ldflags "-s -w -X github.com/OdyseeTeam/player-server/internal/version.version=$(version)"
macos:
CGO_ENABLED=0 GOARCH=amd64 GOOS=darwin go build -o dist/darwin_amd64/odysee_player -ldflags "-s -w -X github.com/OdyseeTeam/player-server/internal/version.version=$(version)"
version := $(shell git describe --abbrev=0 --tags|sed 's/v//')
cur_branch := $(shell git rev-parse --abbrev-ref HEAD)
.PHONY: image
image:
docker buildx build -t odyseeteam/player-server:$(version) -t odyseeteam/player-server:latest -t odyseeteam/player-server:$(cur_branch) --platform linux/amd64 .
version := $(shell git describe --abbrev=0 --tags|sed 's/v//')
.PHONY: publish_image
publish_image:
docker push odyseeteam/player-server:$(version)
docker tag odyseeteam/player-server:$(version) odyseeteam/player-server:latest odyseeteam/player-server:$(cur_branch)
docker push odyseeteam/player-server:latest
tag := $(shell git describe --abbrev=0 --tags)
.PHONY: retag
retag:
@echo "Re-setting tag $(tag) to the current commit"
git push origin :$(tag)
git tag -d $(tag)
git tag $(tag)
.PHONY: dev hotdev
dev:
go run . --upstream-reflector=reflector.lbry.com:5568 --verbose --hot-cache-size=50M
hotdev:
reflex --decoration=none --start-service=true --regex='\.go$$' make dev