This repository has been archived by the owner on Aug 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (41 loc) · 1.65 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
.PHONY: dev test doc
APP_NAME := ot-auth
APP_PATH := github.com/open-trust/ot-auth
APP_VERSION := $(shell git describe --tags --always --match "v[0-9]*")
dev:
@CONFIG_FILE_PATH=${PWD}/config/default.yaml APP_ENV=testing go run main.go
test:
@CONFIG_FILE_PATH=${PWD}/config/test.yaml APP_ENV=testing go test -v ./...
doc:
widdershins --language_tabs 'shell:Shell' 'http:HTTP' --summary doc/openapi.yaml -o doc/openapi.md
BUILD_TIME := $(shell date -u +"%FT%TZ")
BUILD_COMMIT := $(shell git rev-parse HEAD)
.PHONY: build build-linux
build:
@mkdir -p ./dist
GO111MODULE=on go build -ldflags "-X ${APP_PATH}/src/conf.AppName=${APP_NAME} \
-X ${APP_PATH}/src/conf.AppVersion=${APP_VERSION} \
-X ${APP_PATH}/src/conf.BuildTime=${BUILD_TIME} \
-X ${APP_PATH}/src/conf.GitSHA1=${BUILD_COMMIT}" \
-o ./dist/ot-auth main.go
build-linux:
@mkdir -p ./dist
GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X ${APP_PATH}/src/conf.AppName=${APP_NAME} \
-X ${APP_PATH}/src/conf.AppVersion=${APP_VERSION} \
-X ${APP_PATH}/src/conf.BuildTime=${BUILD_TIME} \
-X ${APP_PATH}/src/conf.GitSHA1=${BUILD_COMMIT}" \
-o ./dist/ot-auth main.go
PKG_LIST := $(shell go list ./... | grep -v /vendor/)
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/)
.PHONY: coverhtml
coverhtml:
@mkdir -p coverage
@CONFIG_FILE_PATH=${PWD}/config/test.yaml go test -coverprofile=coverage/cover.out ./...
@go tool cover -html=coverage/cover.out -o coverage/coverage.html
@go tool cover -func=coverage/cover.out | tail -n 1
IMAGE_TAG := ${APP_NAME}:latest
.PHONY: image oci-image
image:
docker build --rm -t ${IMAGE_TAG} .
oci-image:
podman build --rm -t ${IMAGE_TAG} .