-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (67 loc) · 2.3 KB
/
Makefile
File metadata and controls
84 lines (67 loc) · 2.3 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
packages = panther_analysis_tool
default: help
# via https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: ci
ci: lint test integration
.PHONY: install-poetry
install-poetry:
which poetry || pip install poetry
.PHONY: deps
deps: ## Install dependencies (excluding dev dependencies) using poetry
poetry sync --only main
.PHONY: deps-update
deps-update: ## Update dependencies using poetry
poetry update
poetry lock
poetry export -f requirements.txt --output requirements.txt --without-hashes
.PHONY: reqs
reqs:
poetry lock
poetry export -f requirements.txt --output requirements.txt --without-hashes
.PHONY: lint
lint: ## Lint panther_analysis_tool (mypy, bandit, pylint)
poetry run mypy $(packages)
poetry run bandit -r $(packages)
poetry run pylint $(packages)
.PHONY: venv
venv: install-poetry install # Sets up venv from scratch
.PHONY: fmt
fmt: ## Format panther_analysis_tool (black)
poetry run isort .
poetry run black .
.PHONY: install
install: ## Install dependencies (including dev dependencies) using poetry
poetry sync
.PHONY: test
test: ## Run panther_analysis_tool tests
poetry run pytest --cov=panther_analysis_tool --cov-report=html
.PHONY: coverage
coverage: ## Open the coverage report generated by the test target
open ./htmlcov/index.html
.PHONY: integration
integration: ## Run panther_analysis_tool integration tests (from included fixtures and panther-analysis repo)
poetry run panther_analysis_tool test --path tests/fixtures/detections/valid_analysis
rm -rf panther-analysis
pip install pipenv
git clone https://github.com/panther-labs/panther-analysis.git
cd panther-analysis;\
pipenv lock; \
pipenv requirements | grep -v 'panther-analysis-tool==' > requirements.ci.txt; \
pipenv install -r requirements.ci.txt; \
pipenv install -e ..; \
pip install schema==0.7.5; \
pipenv run panther_analysis_tool --version; \
pipenv run panther_analysis_tool test --path .
cd ..
rm -rf panther-analysis
.PHONY: build
build: ## Builds the package
poetry build --clean --format sdist
.PHONY: publish
release:
poetry publish -u __token__ -p ${PYPI_TOKEN}
.PHONY: pypi
pypi: reqs build publish ## Publish to PyPi