-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
32 lines (26 loc) · 1.44 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
VERSION?=$(shell gogitver)
COMMIT_HASH:=$(shell git rev-parse HEAD)
COMMIT_DATE:=$(shell git show -s --format=%cd --date=format:%Y-%m-%dT%T%z HEAD)
IMAGE?=syncromatics/kvetch
BUILD_FLAGS:=\
-X github.com/syncromatics/kvetch/internal/cmd/kvetchctl.version=$(VERSION) \
-X github.com/syncromatics/kvetch/internal/cmd/kvetchctl.commit=$(COMMIT_HASH) \
-X github.com/syncromatics/kvetch/internal/cmd/kvetchctl.date=$(COMMIT_DATE)
build: proto-lint
docker build --build-arg "BUILD_FLAGS=$(BUILD_FLAGS)" -t testing:$(VERSION) --target test .
docker build --build-arg "BUILD_FLAGS=$(BUILD_FLAGS)" -t $(IMAGE):$(VERSION) --target final .
docker build --build-arg "BUILD_FLAGS=$(BUILD_FLAGS)" -t package:$(VERSION) --target package .
test: build
docker run --rm -v $(PWD)/artifacts:/artifacts -v /var/run/docker.sock:/var/run/docker.sock testing:$(VERSION)
cd artifacts && curl -s https://codecov.io/bash | bash
proto-lint:
docker run --rm -v "$(PWD)/docs/protos:/work" uber/prototool:latest prototool lint
package: build
docker run --rm -v $$PWD:/data --entrypoint cp package:$(VERSION) -R . /data/artifacts
ship:
docker login --username $(DOCKER_USERNAME) --password $(DOCKER_PASSWORD)
docker push $(IMAGE):$(VERSION)
generate: proto-lint
mkdir -p internal/protos
docker run --rm -v "$(PWD)/docs/protos:/work" -v $(PWD):/output uber/prototool:latest prototool generate
docker run --rm -v "$(PWD):/work" --workdir /work golang:1.14 go run internal/cobraDocs.go