소스 검색

added makefile

aeth 2 일 전
부모
커밋
b1863bdbb3
2개의 변경된 파일30개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      .gitignore
  2. 27 0
      Makefile

+ 3 - 0
.gitignore

@@ -25,3 +25,6 @@ _testmain.go
 *.prof
 
 *.env
+
+# ignoring build directory
+build/

+ 27 - 0
Makefile

@@ -0,0 +1,27 @@
+.PHONY: build format test coverage dev-run install
+
+BIN = gluetun-qbitt-sidecar
+build:
+	mkdir ./build && go build -o ./build/$(BIN) ./main.go
+
+install:
+	sudo cp ./build/$(BIN) /usr/local/bin/
+
+format:
+	go fmt ./...
+
+test:
+	go test -v ./...
+
+
+coverage-html:
+	mkdir -p coverage/
+	go test -v ./... -covermode=count -coverpkg=./... -coverprofile coverage/coverage.out
+	go tool cover -html coverage/coverage.out -o coverage/coverage.html
+
+coverage:
+	go test ./... -cover
+
+
+dev-run: build
+	./build/$(BIN)