-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild
executable file
·55 lines (44 loc) · 1.01 KB
/
build
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
#!/bin/bash
# Exit build script on first failure.
set -e
# Echo commands to stdout.
set -x
# Exit on unset variable.
set -u
# Location of app source files.
SOURCE_DIR=app
# Location of virtualenv.
VIRTUALENV_DIR=venv
# Delete pyc files from previous builds.
find . \
-name "*.pyc" \
-type f \
-not -path "./${VIRTUALENV_DIR}/*" \
-delete
# Run unit tests and calculate code coverage.
coverage run \
--source "$SOURCE_DIR" \
-m unittest discover
coverage report
# Check that source has correct formatting.
yapf \
--diff \
--recursive \
--style google \
./ \
--exclude=third_party/* \
--exclude=venv/*
# Check correct sorting for imports.
isort \
. \
--recursive \
--force-single-line-imports \
--diff \
--check-only \
--skip-glob=third_party/* \
--skip-glob=venv/*
# Run static analysis for Python bugs/cruft.
pyflakes "${SOURCE_DIR}/"
# Check docstrings for style consistency.
PYTHONPATH="$(pwd)/third_party/docstringchecker" \
pylint --reports=n --rcfile=.pylintrc "$SOURCE_DIR"