feat: add makefile

This commit is contained in:
Urko 2023-04-08 22:30:32 +02:00
parent d7a14041eb
commit 89864b3daa
1 changed files with 31 additions and 0 deletions

31
Makefile Normal file
View File

@ -0,0 +1,31 @@
COVERAGE_DIR=coverage
BINARY_DIR=bin
BINARY_NAME=ess-etl-go
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
OS = macos
else ifeq ($(UNAME),Linux)
OS = linux
else
$(error OS not supported by this Makefile)
endif
PACKAGE = $(shell head -1 go.mod | awk '{print $$2}')
lint:
golangci-lint run ./...
goreportcard:
goreportcard-cli -v
test:
go test ./...
test-coverage:
rm -rf ${COVERAGE_DIR}
mkdir ${COVERAGE_DIR}
go test -v -coverprofile ${COVERAGE_DIR}/cover.out ./...
go tool cover -html ${COVERAGE_DIR}/cover.out -o ${COVERAGE_DIR}/cover.html
benchmark:
go test -run none -bench . -benchtime 3s -benchmem
build_server:
env GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -o ${BINARY_DIR}/${BINARY_NAME} ./main.go
run_server: build_server
./${BINARY_DIR}/${BINARY_NAME}