-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (31 loc) · 945 Bytes
/
Makefile
File metadata and controls
39 lines (31 loc) · 945 Bytes
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
.PHONY: default test build
OS := $(shell uname)
VERSION ?= 1.0.0
APPNAME := ecommerce
# target #
default: unit-test integration-test build run
build:
mkdir -p bin
@echo "Setup ecommerce"
ifeq ($(OS), Linux)
@echo "Build ecommerce..."
GOOS=linux go build -ldflags "-s -w -X main.Version=$(VERSION)" -o ./bin/$(APPNAME) main.go
else
@echo "Build $(OS)"
go build -ldflags "-s -w -X main.Version=$(VERSION)" -o ./bin/$(APPNAME) main.go
endif
ifeq ($(OS) ,Darwin)
@echo "Build ecommerce..."
GOOS=darwin go build -ldflags "-X main.Version=$(VERSION)" -o ./bin/$(APPNAME) main.go
endif
ifeq ($(OS),Windows_NT)
GOOS=windows GOARCH=amd64 go build -o ./bin/$(APPNAME).exe main.go
endif
@echo "Succesfully Build for ${OS} version:= ${VERSION}"
# Test Packages
unit-test:
@go test -count=1 -v --cover ./... -tags="unit"
integration-test:
@go test -count=1 -v --cover -tags="integration" -p 1 ./... --env-path=.env
run:
./bin/ecommerce