-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (56 loc) · 1.61 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
# Makefile expects 2 required environment variables for
# build-with-cache and test targets:
# RLSECURE_ENCODED_LICENSE=
# RLSECURE_SITE_KEY=
ifeq ($(strip $(RLSECURE_ENCODED_LICENSE)),)
$(error mandatory RLSECURE_ENCODED_LICENSE not set!)
endif
ifeq ($(strip $(RLSECURE_SITE_KEY)),)
$(error mandatory RLSECURE_SITE_KEY not set!)
endif
IMAGE_NAME ?= reversinglabs/rl-scanner:test
LINE_LENGTH = 120
PL_LINTERS = "eradicate,mccabe,pycodestyle,pyflakes,pylint"
PL_IGNORE = C0114,C0115,C0116
SCRIPTS = scripts/
.PHONY: build-without-cache build-with-cache push clean format pycheck test test.%
all: clean prep build test
prep: format pylama mypy
build: build-with-cache
build-without-cache:
docker buildx build . -f Dockerfile.no_cache \
--no-cache \
-t $(IMAGE_NAME)
# --build-arg CACHE_PATH=/tmp/rl-secure.cache
build-with-cache:
docker buildx build . -f Dockerfile.cache \
--no-cache \
--secret id=rlsecure_license,env=RLSECURE_ENCODED_LICENSE \
--secret id=rlsecure_sitekey,env=RLSECURE_SITE_KEY \
-t $(IMAGE_NAME)
clean:
-docker rmi $(IMAGE_NAME)
rm -rf ./tests/*/report/
rm -rf ./tests/repro/store/
rm -rf ./tests/repro/report_base/
rm -rf ./tests/repro/report_repro_fail/
rm -rf ./tests/repro/report_repro_ok/
format:
black \
--line-length $(LINE_LENGTH) \
$(SCRIPTS)/*
pylama:
pylama \
--max-line-length $(LINE_LENGTH) \
--linters $(PL_LINTERS) \
--ignore $(PL_IGNORE) \
$(SCRIPTS)
mypy:
mypy \
--strict \
--no-incremental \
$(SCRIPTS)
all-tests := $(addprefix test., $(notdir $(wildcard tests/*)))
test.%: tests/%/run.sh
cd $(dir $<) && ./run.sh "$(IMAGE_NAME)"
test: $(all-tests)