-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
127 lines (105 loc) · 4.02 KB
/
Copy pathMakefile
File metadata and controls
127 lines (105 loc) · 4.02 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
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
122
123
124
125
126
127
MAKEFILE_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(MAKEFILE_DIR)/standard_defs.mk
PMD_IMAGE = blockchaintp/pmd:latest
build: $(MARKERS)/build_docker
test: $(MARKERS)/test_jest $(MARKERS)/test_tape
analyze: analyze_fossa analyze_sonar_js
clean: fix_permissions clean_container
clean_dirs_standard: fix_permissions
distclean: clean_docker clean_npm
$(MARKERS)/build_docker:
docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.test.yml build
touch $@
.PHONY: clean_container
clean_container:
docker-compose -f docker-compose.test.yml down -v || true
docker-compose -f docker-compose.yml down -v || true
docker-compose -f docker-compose.test.yml rm -f || true
docker-compose -f docker-compose.yml rm -f || true
.PHONY: clean_docker
clean_docker:
docker-compose -f docker-compose.test.yml down -v --rmi all || true
docker-compose -f docker-compose.yml down -v --rmi all || true
.PHONY: clean_npm
clean_npm:
rm -rf node_modules
$(MARKERS)/test_tape: $(MARKERS)/build_docker
docker-compose -f docker-compose.test.yml up -d
docker-compose -f docker-compose.test.yml exec -T api npm run test || true
mkdir -p build/tape
docker cp api_test:/tmp/test.out ./build/tape/results.tap || true
docker cp api_test:/tmp/junit.xml ./build/tape/junit.xml || true
docker cp api_test:/tmp/lcov.info ./build/tape/ || true
docker cp api_test:/tmp/lcov-report ./build/tape/ || true
docker-compose -f docker-compose.test.yml down -v || true
docker-compose -f docker-compose.test.yml rm -f || true
touch $@
$(MARKERS)/test_jest: $(MARKERS)/build_docker
docker run -w /app/api --rm -v $$(pwd)/build:/app/api/build \
-v /var/run/docker.sock:/var/run/docker.sock \
--network host \
--entrypoint bash sextant-api:$(ISOLATION_ID) -c "npm run test:jest"
$(BUSYBOX_ROOT) find /project -type d -exec chown -R $(UID):$(GID) {} \;
touch $@
test: $(MARKERS)/test_report_merge
$(MARKERS)/test_report_merge: $(MARKERS)/test_jest $(MARKERS)/test_tape
docker run -w /app/api --rm -v $$(pwd)/build:/app/api/build \
--entrypoint bash sextant-api:$(ISOLATION_ID) -c "npm run merge:junit"
docker run -w /app/api --rm -v $$(pwd)/build:/app/api/build \
--entrypoint bash sextant-api:$(ISOLATION_ID) -c "npm run merge:coverage"
touch $@
$(MARKERS)/build_npm_ci: $(MARKERS)/asdf
npm ci
touch $@
.PHONY: docs
docs:
mkdir -p docs/api
docker run --rm -v $(PWD)/docs/api:/app/api/build \
sextant-api:$(ISOLATION_ID) run generate-swagger
$(BUSYBOX_ROOT) find /project -type d -exec chown -R $(UID):$(GID) {} \;
find docs/api -type f -exec sed -i 's/[ \t]*$$//' {} \;
update-helm-fixtures: build
docker run -it --rm --entrypoint bash -w /app/api \
-v $(PWD)/test/fixtures:/app/api/test/fixtures \
sextant-api:$(ISOLATION_ID) -c " \
npm run download-helm-charts && \
tar -cvzf /tmp/helmCharts.tar.gz helmCharts && \
cp /tmp/helmCharts.tar.gz /app/api/test/fixtures/helmCharts.tar.gz \
"
.PHONY: run-local
run-local: $(MARKERS)/build_docker
docker-compose -f docker-compose.localtest.yml up -d
docker logs -f api_test | npx pino-pretty
.PHONY: stop-local
stop-local:
docker-compose -f docker-compose.localtest.yml down
rm -f $(MARKERS)/build_docker
.PHONY: clean-local
clean-local:
docker-compose -f docker-compose.localtest.yml down -v
rm -f $(MARKERS)/build_docker
export ASDF_DIR ?= $(HOME)/.asdf
export ASDF_BIN ?= $(ASDF_DIR)/bin
export ASDF_USER_SHIMS ?= $(ASDF_DIR)/shims
export PATH := $(ASDF_BIN):$(PATH)
export PATH := $(ASDF_USER_SHIMS):$(PATH)
$(MARKERS)/asdf_installed:
if [ ! -d $(ASDF_DIR)/.git ]; then \
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.2; \
asdf update; \
asdf plugin update --all; \
fi
touch $@
$(MARKERS)/asdf_plugins: $(MARKERS)/asdf_installed
if [ -r .tool-versions ]; then \
cat .tool-versions | awk '{print $$1}' | xargs -n1 asdf plugin add || true ;\
fi
if [ -r $(HOME)/.tool-versions ]; then \
cat $(HOME)/.tool-versions | awk '{print $$1}' | xargs -n1 asdf plugin add || true ;\
fi
touch $@
$(MARKERS)/asdf: $(MARKERS)/asdf_plugins
asdf install
asdf current
touch $@