-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
176 lines (125 loc) · 4.84 KB
/
Makefile
File metadata and controls
176 lines (125 loc) · 4.84 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
OS := $(shell uname)
.PHONY: all
all: build run
# Dependencies
# --------------------------------------------------------------------
.PHONY: install-dependencies install-linter install-protos install-fmter
install-dependencies: install-linter install-protos install-fmter
cd houston && npm install
install-linter:
# TODO: might as well just move this all to an install-linter script
$(info Installing golangci-lint for $(OS))
@if [ $(OS) = "Darwin" ] ; then\
brew install golangci-lint;\
brew upgrade golangci-lint;\
elif [ $(OS) = "Linux" ] ; then\
./scripts/install-linter-linux.sh ;\
fi;\
install-protos:
sudo apt-get update && sudo apt-get install -y protobuf-compiler
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
echo "You will need to set your PATH variable to include go installations, if you have not already done so."
install-fmter:
go install golang.org/x/tools/cmd/goimports@latest
# Build
# --------------------------------------------------------------------
.PHONY: pre-build build configure-git build-go build-react build-docker build-protos build-backend-protos build-frontend-protos
pre-build: configure-git
build: build-go build-react
configure-git:
git config --global url."git@github.com:".insteadOf "https://github.com/"
build-go: build-protos
go build
build-react:
npm run --prefix ./houston build
build-docker: build-react build-protos
DOCKER_BUILDKIT=1 docker build -t tritonuas/gcs -f build/package/Dockerfile .
build-protos: build-backend-protos build-frontend-protos
build-backend-protos: internal/protos/houston.pb.go internal/protos/obc.pb.go
internal/protos/houston.pb.go: protos/houston.proto
protoc -I=./protos/ --go_out=./internal/protos/ --go_opt=paths=source_relative ./protos/houston.proto
internal/protos/obc.pb.go: protos/obc.proto
protoc -I=./protos/ --go_out=./internal/protos/ --go_opt=paths=source_relative ./protos/obc.proto
build-frontend-protos: houston/src/protos/houston.pb.ts houston/src/protos/obc.pb.ts
houston/src/protos/houston.pb.ts: protos/houston.proto houston/node_modules/.bin/protoc-gen-ts_proto
protoc --plugin=houston/node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=fileSuffix=.pb --ts_proto_out=./houston/src/ ./protos/houston.proto
houston/src/protos/obc.pb.ts: protos/obc.proto
protoc --plugin=houston/node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=fileSuffix=.pb --ts_proto_out=./houston/src/ ./protos/obc.proto
protos/houston.proto:
git submodule update --init --recursive
protos/obc.proto: protos/houston.proto
houston/node_modules/.bin/protoc-gen-ts_proto:
cd houston && npm install
# Run
# --------------------------------------------------------------------
.PHONY: run run-docker run-compose stop-compose run-broach-compose develop clean-saved
run: build
./gcs
run-react-dev:
npm run --prefix ./houston dev
run-docker:
docker run -e --network=host --name gcs tritonuas/gcs
clean-saved:
rm -f internal/server/saved/targets.json
run-compose: clean-saved
docker compose -f deployments/docker-compose.yml up -d
stop-compose:
docker compose -f deployments/docker-compose.yml down
run-compose-mac: clean-saved
docker compose -f deployments/docker-compose-mac.yml up -d
stop-compose-mac:
docker compose -f deployments/docker-compose-mac.yml down
run-broach-compose:
docker compose -f deployments/broach-docker-compose.yml up -d
stop-broach-compose:
docker compose -f deployments/broach-docker-compose.yml down
develop:
make stop-compose && make build-docker && make run-compose
# Testing
# --------------------------------------------------------------------
.PHONY: test test-all clear-cache
test:
go test -race ./... && cd houston && npm test
# clears go cache before running tests
test-all: clear-cache test && cd houston && npm test
test-frontend:
cd houston && npm test
test-backend:
go test -race ./...
clear-cache:
go clean -testcache
# Style/formatting
# --------------------------------------------------------------------
.PHONY: fmt fmt-frontend fmt-backend fmt-check fmt-check-frontend fmt-check-backend
fmt: fmt-backend fmt-frontend
fmt-backend:
goimports -w -l $(GOFILES_NOVENDOR)
fmt-frontend:
npm run format
fmt-check: fmt-check-backend fmt-check-frontend
fmt-check-backend:
@changed=$$(goimports -l $(GOFILES_NOVENDOR)); \
if [ -n "$$changed" ]; then \
echo "Go files not formatted:"; \
echo "$$changed"; \
exit 1; \
fi
fmt-check-frontend:
npm run format:check
# Linting
# --------------------------------------------------------------------
.PHONY: lint
lint:
golangci-lint run && cd houston && npm run lint
lint-frontend:
cd houston && npm run lint
lint-backend:
golangci-lint run
# Checks
.PHONY: check
check: build-protos fmt-check lint test
# Just for Kimi <3 <3 uwu just for meee
# kimi was here
kimi:
git add -A ':!deployments/docker-compose-mac.yml'