Skip to content

Commit

Permalink
Merge pull request tableau#268 from tableau/print-install-logs
Browse files Browse the repository at this point in the history
Build is broken.
  • Loading branch information
johng42 authored and jnegara committed Apr 23, 2019
1 parent b7e3a0c commit 483fe24
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 35 deletions.
18 changes: 9 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ os: linux
language: python
python: 3.6
install:
- ./startup.sh --no-startup
- pip install pytest
- pip install pytest-cov
- pip install coveralls
- npm install -g markdownlint-cli
- ./startup.sh --no-startup --print-install-logs
- pip install pytest
- pip install pytest-cov
- pip install coveralls
- npm install -g markdownlint-cli
script:
- pytest tabpy-server/server_tests/ --cov=tabpy-server/tabpy_server
- pytest tabpy-tools/tools_tests/ --cov=tabpy-tools/tabpy_tools --cov-append
- markdownlint .
- pytest tabpy-server/server_tests/ --cov=tabpy-server/tabpy_server
- pytest tabpy-tools/tools_tests/ --cov=tabpy-tools/tabpy_tools --cov-append
- markdownlint .
after_success:
- coveralls
- coveralls
72 changes: 47 additions & 25 deletions startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ function check_status() {
fi
}

function install_dependencies() {
# $1 = tabpy_server | tabpy_tools
# $2 = true if install logs are printed to the console,
# false if they are printed to a log file
# $3 = install log file path
if [ "$2" = true ]; then
echo -e "\nInstalling ${1} dependencies..."
python3 setup.py install
elif [ "$2" = false ]; then
echo -e "\nInstalling ${1} dependencies..." >> ${3}
python3 setup.py install >> ${3} 2>&1
else
echo Invalid startup environment.
exit 1
fi
check_status
}

# Check for Python in PATH
echo Checking for presence of Python in the system path variable.
python --version &>-
Expand All @@ -16,47 +34,51 @@ check_status "Cannot find Python. Check that Python is installed and is in the
echo Setting TABPY_ROOT to current working directory.
TABPY_ROOT=$PWD
INSTALL_LOG=${TABPY_ROOT}/tabpy-server/install.log
echo "" > ${INSTALL_LOG}
PRINT_INSTALL_LOGS=false

# Parse CLI parameters
for i in "$@"
do
case $i in
-c=*|--config=*)
CONFIG="${i#*=}"
shift
;;
--no-startup)
NO_STARTUP=true
shift
;;
--print-install-logs)
PRINT_INSTALL_LOGS=true
shift
;;
*)
echo Invalid option: $i
esac
done

# Check for dependencies, install them if they're not present.
echo Installing TabPy-server requirements.
echo Read the logs at ${INSTALL_LOG}
if [ "$PRINT_INSTALL_LOGS" = false ]; then
echo Read the logs at ${INSTALL_LOG}
fi

cd ${TABPY_ROOT}/tabpy-server
echo -e "\nInstalling tabpy-server dependencies..." > ${INSTALL_LOG}
python3 setup.py install >> ${INSTALL_LOG} 2>&1
check_status
install_dependencies "tabpy-server" ${PRINT_INSTALL_LOGS} ${INSTALL_LOG}

cd ${TABPY_ROOT}/tabpy-tools
echo -e "\nInstalling tabpy-tools dependencies..." >> ${INSTALL_LOG}
python3 setup.py install >> ${INSTALL_LOG} 2>&1
check_status
install_dependencies "tabpy-tools" ${PRINT_INSTALL_LOGS} ${INSTALL_LOG}

cd ${TABPY_ROOT}
check_status

# Check for CLI parameters
for i in "$@"
do
case $i in
-c=*|--config=*)
CONFIG="${i#*=}"
shift
;;
--no-startup)
TEST_ENV=true
shift
;;
*)
echo Invalid option: $i
esac
done

if [ ! -z ${CONFIG} ]; then
echo Using the config file at ${TABPY_ROOT}/tabpy-server/$CONFIG.
fi

# Exit if in a test environent
if [ ! -z ${TEST_ENV} ]; then
if [ ! -z ${NO_STARTUP} ]; then
echo Skipping server startup. Exiting successfully.
exit 0
fi
Expand Down
2 changes: 1 addition & 1 deletion tabpy-server/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@
'six',
'tornado==5.1.1',
'Tornado-JSON',
'urllib3'
'urllib3<1.25,>=1.21.1'
]
)

0 comments on commit 483fe24

Please sign in to comment.