feat: add build commands to makefile
This commit is contained in:
parent
44e9315706
commit
b32cb0595c
|
@ -4,3 +4,4 @@
|
||||||
coverage
|
coverage
|
||||||
.notes
|
.notes
|
||||||
uploads
|
uploads
|
||||||
|
bin
|
45
Makefile
45
Makefile
|
@ -1,4 +1,7 @@
|
||||||
COVERAGE_DIR=coverage
|
COVERAGE_DIR=coverage
|
||||||
|
BIN_DIR := ./bin
|
||||||
|
MAIN := ./cmd/http/server/main.go
|
||||||
|
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
golangci-lint run ./...
|
golangci-lint run ./...
|
||||||
|
@ -11,3 +14,45 @@ test-coverage:
|
||||||
mkdir ${COVERAGE_DIR}
|
mkdir ${COVERAGE_DIR}
|
||||||
go test -v -coverprofile ${COVERAGE_DIR}/cover.out ./...
|
go test -v -coverprofile ${COVERAGE_DIR}/cover.out ./...
|
||||||
go tool cover -html ${COVERAGE_DIR}/cover.out -o ${COVERAGE_DIR}/cover.html
|
go tool cover -html ${COVERAGE_DIR}/cover.out -o ${COVERAGE_DIR}/cover.html
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: local_run
|
||||||
|
local_run:
|
||||||
|
go run ./cmd/main.go --dir "$(DIR)" --bucket "$(BUCKET)"
|
||||||
|
|
||||||
|
.PHONY: build_linux_amd64
|
||||||
|
build_linux_amd64:
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
GOOS=linux GOARCH=amd64 go build -o $(BIN_DIR)/$(APP_NAME)_linux_amd64 $(MAIN)
|
||||||
|
|
||||||
|
.PHONY: build_linux_arm64
|
||||||
|
build_linux_arm64:
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
GOOS=linux GOARCH=arm64 go build -o $(BIN_DIR)/$(APP_NAME)_linux_arm64 $(MAIN)
|
||||||
|
|
||||||
|
.PHONY: build_windows_amd64
|
||||||
|
build_windows_amd64:
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
GOOS=windows GOARCH=amd64 go build -o $(BIN_DIR)/$(APP_NAME)_windows_amd64.exe $(MAIN)
|
||||||
|
|
||||||
|
.PHONY: build_windows_386
|
||||||
|
build_windows_386:
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
GOOS=windows GOARCH=386 go build -o $(BIN_DIR)/$(APP_NAME)_windows_386.exe $(MAIN)
|
||||||
|
|
||||||
|
.PHONY: build_mac_amd64
|
||||||
|
build_mac_amd64:
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
GOOS=darwin GOARCH=amd64 go build -o $(BIN_DIR)/$(APP_NAME)_mac_amd64 $(MAIN)
|
||||||
|
|
||||||
|
.PHONY: build_mac_arm64
|
||||||
|
build_mac_arm64:
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
GOOS=darwin GOARCH=arm64 go build -o $(BIN_DIR)/$(APP_NAME)_mac_arm64 $(MAIN)
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -rf $(BIN_DIR)
|
||||||
|
|
||||||
|
.PHONY: rebuild
|
||||||
|
rebuild: clean build_linux_amd64 build_linux_arm64 build_windows_amd64 build_windows_386 build_mac_amd64 build_mac_arm64
|
||||||
|
|
Loading…
Reference in New Issue