-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathafter-script.sh
executable file
·35 lines (28 loc) · 1.03 KB
/
after-script.sh
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
#!/bin/sh -ex
# If we're running tests and they output coverage information, then
# submit it to coveralls. Note that since the file directories are
# relative to the root directory of the test container (and should
# start with "/test/..."), we have to replace this with the path of
# the service.
# Submit to coveralls only on the Travis CI.
handle_nodejs() {
NODEJS_LCOV=services/"$SERVICE_TEST"/coverage/lcov.info
if [ -f "$NODEJS_LCOV" ]; then
sed "s,SF:/test/,SF:services/$SERVICE_TEST/," "$NODEJS_LCOV" |
npx coveralls
fi
}
handle_python() {
PYTHON_COV=services/"$SERVICE_TEST"/coverage/.coverage
COV_CONFIG=services/"$SERVICE_TEST"/setup.cfg
if [ -f "$PYTHON_COV" ]; then
sudo sed -i "s,/test/,$PWD/services/$SERVICE_TEST/,g" "$PYTHON_COV"
sudo sed -i "s,coverage/.coverage,$PYTHON_COV," "$COV_CONFIG"
pip install coveralls
coveralls --rcfile="$COV_CONFIG"
fi
}
if [ -n "$SERVICE_TEST" ]; then
[ -n "$TRAVIS_NODE_VERSION" ] && handle_nodejs
[ -n "$TRAVIS_PYTHON_VERSION" ] && handle_python
fi