-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (71 loc) · 2.41 KB
/
Copy pathMakefile
File metadata and controls
96 lines (71 loc) · 2.41 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
# Copyright 2019 SoloKeys Developers
# Copyright Nitrokey GmbH
# SPDX-License-Identifier: Apache-2.0 OR MIT
-include variables.mk
PACKAGE_NAME=pynitrokey
FORMAT_DIRS := $(PACKAGE_NAME) stubs
LINT_DIRS := $(PACKAGE_NAME) stubs
RUFF ?= poetry run ruff
MYPY ?= poetry run mypy
.PHONY: all
all: install
.PHONY: install
install:
poetry sync --all-extras --with dev
.PHONY: lock
lock:
poetry lock
.PHONY: update
update:
poetry update
.PHONY: check-format
check-format:
$(RUFF) format --check $(FORMAT_DIRS)
.PHONY: check-style
check-style:
$(RUFF) check $(LINT_DIRS)
.PHONY: check-typing
check-typing:
$(MYPY) $(PACKAGE_NAME)/
.PHONY: check
check: check-format check-style check-typing
.PHONY: test
test:
$(PYTHON3_VENV) -m doctest pynitrokey/helpers.py
# automatic code fixes
.PHONY: fix
fix:
$(RUFF) format $(FORMAT_DIRS)
$(RUFF) check --fix $(LINT_DIRS)
.PHONY: clean
clean:
rm -rf ./dist
rm -rf ./**/__pycache__
rm -rf ./.mypy_cache
# Package management
.PHONY: tag
tag: VERSION := $(shell poetry version --short)
tag:
git tag -a $(VERSION) -m"v$(VERSION)"
git push origin $(VERSION)
.PHONY: secrets-test-all secrets-test secrets-test-report secrets-test-report-CI
LOG=info
TESTADD=
TESTPARAM=-x -s -o log_cli=true -o log_cli_level=$(LOG) -W ignore::DeprecationWarning $(TESTADD)
secrets-test-all: init
./venv/bin/pytest -v pynitrokey/test_secrets_app.py --durations=20 $(TESTPARAM)
secrets-test:
@echo "Skipping slow tests. Run secrets-test-all target for all tests."
./venv/bin/pytest -v pynitrokey/test_secrets_app.py --durations=20 -m "not slow" $(TESTPARAM)
REPORT=report.html
secrets-test-report:
./venv/bin/pytest -v pynitrokey/test_secrets_app.py --durations=0 -o log_cli=false -o log_cli_level=debug -W ignore::DeprecationWarning --template=html1/index.html --report $(REPORT)
@echo "Report written to $(REPORT)"
REPORT=report.html
secrets-test-report-CI:
./venv/bin/pytest -v pynitrokey/test_secrets_app.py --durations=0 -m "not slow" -o log_cli=false -o log_cli_level=debug -W ignore::DeprecationWarning --template=html1/index.html --report $(REPORT) --junitxml=report-junit.xml $(TESTADD)
@echo "Report written to $(REPORT)"
secrets-test-generate-corpus: CORPUS_PATH=$(shell mktemp -d)
secrets-test-generate-corpus:
./venv/bin/pytest -v pynitrokey/test_secrets_app.py --durations=0 $(TESTPARAM) --generate-fuzzing-corpus --fuzzing-corpus-path=$(CORPUS_PATH)
@echo "Corpus written to $(CORPUS_PATH)"