-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
95 lines (72 loc) · 2.68 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
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
SHELL=/bin/bash
PROJECT_NAME=axectl
######################
# Go
.PHYONY: run build build_copy test test_cover get docs
run:
go run ./main.go
run_sonar:
go run ./main.go sonar
build: clean
mkdir -p ./bin/ ./bin/m1
CGO_ENABLED=0 GOOS=linux go build -o ./bin/${PROJECT_NAME} ./
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o ./bin/m1/linux/${PROJECT_NAME} ./
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o ./bin/m1/mac/${PROJECT_NAME} ./
build_copy:
rm ./bin/${PROJECT_NAME} || true
rm ~/.local/bin/${PROJECT_NAME} || true
CGO_ENABLED=0 GOOS=linux go build -o ./bin/${PROJECT_NAME} ./
mkdir -p ~/.local/bin/
cp ./bin/${PROJECT_NAME} ~/.local/bin/
clean:
rm ./bin/${PROJECT_NAME} || true
rm ~/.local/bin/${PROJECT_NAME} || true
test:
go test ./... -v -cover .
test_cover:
go test ./... -v -coverprofile cover.out
go tool cover -func ./cover.out | grep total | awk '{print $3}'
get:
go get ./...
docs:
godoc -http=:6060
######################
# common
.PHYONY: status scan
status:
ls -ltra
go run ./main.go --scan status
scan:
go run ./main.go sonar --scan -o "soyuntest" -p "test1,test2"
######################
# Vagrant
.PHYONY: vagrant_up vagrant_rm vagrant_ssh vagrant_ssh vagrant_reload vagrant_remote_deploy
vagrant_up:
VAGRANT_VAGRANTFILE=./infra/Vagrantfile vagrant up
vagrant_rm:
VAGRANT_VAGRANTFILE=./infra/Vagrantfile vagrant destroy --force && rm -fr .vagrant/
vagrant_ssh:
VAGRANT_VAGRANTFILE=./infra/Vagrantfile vagrant ssh
vagrant_reload:
VAGRANT_VAGRANTFILE=./infra/Vagrantfile vagrant reload
vagrant_remote_deploy: build_copy
scp -P 2222 ./bin/axectl [email protected]:.
######################
# Docker
.PHYONY: vagrant_up vagrant_rm vagrant_ssh vagrant_ssh vagrant_reload vagrant_remote_deploy
docker_build: build
docker build -f ./infra/Dockerfile . -t ${PROJECT_NAME}:latest
docker_start: docker_build
docker run -t --rm -v ${PWD}/bin/:/app ${PROJECT_NAME}:latest ls /app
docker_status: docker_build
docker run -t --rm -v ${PWD}/bin/:/app ${PROJECT_NAME}:latest ls -ltra /app/
docker_axectl: docker_build
docker run -t --rm -v ${PWD}/bin/:/app ${PROJECT_NAME}:latest bash -c /app/axectl
docker_axectl_install_sudo: docker_build
docker run -t --rm -v ${PWD}/bin/:/app ${PROJECT_NAME}:latest /bin/bash -c "apt update && apt install -y sudo"
docker_axectl_sonar: docker_build
docker run -t --rm -v ${PWD}/bin/:/app ${PROJECT_NAME}:latest /bin/bash -c "/app/axectl sonar"
docker_axectl_sonar_install: docker_build
docker run -t --rm -v ${PWD}/bin/:/app ${PROJECT_NAME}:latest /bin/bash -c "/app/axectl sonar -i"
docker_axectl_sonar_install_debug: docker_build
docker run -t --rm -v ${PWD}/bin/:/app ${PROJECT_NAME}:latest /bin/bash -c "/app/axectl sonar -i --debug"