-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathMakefile.old.full
More file actions
122 lines (106 loc) · 3.52 KB
/
Makefile.old.full
File metadata and controls
122 lines (106 loc) · 3.52 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Makefile
MONOREPO_ROOT := ../
export MONOREPO_REVISION ?= $(shell git rev-parse HEAD | cut -c1-6)
export BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
export OVERLEAF_BASE_BRANCH ?= ghcr.io/paperdebugger/sharelatex-base:$(BRANCH_NAME)
export OVERLEAF_BASE_LATEST ?= ghcr.io/paperdebugger/sharelatex-base
export OVERLEAF_BASE_TAG ?= ghcr.io/paperdebugger/sharelatex-base:$(BRANCH_NAME)-$(MONOREPO_REVISION)
export OVERLEAF_BRANCH ?= ghcr.io/paperdebugger/sharelatex:$(BRANCH_NAME)
export OVERLEAF_LATEST ?= ghcr.io/paperdebugger/sharelatex
export OVERLEAF_TAG ?= ghcr.io/paperdebugger/sharelatex:$(BRANCH_NAME)-$(MONOREPO_REVISION)
export PAPERDEBUGGER_BRANCH ?= ghcr.io/paperdebugger/sharelatex-paperdebugger:$(BRANCH_NAME)
export PAPERDEBUGGER_LATEST ?= ghcr.io/paperdebugger/sharelatex-paperdebugger
export PAPERDEBUGGER_TAG ?= ghcr.io/paperdebugger/sharelatex-paperdebugger:$(BRANCH_NAME)-$(MONOREPO_REVISION)
.PHONY: all
all: build-base build-community image push
.PHONY: build-base
build-base:
cd ../server-ce && \
cp .dockerignore $(MONOREPO_ROOT) && \
docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--progress=plain \
--file Dockerfile-base \
--pull \
--cache-from $(OVERLEAF_BASE_LATEST) \
--cache-from $(OVERLEAF_BASE_BRANCH) \
--tag $(OVERLEAF_BASE_TAG) \
--tag $(OVERLEAF_BASE_BRANCH) \
--tag $(OVERLEAF_BASE_LATEST) \
$(MONOREPO_ROOT)
.PHONY: build-community
build-community:
cd ../server-ce && \
cp .dockerignore $(MONOREPO_ROOT) && \
docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--progress=plain \
--build-arg OVERLEAF_BASE_TAG \
--build-arg MONOREPO_REVISION \
--cache-from $(OVERLEAF_LATEST) \
--cache-from $(OVERLEAF_BRANCH) \
--file Dockerfile \
--tag $(OVERLEAF_TAG) \
--tag $(OVERLEAF_BRANCH) \
--tag $(OVERLEAF_LATEST) \
$(MONOREPO_ROOT)
.PHONY: build
build:
mkdir -p dist
go build -o dist/pd.exe cmd/main.go
.PHONY: image
image:
docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--progress=plain \
--file Dockerfile \
--pull \
--cache-from $(OVERLEAF_BASE_LATEST) \
--cache-from $(OVERLEAF_BASE_BRANCH) \
--tag $(PAPERDEBUGGER_TAG) \
--tag $(PAPERDEBUGGER_BRANCH) \
--tag $(PAPERDEBUGGER_LATEST) \
.
.PHONY: push
push:
docker push $(OVERLEAF_BASE_TAG)
docker push $(OVERLEAF_BASE_LATEST)
docker push $(OVERLEAF_TAG)
docker push $(OVERLEAF_LATEST)
docker push $(PAPERDEBUGGER_TAG)
docker push $(PAPERDEBUGGER_LATEST)
.PHONY: deps
deps:
go install github.com/go-delve/delve/cmd/dlv@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latest
go install github.com/bufbuild/buf/cmd/buf@latest
go install github.com/google/wire/cmd/wire@latest
cd webapp/_webapp && npm install
.PHONY: gen
gen:
buf build
rm -rf pkg/gen
buf generate --template buf.gen.yaml
rm -rf webapp/_webapp/src/pkg/gen
buf generate --template buf.webapp.gen.yaml
wire gen ./internal
.PHONY: fmt
fmt:
buf format -w
go fmt ./...
cd webapp/_webapp && npm run format
.PHONY: lint
lint:
buf lint
golangci-lint run --verbose --fix -E gci
cd webapp/_webapp && npm run lint
.PHONY: test
test:
PD_MONGO_URI="mongodb://localhost:27017" go test -coverprofile=coverage.out ./cmd/... ./internal/... ./webapp/...
go tool cover -html=coverage.out -o coverage.html
.PHONY: test-view
test-view: test
go tool cover -html=coverage.out