-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
34 lines (30 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
33
34
DOCKER_IMAGE_VERSION = v1.3.1
# use this rule as the default make rule
.DEFAULT_GOAL = help
.PHONY: help
help:
@echo "Available targets descriptions:"
@grep -E '^[%a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: lint-all lint-go lint-markdown lint-yaml
lint-all: docker-lint-go docker-lint-markdown docker-lint-yaml ## Run all possible linters
lint-go: docker-lint-go ## Lint go files
lint-markdown: docker-lint-markdown ## Lint markdown files
lint-yaml: docker-lint-yaml ## Lint yaml files
.PHONY: test-all test-go test-go-deps test-go-fast
test-all: docker-test-go docker-test-go-deps ## Run all possible tests
test-go: docker-test-go ## Test go code
test-go-deps: docker-test-go-deps ## Test go dependencies
test-go-fast: docker-test-go-fast ## Fast test co code
.PHONY: docker-%
# specify a special reusable volume for go-related docker builds
docker-%-go: DOCKER_RUN_OPTS += --mount type=volume,source='gomodcache',target='/go/pkg/mod/'
docker-%: DIR_ABS := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
docker-%:
@docker pull "krostar/ci:$(*).$(DOCKER_IMAGE_VERSION)" 2>&1 > /dev/null
@docker --log-level warn run \
--rm \
--tty \
--mount type=bind,source="$(DIR_ABS)",target=/app \
$(DOCKER_RUN_OPTS) \
"krostar/ci:$(*).$(DOCKER_IMAGE_VERSION)" \
$(DOCKER_RUN_ARGS)