forked from nzlosh/err-stackstorm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (61 loc) · 2.06 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
SHELL=/bin/sh
MAX_LINE_LEN=100
SOURCE_PATH=src/err-stackstorm
LIB_PATH=${SOURCE_PATH}/errst2lib
TESTS_PATH=tests
.PHONY: all
all: auto_format lint_test unit_test security_scan
.PHONY: clean
clean:
@echo Cleaning - N/A
.PHONY: setup
setup:
test -n "${CI}" || ( test -n "${VIRTUAL_ENV}" || (echo "Not running in virtualenv/CI - abort setup"; exit 1 ) ) && echo "Running in virtual environment or CI pipeline"
pip install --upgrade pip
pip install errbot
errbot --init
pip install .
pip install -r requirements-test.txt
pip install -r requirements-build.txt
.PHONY: build_python_package
build_python_package:
echo "Build python package"
python -m build
.PHONY: publish_pypi
publish_pypi:
echo "Publish python packages to pypi"
# TO DO: python -m twine upload err-stackstorm dist/*
.PHONY: build_documentation
build_documentation:
echo "Build documentation"
echo TO DO - trigger readthedocs.
.PHONY: format_test
format_test:
echo "Formatting code\n"
black --check --line-length=${MAX_LINE_LEN} ${SOURCE_PATH}/st2.py ${LIB_PATH}/*.py ${TESTS_PATH}/*.py
.PHONY: auto_format
auto_format:
echo "Formatting code\n"
black --line-length=${MAX_LINE_LEN} ${SOURCE_PATH}/st2.py ${LIB_PATH}/*.py ${TESTS_PATH}/*.py
.PHONY: security_scan
security_scan:
echo "Scanning for potential security issues\n"
bandit ${SOURCE_PATH}/*.py ${LIB_PATH}/*.py
.PHONY: unit_test
unit_test:
echo "Running Python unit tests\n"
python -m pytest
.PHONY: lint_test
lint_test:
echo -n "Running LINT tests\n"
pycodestyle --max-line-length=${MAX_LINE_LEN} ${SOURCE_PATH}/st2.py ${LIB_PATH}/*.py
.PHONY: help
help:
echo "lint_test: Run flake and pycodestyle tests on source files."
echo "unit_test: Run pytest."
echo "format_test: Run black formatting check over source files."
echo "auto_format: Apply black formatting over source files."
echo "setup: Install errbot and dependencies into virtual environment."
echo :build_python_package: Build a python package of err-stackstorm."
echo :publish_pypi: Upload python package in dist/ to pypi."
echo :build_documentation: Trigger build on the readthedocs site."