-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (54 loc) · 2.15 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
CONTAINER= ghcr.io/dnstapir/aggrec:latest
CONTAINER_BASE= aggrec:latest
BUILDINFO= aggrec/buildinfo.py
OPENAPI= aggrec-api.yaml
DEPENDS= $(BUILDINFO)
PRIVATE_KEYS= test-private-p256.pem test-private-ed25519.pem
PUBLIC_KEYS= clients/test-p256.pem clients/test-ed25519.pem
all: $(DEPENDS) $(PUBLIC_KEYS)
$(BUILDINFO):
printf "__commit__ = \"`git rev-parse HEAD`\"\n__timestamp__ = \"`date +'%Y-%m-%d %H:%M:%S %Z'`\"\n" > $(BUILDINFO)
openapi: $(OPENAPI)
$(OPENAPI): $(DEPENDS)
poetry run python tools/export_openapi_yaml.py > $@
container: $(DEPENDS)
docker buildx build -t $(CONTAINER) -t $(CONTAINER_BASE) .
push-container:
docker push $(CONTAINER)
server: $(DEPENDS) $($(PUBLIC_KEYS))
poetry run aggrec_server --host 127.0.0.1 --port 8080 --debug
test-client: test-client-p256 test-client-ed25519
test-client-p256: test-private-p256.pem
openssl rand 1024 > random.bin
poetry run aggrec_client --http-key-id test-p256 --http-key-file $< random.bin
openssl rand 1024 > random.bin
poetry run aggrec_client --http-key-id test-p256 --http-key-file $< random.bin
poetry run aggrec_client --http-key-id test-p256 --http-key-file $< random.bin
poetry run aggrec_client --http-key-id test-p256 --http-key-file $< random.bin
test-client-ed25519: test-private-ed25519.pem
openssl rand 1024 > random.bin
poetry run aggrec_client --http-key-id test-ed25519 --http-key-file $< random.bin
keys: clients/test-p256.pem clients/test-ed25519.pem
test-private-p256.pem:
openssl ecparam -genkey -name prime256v1 -noout -out $@
test-private-ed25519.pem:
openssl genpkey -algorithm ed25519 -out $@
clients:
mkdir clients
clients/test-p256.pem: clients test-private-p256.pem
openssl ec -in test-private-p256.pem -pubout -out $@
clients/test-ed25519.pem: clients test-private-ed25519.pem
openssl pkey -in test-private-ed25519.pem -pubout -out $@
test: $(DEPENDS) $(PUBLIC_KEYS)
poetry run pytest --ruff --ruff-format
lint:
poetry run ruff check .
reformat:
poetry run ruff check --select I --fix .
poetry run ruff format .
clean:
rm -f $(PUBLIC_KEYS) $(PRIVATE_KEYS)
rm -fr clients random.bin
rm -f $(BUILDINFO) $(OPENAPI)
realclean: clean
poetry env remove --all