-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
121 lines (107 loc) · 2.23 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
export COMPOSE_DOCKER_CLI_BUILD = 1
export DOCKER_BUILDKIT = 1
export COMPOSE_PROJECT_NAME = data-warehouse
export ARCH = $(shell uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
export META = $(shell git rev-parse --abbrev-ref HEAD 2> /dev/null | sed 's:.*/::')
export VERSION = $(shell git fetch --tags --force 2> /dev/null; tags=($$(git tag --sort=-v:refname)) && ([ "$${\#tags[@]}" -eq 0 ] && echo v0.0.0 || echo $${tags[0]}) | sed -e "s/^v//")
.ONESHELL:
.PHONY: arm64
.PHONY: amd64
.PHONY: all
all: bootstrap sync test package bbtest
.PHONY: package
package:
@$(MAKE) bundle-binaries-$(ARCH)
@$(MAKE) bundle-debian-$(ARCH)
@$(MAKE) bundle-docker-$(ARCH)
.PHONY: bundle-binaries-%
bundle-binaries-%: %
@\
docker \
compose \
run \
--rm package \
--arch linux/$^ \
--source /project/services/data-warehouse \
--output /project/packaging/bin
.PHONY: bundle-debian-%
bundle-debian-%: %
@\
docker \
compose \
run \
--rm debian-package \
--version $(VERSION) \
--arch $^ \
--pkg data-warehouse \
--source /project/packaging
.PHONY: bundle-docker-%
bundle-docker-%: %
@\
docker \
build \
-t openbank/data-warehouse:$^-$(VERSION).$(META) \
-f packaging/docker/$^/Dockerfile \
.
.PHONY: bootstrap
bootstrap:
@\
docker \
compose \
build \
--force-rm scala
.PHONY: lint
lint:
@\
docker \
compose \
run \
--rm lint \
--source /project/services/data-warehouse \
|| :
.PHONY: sec
sec:
@\
docker \
compose \
run \
--rm sec \
--source /project/services/data-warehouse \
|| :
.PHONY: sync
sync:
@\
docker \
compose \
run \
--rm sync \
--source /project/services/data-warehouse
.PHONY: scan-%
scan-%: %
docker scan \
openbank/data-warehouse:$^-$(VERSION).$(META) \
--file ./packaging/docker/$^/Dockerfile \
--exclude-base
.PHONY: test
test:
@\
docker \
compose \
run \
--rm test \
--source /project/services/data-warehouse \
--output /project/reports/unit-tests
.PHONY: release
release:
@\
docker \
compose \
run \
--rm release \
--version $(VERSION) \
--token ${GITHUB_RELEASE_TOKEN}
.PHONY: bbtest
bbtest:
@docker compose up -d bbtest
@docker exec -t $$(docker compose ps -q bbtest) python3 /opt/app/bbtest/main.py
@docker compose down -v