Skip to content

Commit b4096d2

Browse files
authored
ci: try run all scripts and exit 1 when something fails (appium#431)
* try run all scripts and exit 1 when something fails * ignore link in Python 3.7 because of runtime error
1 parent c7a22bf commit b4096d2

1 file changed

Lines changed: 26 additions & 4 deletions

File tree

ci.sh

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
11
#!/bin/bash
22

3+
set -o pipefail
34

5+
EXIT_STATUS=0
46
if ! python -m autopep8 --exit-code -a -r --global-config .config-pep8 -i . ; then
57
echo "Please run command 'python -m autopep8 -a -r --global-config .config-pep8 -i .' on your local and commit the result"
6-
exit 1
8+
EXIT_STATUS=1
79
fi
810

911
if ! python -m isort --check-only -rc . ; then
1012
echo "Please run command 'python -m isort -rc .' on your local and commit the result"
11-
exit 1
13+
EXIT_STATUS=1
1214
fi
1315

14-
python -m pylint --rcfile .pylintrc appium test --errors-only
15-
python -m pytest test/unit/
16+
(
17+
LINT_RESULT=$(python -m pylint --rcfile .pylintrc appium test --errors-only 2>&1 | tee /dev/tty)
18+
if [[ $? -ne 0 ]] ; then
19+
EXIT_STATUS=1
20+
fi
21+
22+
# FIXME: pylint x Python 3.7 cause this runtime error.
23+
# We must remove here when we drop Python 2 (and can update pylint) or
24+
# install newer pylint for Python 3.7 environment on CI
25+
if [[ $LINT_RESULT =~ "RuntimeError: generator raised StopIteration" ]] ; then
26+
EXIT_STATUS=0
27+
fi
28+
)
29+
30+
(
31+
python -m pytest test/unit/
32+
)
33+
if [[ $? -ne 0 ]] ; then
34+
EXIT_STATUS=1
35+
fi
36+
37+
exit $EXIT_STATUS

0 commit comments

Comments
 (0)