-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
61 lines (52 loc) · 2.18 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
52
53
54
55
56
57
58
59
60
61
SHELL ?= /bin/bash
################################################################################
# Tests #
# #
# These targets are used by our continuous integration processes. Use these #
# directly at your own risk -- they assume required tools (and correct #
# versions thereof) to be present on your system. #
# #
# If you prefer to executes these tasks in a container that is pre-loaded with #
# required tools, refer to the hacking section toward the bottom of this file. #
################################################################################
.PHONY: lint
lint:
golangci-lint run
.PHONY: test-unit
test-unit:
go test \
-v \
-timeout=120s \
-race \
-coverprofile=coverage.txt \
-covermode=atomic \
./...
################################################################################
# Hack: Targets to help you hack #
# #
# These targets minimize required developer setup by executing in a container #
# that is pre-loaded with required tools. #
################################################################################
DOCKER_CMD := docker run \
-it \
--rm \
-v gomodcache:/go/pkg/mod \
-v $(dir $(realpath $(firstword $(MAKEFILE_LIST)))):/workspaces/kargo-render \
-w /workspaces/kargo-render \
kargo-render:dev-tools
.PHONY: hack-build-dev-tools
hack-build-dev-tools:
docker build -f Dockerfile.dev -t kargo-render:dev-tools .
.PHONY: hack-lint
hack-lint: hack-build-dev-tools
$(DOCKER_CMD) make lint
.PHONY: hack-test-unit
hack-test-unit: hack-build-dev-tools
$(DOCKER_CMD) make test-unit
.PHONY: hack-build
hack-build:
docker build \
--build-arg GIT_COMMIT=$(shell git rev-parse HEAD) \
--build-arg GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi) \
--tag kargo-render:dev \
.