forked from powerfulseal/powerfulseal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (50 loc) · 1.56 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
INOTIFY_CALL ?= inotifywait -e modify -r ./powerfulseal ./tests
TOX_CALL ?= tox -r
SCHEMA_FILE=powerfulseal/policy/ps-schema.yaml
local_proxy ?= ""
local_no_proxy ?= ""
name ?= powerfulseal
version ?= `python setup.py --version`
arch=$(shell uname -m)
ifeq ($(arch),x86_64)
tag = $(name):$(version)
else ifeq ($(arch),aarch64)
tag = $(name):$(version)-arm64
endif
namespace ?= "bloomberg/"
test:
$(TOX_CALL)
watch:
$(TOX_CALL) && while $(INOTIFY_CALL); do $(TOX_CALL); done
upload:
rm -rfv dist
rm -rfv powerfulseal.egg-info
python setup.py sdist
twine upload dist/*
clean:
find -name '*.pyc' -delete
find -name '__pycache__' -delete
build:
docker build -t $(tag) -f ./build/Dockerfile .
build-local:
docker build -t $(tag) \
--build-arg http_proxy=${local_proxy} \
--build-arg https_proxy=${local_proxy} \
--build-arg no_proxy=${local_no_proxy} \
-f ./build/Dockerfile .
tag:
docker tag $(tag) $(namespace)$(tag)
push:
docker push $(namespace)$(tag)
version:
@echo $(tag)
docs: $(SCHEMA_FILE)
# https://coveooss.github.io/json-schema-for-humans/
pip install PyYAML json-schema-for-humans
cat $(SCHEMA_FILE) | python -c "import sys; import yaml; import json; print(json.dumps(yaml.safe_load(sys.stdin.read()), indent=4, sort_keys=True))" > tmp.json
mkdir -p docs/schema
generate-schema-doc --no-minify --expand-buttons tmp.json docs/schema/index.html
rm tmp.json
validate-examples:
python examples/extract-examples.py | xargs -L 1 powerfulseal validate --policy-file
.PHONY: test watch upload clean build build-local tag push version validate-examples