-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (46 loc) · 2.13 KB
/
Makefile
File metadata and controls
59 lines (46 loc) · 2.13 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
# Copyright 2020-2022 JackTrip Labs, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
GIT_SHA = `git rev-parse --short=12 HEAD`
.PHONY: all agent fmt lint
all: lint fmt agent-amd64 agent-arm
local:
@go build -ldflags "-X main.GitSHA=${GIT_SHA}" -o jacktrip-agent ./cmd
agent-amd64:
@docker buildx build --build-arg GIT_SHA=${GIT_SHA} --platform linux/amd64 --target=artifact --output type=local,dest=./ .
agent-arm:
@docker buildx build --build-arg GIT_SHA=${GIT_SHA} --platform linux/arm/v7 --target=artifact --output type=local,dest=./ .
test:
@docker buildx build -f Dockerfile.test --target=artifact --output type=local,dest=./artifacts .
lint:
@docker buildx build -f Dockerfile.lint .
fmt:
@gofmt -l -w `find ./ -name "*.go"`
# You need to disable root user logic in cmd/main.go
run_server:
@go run ./cmd -s
ssh:
@sshpass -p jacktrip ssh pi@jacktrip.local
update_device: agent-arm
@mv jacktrip-agent-arm jacktrip-agent
@echo 'built a jacktrip-agent binary'
@sshpass -p jacktrip ssh pi@jacktrip.local "sudo mount -o remount,rw / && sudo rm /usr/local/bin/jacktrip-agent" || true
@echo 'removed jacktrip-agent binary from the device'
@sshpass -p jacktrip scp jacktrip-agent pi@jacktrip.local:~
@echo 'copied local jacktrip-agent binary into the device'
@sshpass -p jacktrip ssh pi@jacktrip.local "sudo mount -o remount,rw / && sudo mv ~/jacktrip-agent /usr/local/bin/jacktrip-agent && sudo systemctl restart jacktrip-agent.service"
@echo 'restarted the service'
small-tests:
@go clean -testcache
@mkdir -p artifacts
@gotestsum -f standard-verbose --junitfile artifacts/results-small.xml -- -coverprofile=artifacts/coverage.out -tags=unit ./...