-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
230 lines (181 loc) · 6.11 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# ==========================================================
# ==========================================================
# https://docs.secure.software/cli
SHELL := /bin/bash -l
RLSECURE := ~/tmp/rl-secure/rl-secure
RLSTORE := ~/
WHAT := whoisdomain
DOCKER_WHO := mbootgithub
SIMPLEDOMAINS = $(shell ls testdata)
TEST_OPTIONS_ALL = --withPublicSuffix --extractServers --stripHttpStatus
# PHONY targets: make will run its recipe regardless of whether a file with that name exists or what its last modification time is.
.PHONY: TestSimple TestSimple2 TestAll clean
first: reformat mypy pylint testP39
testP39:
./test1.py # now tests with python 3.9
#testP36:
# docker build -t df36 -f Df-36 .
# docker run -v .:/context df36 -d google.com
second: first test2 test3 test
test:
LOGLEVEL=DEBUG ./test2.py $(TEST_OPTIONS_ALL) -t 2>2 | tee 1
test-all:
LOGLEVEL=DEBUG ./test2.py $(TEST_OPTIONS_ALL) -a 2>2 | tee 1
t4:
./t4.py 2>22 | tee out
# ==========================================================
# run a test sequence local only, no docker ,no upload to pypi
LocalTestSimple: reformat mypy test2
# ==========================================================
LocalTestWhl: build
./bin/testLocalWhl.sh 2>tmp/$@-2 | tee tmp/$@-1
# this step creates or updates the toml file
build: first
./bin/build.sh
./bin/testLocalWhl.sh 2>2 | tee 1
./bin/test.sh 2>2 | tee 1
# ==========================================================
# scan the most recent build and fail if the status fails
rlsecure: rlsecure-scan rlsecure-list rlsecure-status rlsecure-report rlsecure-version
rlsecure-scan:
@export VERSION=$(shell cat work/version) && \
$(RLSECURE) scan \
--rl-store $(RLSTORE) \
--purl mboot-github/$(WHAT)@$${VERSION} \
--file-path dist/$(WHAT)-$${VERSION}*.whl \
--replace \
--no-tracking
rlsecure-list:
@export VERSION=$(shell cat work/version) && \
$(RLSECURE) list \
--rl-store $(RLSTORE) \
--show-all \
--purl mboot-github/$(WHAT)@$${VERSION} \
--no-color | tee rlsecure/list-$${VERSION}.txt
rlsecure-status:
@export VERSION=$(shell cat work/version) && \
$(RLSECURE) status \
--rl-store $(RLSTORE) \
--purl mboot-github/$(WHAT)@$${VERSION} \
--show-all \
--return-status \
--no-color | tee rlsecure/status-$${VERSION}.txt
rlsecure-report:
@export VERSION=$(shell cat work/version) && \
$(RLSECURE) report \
--rl-store $(RLSTORE) \
--purl mboot-github/$(WHAT)@$${VERSION} \
--format=all \
--bundle=report-$(WHAT)-$${VERSION}.zip \
--output-path ./rlsecure
rlsecure-version:
@$(RLSECURE) --version
# ==========================================================
# build a docker images with the latest python and run a test -a
dockerTests: docker dockerRunLocal dockerTestdata
testdocker:
export VERSION=$(shell cat work/version) && \
docker build \
--build-arg VERSION \
--tag $(DOCKER_WHO)/$(WHAT)-test \
--tag $(DOCKER_WHO)/$(WHAT)-$${VERSION}-test \
--tag $(WHAT)-$${VERSION}-test \
--tag $(WHAT)-test \
-f Dockerfile-test .
docker image ls
docker container ls
docker run whoisdomain-test -t $(TEST_OPTIONS_ALL)
testdockerTestdata:
@export VERSION=$(shell cat work/version) && \
docker run \
-v ./testdata:/testdata \
$(WHAT)-$${VERSION}-test \
-f /testdata/DOMAINS.txt $(TEST_OPTIONS_ALL) 2>tmp/$@-2 | \
tee tmp/$@-1
docker:
export VERSION=$(shell cat work/version) && \
docker build \
--build-arg VERSION \
--tag $(DOCKER_WHO)/$(WHAT) \
--tag $(DOCKER_WHO)/$(WHAT)-$${VERSION} \
--tag $(WHAT)-$${VERSION} \
--tag $(WHAT) \
-f Dockerfile .
dockerRunLocal:
export VERSION=$(shell cat work/version) && \
docker run \
-v ./testdata:/testdata \
$(WHAT)-$${VERSION} \
-d google.com -j | jq -r .
dockerTestdata:
@export VERSION=$(shell cat work/version) && \
docker run \
-v ./testdata:/testdata \
$(WHAT)-$${VERSION} \
-f /testdata/DOMAINS.txt $(TEST_OPTIONS_ALL) 2>tmp/$@-2 | \
tee tmp/$@-1
dockerPush:
export VERSION=$(shell cat work/version) && \
docker image push \
--all-tags $(DOCKER_WHO)/$(WHAT)
docker run mbootgithub/whoisdomain -d google.com -j | jq -r .
# ====================================================
# uploading to pypi an pypiTestUpload
# build a test-mypi and download the image in a venv ane run a test
pypiTest: pypiTestUpload testTestPypi testdocker testdockerTestdata
# this is only the upload now for pypi builders
pypiTestUpload:
./bin/upload_to_pypiTest.sh
testTestPypi:
./bin/testTestPyPiUpload.sh 2>tmp/$@-2 | tee tmp/$@-1
releaseTest: build rlsecure pypiTestUpload testTestPypi
# this is for pypi owners after all tests have finished
pypi:
./bin/upload_to_pypi.sh
release: pypi
# ====================================================
# full test runs with all supported tld's
# test2 has the data type in the output
test2: reformat mypy
./test2.py -f testdata/DOMAINS.txt 2> tmp/$@-2 | tee tmp/$@-1
# test3 simulates the whoisdomain command and has no data type in the output
test3: reformat mypy
./test3.py -f testdata/DOMAINS.txt 2> tmp/$@-2 | tee tmp/$@-1
# ====================================================
# update the sqlite db with the latest tld info and psl info and suggest missing tld's we can add with a simple fix
suggest:
( cd analizer; make ) | tee suggest.out
# black pylama and mypy on the source directory
format:
./bin/reformat-code.sh
# black pylama and mypy on the source directory
reformat:
./bin/reformat-code.sh
# only verify --strict all python code
mypy:
mypy --strict *.py bin/*.py $(WHAT)
pylint:
python -m pylint --recursive=y whoisdomain/ >pylint.txt
clean:
rm -rf tmp/*
rm -f ./rl-secure-list-*.txt
rm -f ./rl-secure-status-*.txt
docker container prune -f
docker image prune --all --force
docker image ls -a
cleanDist:
rm -rf dist/*
# rm -f work/version
zz:
docker build -t df36 -f Df-36 .
docker run -v .:/context df36 -d google.com
with: withPublicSuffix withExtractServers stripHttpStatus
withPublicSuffix:
./test2.py -d www.dublin.airport.aero --withPublicSuffix
withExtractServers:
./test2.py -d google.com --extractServers
stripHttpStatus:
./test2.py -d nic.aarp --stripHttpStatus
./test2.py -d nic.abudhabi --stripHttpStatus
./test2.py -d META.AU --stripHttpStatus
./test2.py -d google.AU --stripHttpStatus