-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
65 lines (52 loc) · 1.77 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
62
63
64
65
# File : Makefile
PROJECT_NAME := logex
PWD := $(shell pwd)
DEBIAN_RELEASE ?= bookworm
GOLANG_VERSION ?= 1.21
export DOCKER_BUILDKIT=1
LINT := golangci-lint run --max-issues-per-linter 0 --max-same-issues 0 --verbose ./...
LINT_FIX := golangci-lint run --verbose --fix
TEST_UNIT := gotestsum --format testname ./... -- -p 1
.PHONY: lint
## Run non destructive lint over code base.
lint: build-check
$(info Run non destructive lint over codebase $(PWD))
docker run --volume $(PWD):/tmp/build/:ro $(PROJECT_NAME):check $(LINT)
.PHONY: lint-fix
## Run non destructive lint over code base.
lint-fix: build-check
$(info Run non destructive lint over codebase $(PWD))
docker run --volume $(PWD):/tmp/build/:ro $(PROJECT_NAME):check $(LINT_FIX)
.PHONY: test
## Run all available test suites.
test: test-unit test-integration test-smoke
$(info Run all available test suites)
.PHONY: test-unit
## Run available unittests, access to db/es instances is required
test-unit: build-check
$(info Run unit available unittests)
docker run --volume $(PWD):/tmp/build/:ro $(PROJECT_NAME):check $(TEST_UNIT)
.PHONY: test-integration
## Run integration test with external services
test-integration:
$(info Run integration test with external services)
echo TBA
.PHONY: test-smoke
## Run smoke test with external services
test-smoke:
$(info Run smoke test with external services)
echo TBA
DOCKER_BUILD_ARGS ?= \
--build-arg DEBIAN_RELEASE=$(DEBIAN_RELEASE) \
--build-arg GOLANG_VERSION=$(GOLANG_VERSION)
.PHONY: test-init
## Build isolated test container to use in all verity of tests.
build-check:
$(info Build isolated test container to use in all verity of tests)
docker build \
$(DOCKER_BUILD_ARGS) \
--file Dockerfile \
--tag $(PROJECT_NAME):check \
--target=golang-check \
.
# End of Makefile