-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
81 lines (68 loc) · 3.29 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
79
80
81
SHELL=/bin/sh
MAX_LINE_LEN=100
SOURCE_PATH=src/err-stackstorm
LIB_PATH=${SOURCE_PATH}/errst2lib
TESTS_PATH=tests
# ANSI colour formats for help output.
FMT_TITLE=\e[34;40;1m
FMT_TARGET=\e[37;0;1m
FMT_NONE=\e[0m
.PHONY: all
all: auto_format format_test lint_test unit_test security_scan
.PHONY: clean # Remove tmp files and previous build artifacst. (Not Implemented)
clean:
@echo Cleaning - N/A
.PHONY: setup # Install errbot and dependencies into virtual environment.
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 deployment packages.
build_python_package:
echo "Build python package"
python -m build
.PHONY: publish_pypi # Push python deployment packages to pypi. (Not Implemented)
publish_pypi:
echo "Publish python packages to pypi"
echo TO DO: python -m twine upload err-stackstorm dist/*
.PHONY: build_documentation # Generate readthedocs documentation. (Not Implemented)
documentation:
echo "Build documentation"
echo TO DO - trigger readthedocs.
.PHONY: format_test # Run black formatting check over source files.
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 # Apply black format against python source files.
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 # Check python source code for security issues.
security_scan:
echo "Scanning for potential security issues\n"
bandit ${SOURCE_PATH}/*.py ${LIB_PATH}/*.py
.PHONY: unit_test # Run Unit tests using pytest.
unit_test:
echo "Running Python unit tests\n"
python -m pytest
.PHONY: lint_test # Run flake and pycodestyle tests on source files.
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 "${FMT_TITLE}TARGET${FMT_NONE} ${FMT_TITLE}DESCRIPTION${FMT_NONE}"
echo "${FMT_TARGET}clean${FMT_NONE} Remove tmp files and previous build artifacst. (Not Implemented)"
echo "${FMT_TARGET}setup${FMT_NONE} Install errbot and dependencies into virtual environment."
echo "${FMT_TARGET}build_python_package${FMT_NONE} Build python deployment packages."
echo "${FMT_TARGET}publish_pypi${FMT_NONE} Push python deployment packages to pypi. (Not Implemented)"
echo "${FMT_TARGET}build_documentation${FMT_NONE} Generate readthedocs documentation. (Not Implemented)"
echo "${FMT_TARGET}format_test${FMT_NONE} Run black formatting check over source files."
echo "${FMT_TARGET}auto_format${FMT_NONE} Apply black format against python source files."
echo "${FMT_TARGET}security_scan${FMT_NONE} Check python source code for security issues."
echo "${FMT_TARGET}unit_test${FMT_NONE} Run Unit tests using pytest."
echo "${FMT_TARGET}lint_test${FMT_NONE} Run flake and pycodestyle tests on source files."