.travis.yml
language: python
group: travis_latest
dist: bionic
sudo: true
env:
global:
- python_command="python"
- pip_command="python -m pip"
- WINEDEBUG=fixme-all # switch off wine fix me messages
- CC_TEST_REPORTER_ID="0f951d4827f32d0835249263a1d4aaab93528cd3987ee0c54db11ee534dc78b1"
# pypi_password for lib_parameter
# This works for sure - the Travis deploy is somehow buggy.
# create the secret :
# cd /<repository>
# travis encrypt -r bitranox/lib_parameter pypi_password=*****
# copy and paste the encrypted password in the project_conf.py
- secure: "D0IYa8wbsRaTA6Qu1ZK4umqXyOHhBTEW06aLp6cZhwSsWEF4issnnw+bNv3vOF3j1bAOrgNmRxzMYPeaYawUzslJDXWAYCoEE6f//uSGlU7OJbK5btxbtG03uNRhmwMH9K8h2SP0pGivwWMJpTdjHJk+rL6BSjBye9tyr77HQupBM5l6HKeK+Z/6pJl4SBLZw1PZo+x95w/2LuvJlrWFgJ8STS6MJ1PFSmCave1wEq44g87Yin1eCiyYGojxfjKB9Y2R68NY+vTqGor0ltEZ5zPJ2c2nQ2z4XrtgUjJAeh6Ud0iznTPXnnT9X4ZfKG29O/FXVu/X2pIQ6ESbYJg+9uMFxVbecUw3LKTTqOCgp7BRAadvEq8HCmzoh/pSr1z0p+cKf/cTKxmF8pE6p3/6zkSkh7wloYoPld82uIB0rKFjnL9Tprv80RYex9oak1f1cHOvMwha5fO5a7aEvQkFqaM2s/nJpwMGR/PiG1RYfK0lC5abc0FXPJg017rC3d+kbMBjXcCfU0OzJIdp0la8LVyZjKXGlYMzx4JqgiZM1z826aSOh4s3nMQZ1JVAiUUPxHelX6zJTkYCX/JNB4SWOjx+lEYc+76YT8lcu+zDT+NpJpzJjx3oDCqdnTcZukCIQc444IfCF3OI2e1JP+jm0IOqLaMYuPSgM6L+bUX+J1w="
addons:
apt:
packages:
- xvfb # install xvfb virtual framebuffer - this we need for WINE
- winbind # needed for WINE
services: # start services
- xvfb # is needed for WINE on headless installation
matrix:
include:
- os: windows
language: sh
name: "Windows Python 3.8"
# oddly a secure password under env: global: causes that choco fails
# so we need to put the option : filter_secrets: false
# this can be a security issue, check that You dont leak secrets here !
filter_secrets: false
before_install:
- git clone https://github.com/bitranox/lib_bash.git /usr/local/lib_bash
- chmod -R 0755 /usr/local/lib_bash
- chmod -R +x /usr/local/lib_bash/*.sh
- /usr/local/lib_bash/lib_retry.sh retry choco install python3
- export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
- os: linux
language: python
python: '3.6'
- os: linux
language: python
python: '3.7'
- os: linux
language: python
python: '3.8'
before_install:
- export mypy_strict_typecheck="True"
- export build_docs="True"
- export deploy_on_pypi="True"
- os: linux
language: python
python: '3.8-dev'
- os: linux
language: python
python: 'pypy3'
- os: osx
language: sh
name: "macOS 10.15.4"
python: "3.8"
osx_image: xcode11.5
env:
# on osx pip and python points to python 2.7 - therefore we have to use pip3 and python3 here
- python_command="python3"
- pip_command="python3 -m pip"
install:
# install lib_bash_wine - this installs also lib_bash
- $(command -v sudo 2>/dev/null) git clone https://github.com/bitranox/lib_bash_wine.git /usr/local/lib_bash_wine
- $(command -v sudo 2>/dev/null) chmod -R 0755 /usr/local/lib_bash_wine
- $(command -v sudo 2>/dev/null) chmod -R +x /usr/local/lib_bash_wine/*.sh
- $(command -v sudo 2>/dev/null) /usr/local/lib_bash_wine/install_or_update.sh
- export lib_bash_color="/usr/local/lib_bash/lib_color.sh"
- export lib_bash_banner="/usr/local/lib_bash/lib_helpers.sh banner"
- export lib_bash_banner_warning="/usr/local/lib_bash/lib_helpers.sh banner_warning"
- export lib_bash_wine="/usr/local/lib_bash_wine"
- ${lib_bash_banner} "upgrading pip"; ${CMDPREFIX} ${python_command} -m pip install --upgrade pip;
- ${lib_bash_banner} "upgrading setuptools"; ${CMDPREFIX} ${python_command} -m pip install --upgrade setuptools;
- ${lib_bash_banner} "upgrading wheel"; ${CMDPREFIX} ${python_command} -m pip install --upgrade wheel;
- ${lib_bash_banner} "upgrading pytest-pycodestyle"; ${CMDPREFIX} ${python_command} -m pip install --upgrade "pytest-pycodestyle; python_version >= \"3.5\"";
- ${lib_bash_banner} "installing lib_log_utils"; ${CMDPREFIX} ${python_command} -m pip install git+https://github.com/bitranox/lib_log_utils.git;
- if [[ ${build_docs} == "True" ]]; then
${lib_bash_banner} "installing rst_include"; ${CMDPREFIX} ${python_command} -m pip install git+https://github.com/bitranox/rst_include.git;
fi
- if [[ ${CMDPREFIX} == "wine" ]]; then ${lib_bash_wine}/001_000_install_wine.sh ; fi
- if [[ ${CMDPREFIX} == "wine" ]]; then ${lib_bash_wine}/002_000_install_wine_machine.sh ; fi
- if [[ ${wine_python_version} == "python3" ]]; then ${lib_bash_wine}/003_000_install_wine_python3_preinstalled.sh ; fi
- if [[ ${CMDPREFIX} == "wine" ]]; then ${lib_bash_wine}/004_000_install_wine_git_portable.sh ; fi
- if [[ ${CMDPREFIX} == "wine" ]]; then ${lib_bash_wine}/005_000_install_wine_powershell_core.sh ; fi
script:
# setup.py test
- COMMAND="${CMDPREFIX} ${python_command} ./setup.py test"
- ${lib_bash_banner} "running '${COMMAND}'";
- if ${COMMAND}; then ${lib_bash_banner} "'${COMMAND}' - OK"; else ${lib_bash_banner_warning} "'${COMMAND}' - FAILED" && exit 1; fi
# pip install git+https://github.com/bitranox/lib_cast.git --install-option test
- COMMAND="${CMDPREFIX} ${python_command} -m pip install git+https://github.com/bitranox/lib_cast.git --install-option test"
- ${lib_bash_banner} "running '${COMMAND}'";
- if ${COMMAND}; then ${lib_bash_banner} "'${COMMAND}' - OK"; else ${lib_bash_banner_warning} "'${COMMAND}' - FAILED" && exit 1; fi
# pip install git+https://github.com/bitranox/lib_cast.git
- COMMAND="${CMDPREFIX} ${python_command} -m pip install git+https://github.com/bitranox/lib_cast.git"
- ${lib_bash_banner} "running '${COMMAND}'";
- if ${COMMAND}; then ${lib_bash_banner} "'${COMMAND}' - OK"; else ${lib_bash_banner_warning} "'${COMMAND}' - FAILED" && exit 1; fi
# commandline registration check
- CMDLINE_COMMAND=$(${CMDPREFIX} ${python_command} ./project_update.py --get_registered_shell_command)
- COMMAND="${CMDPREFIX} ${CMDLINE_COMMAND} -v"
- ${lib_bash_banner} "running '${COMMAND}' (check commandline registration)";
- if ${COMMAND}; then ${lib_bash_banner} "'${COMMAND}' - OK"; else ${lib_bash_banner_warning} "'${COMMAND}' - FAILED" && exit 1; fi
# pytest codecov only
- COMMAND="${CMDPREFIX} ${python_command} -m pytest --cov=lib_cast"
- ${lib_bash_banner} "running '${COMMAND}' - (coverage only)";
- ${CMDPREFIX} ${python_command} -m pip install --upgrade -r ./requirements_test.txt > /dev/null 2>&1;
- ${CMDPREFIX} ${python_command} -m pip install --upgrade codecov > /dev/null 2>&1;
- ${CMDPREFIX} ${python_command} -m pip install --upgrade pytest-cov > /dev/null 2>&1;
- if ${COMMAND}; then ${lib_bash_banner} "'${COMMAND}' - OK"; else ${lib_bash_banner_warning} "'${COMMAND}' - FAILED" && exit 1; fi
# mypy typecheck strict
- if [[ ${mypy_strict_typecheck} == "True" ]]; then
COMMAND="${CMDPREFIX} ${python_command} -m mypy -p lib_cast --strict --no-warn-unused-ignores"
${lib_bash_banner} "running '${COMMAND}'";
if ${COMMAND}; then ${lib_bash_banner} "'${COMMAND}' - OK"; else ${lib_bash_banner_warning} "'${COMMAND}' - FAILED" && exit 1; fi
else
${lib_bash_banner_warning} "mypy typecheck --strict disabled on this build";
fi
# Bild Docs
- if [[ -f build_docs.py ]] && [[ "${build_docs}" == "True" ]]; then
COMMAND="${CMDPREFIX} ${python_command} build_docs.py bitranox/lib_cast"
${lib_bash_banner} "running '${COMMAND}' - rebuild README.rst";
if ${COMMAND}; then ${lib_bash_banner} "'${COMMAND}' - OK"; else ${lib_bash_banner_warning} "'${COMMAND}' - FAILED" && exit 1; fi
else
${lib_bash_banner_warning} "rebuild README.rst disabled on this build" ;
fi
# Check if Deployment would work on non-tagged builds
- if [[ -f setup.py ]] && [[ -z ${TRAVIS_TAG} ]] && [[ -f build_docs.py ]] && [[ ${build_docs} == "True" ]]; then
${lib_bash_banner} "Testing PyPi Deployment";
${CMDPREFIX} ${python_command} -m pip install readme_renderer > /dev/null 2>&1;
${CMDPREFIX} ${python_command} -m pip install --upgrade twine > /dev/null 2>&1;
${CMDPREFIX} ${python_command} -m pip install wheel > /dev/null 2>&1;
${CMDPREFIX} ${python_command} setup.py sdist bdist_wheel || ${lib_bash_banner_warning} "Building Wheels failed" 1>&2;
if ${CMDPREFIX} twine check dist/*; then
${lib_bash_banner} "PyPi Deployment would be OK";
else
${lib_bash_banner_warning} "PyPi Deployment would fail";
exit 1;
fi
else
${lib_bash_banner_warning} "Check PyPi Deployment disabled on this build" ;
fi
after_success:
- ${CMDPREFIX} coverage report
- ${CMDPREFIX} codecov
# codeclimate coverage upload
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
# This works for sure - the Travis deploy is somehow buggy.
# create the secret :
# cd /<repository>
# travis encrypt pypi_password=*****
# copy and paste the encrypted password in the project_conf.py
- if [[ ${deploy_on_pypi} == "True" ]] && [[ -n ${TRAVIS_TAG} ]]; then
${lib_bash_banner} "Deploy on PyPi";
export travis_deploy="True";
${CMDPREFIX} ${python_command} -m pip install readme_renderer;
${CMDPREFIX} ${python_command} -m pip install --upgrade twine;
${CMDPREFIX} ${python_command} -m pip install wheel;
${CMDPREFIX} ${python_command} setup.py sdist bdist_wheel;
${CMDPREFIX} twine check dist/*;
${CMDPREFIX} twine upload --repository-url https://upload.pypi.org/legacy/ -u bitranox -p ${pypi_password} dist/*;
fi
notifications:
email:
recipients:
- rnowotny@rotek.at
on_success: never # default: change
on_failure: always # default: always