-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (47 loc) · 1.69 KB
/
Copy pathMakefile
File metadata and controls
56 lines (47 loc) · 1.69 KB
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
PROJECT_WORKSPACE ?= $(CURDIR)
DOCKER_IMAGE_NAME ?= newrelic/nri-statsd
DOCKER_IMAGE_TAG ?= test
TEST_IMAGE_TAG ?= 1.25.3-alpine3.21
DOCKER_BUILD_CMD ?= docker build --pull \
--no-cache \
-t $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) \
.
DOCKER_TEST_CMD ?= docker run -i \
-v $(HOME)/.docker/:/root/.docker/ \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(PROJECT_WORKSPACE):/nri-statsd \
-w /nri-statsd/tests/integration \
--add-host host.docker.internal:host-gateway \
-p "8081:8081" \
-e CGO_ENABLED=0 \
-e DOCKER_DEFAULT_PLATFORM=linux/$(ARCH) \
-e "TC_HOST=host.docker.internal" \
golang:$(TEST_IMAGE_TAG) \
sh -c 'go clean -testcache && go test -v .'
buildTargetArch=$(word 2,$(subst -, ,$@))
.PHONY : docker-%
docker-% : export ARCH=$(call buildTargetArch, $@)
docker-% :
@printf '\n================================================================\n'
@printf 'Target: $@\n'
@printf '\n================================================================\n'
@DOCKER_DEFAULT_PLATFORM=linux/$(ARCH) $(DOCKER_BUILD_CMD)
.PHONY : build/docker-amd64
build/docker-amd64:
@$(MAKE) docker-amd64
.PHONY : build/docker-arm64
build/docker-arm64:
@$(MAKE) docker-arm64
.PHONY : tests-%
tests-% : export ARCH=$(call buildTargetArch, $@)
tests-% :
@printf '\n================================================================\n'
@printf 'Target: $@\n'
@printf '\n================================================================\n'
@$(DOCKER_TEST_CMD)
.PHONY : integration-tests-amd64
integration-tests-amd64: build/docker-amd64
@$(MAKE) tests-amd64
.PHONY : integration-tests-arm64
integration-tests-arm64: build/docker-arm64
@$(MAKE) tests-arm64