diff --git a/.travis.yml b/.travis.yml index 4c9267c21f..7dd9c2a785 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,8 @@ cache: - $HOME/.cache/pip - /opt/python - $HOME/.pyenv + - c/ProgramData/chocolatey/bin + - c/ProgramData/chocolatey/lib sudo: true dist: xenial python: "3.7" @@ -19,16 +21,16 @@ env: # version, that causes fpm to crash. matrix: include: - - name: "Python 2.7 on Windows" + - name: "2.7 on Windows" os: windows # Windows 10.0.17134 N/A Build 17134 language: shell # 'language: python' is an error on Travis CI Windows - before_install: choco install python2 - env: PATH=/c/Python27:/c/Python27/Scripts:$PATH - - name: "Python 3.7 on Windows" + env: + - PYTHON_VER=2.7 + - name: "3.7 on Windows" os: windows # Windows 10.0.17134 N/A Build 17134 language: shell # 'language: python' is an error on Travis CI Windows - before_install: choco install python - env: PATH=/c/Python37:/c/Python37/Scripts:$PATH + env: + - PYTHON_VER=3.7 - name: "2.7" env: - PYTHON_VER=2.7.13 @@ -89,7 +91,7 @@ matrix: before_install: - bash ./scripts/ci/before_install.sh - source env.sh - - python --version + - bash ./scripts/ci/check_python.sh install: - bash ./scripts/ci/install.sh script: @@ -107,6 +109,7 @@ deploy: - dvc*.rpm - dvc*.deb - dvc*.pkg + - dvc*.exe skip_cleanup: true on: tags: true diff --git a/scripts/build_windows.cmd b/scripts/build_windows.cmd index 00c3583333..d05c2e92d5 100755 --- a/scripts/build_windows.cmd +++ b/scripts/build_windows.cmd @@ -15,7 +15,7 @@ if %errorlevel% neq 0 (echo Error: pip not found && goto :error) if not exist "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" (echo Error: Couldn't find Inno Setup compiler. Please go to jrsoftware.org/isinfo.php and install Inno Setup 5 && goto :error) echo ====== Installing requirements... ====== -call pip install -e .[all] || goto :error +call pip install .[all] || goto :error call pip install pyinstaller || goto :error echo ====== Building dvc binary... ====== diff --git a/scripts/ci/before_install.sh b/scripts/ci/before_install.sh index db200d8780..63f1236af5 100644 --- a/scripts/ci/before_install.sh +++ b/scripts/ci/before_install.sh @@ -17,9 +17,13 @@ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then pyenv install --skip-existing --keep --verbose $osx_python_ver &> pyenv.log || tail -n 50 pyenv.log pyenv shell $osx_python_ver python --version +elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then + choco install python + # NOTE: used to install and run our style checking tools + PATH=/c/Python37:/c/Python37/Scripts:$PATH fi -pip install -e .[tests] +pip install .[tests] # stop the build if there are any readme formatting errors python setup.py checkdocs @@ -28,26 +32,28 @@ python setup.py checkdocs black ./ --check flake8 ./ -#NOTE: ssh keys for ssh test to be able to ssh to the localhost -ls -la ~/.ssh/ - -ssh-keygen -t rsa -N "" -f mykey -mkdir -p ~/.ssh -cp mykey ~/.ssh/id_rsa -cp mykey.pub ~/.ssh/id_rsa.pub -cat mykey.pub >> ~/.ssh/authorized_keys -ssh-keyscan localhost >> ~/.ssh/known_hosts -ssh-keyscan 127.0.0.1 >> ~/.ssh/known_hosts -ssh-keyscan 0.0.0.0 >> ~/.ssh/known_hosts -ssh 0.0.0.0 ls &> /dev/null -ssh 127.0.0.1 ls &> /dev/null -ssh localhost ls &> /dev/null +if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then + #NOTE: ssh keys for ssh test to be able to ssh to the localhost + ssh-keygen -t rsa -N "" -f mykey + mkdir -p ~/.ssh + cp mykey ~/.ssh/id_rsa + cp mykey.pub ~/.ssh/id_rsa.pub + cat mykey.pub >> ~/.ssh/authorized_keys + ssh-keyscan localhost >> ~/.ssh/known_hosts + ssh localhost ls &> /dev/null + ssh-keyscan 127.0.0.1 >> ~/.ssh/known_hosts + ssh 127.0.0.1 ls &> /dev/null + ssh-keyscan 0.0.0.0 >> ~/.ssh/known_hosts + ssh 0.0.0.0 ls &> /dev/null +fi scriptdir="$(dirname $0)" - echo > env.sh -if [ -n "$TRAVIS_OS_NAME" ] && [ "$TRAVIS_OS_NAME" != "osx" ] \ - && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then +echo 'set -e' >> env.sh +echo 'set -x' >> env.sh + +if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] +then bash "$scriptdir/install_azurite.sh" bash "$scriptdir/install_oss.sh" bash "$scriptdir/install_hadoop.sh" @@ -59,8 +65,17 @@ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then fi if [[ -n "$PYTHON_VER" ]]; then - eval "$(pyenv init -)" - pyenv install --skip-existing --keep --verbose "$PYTHON_VER" &> pyenv.log || tail -n 50 pyenv.log - echo 'eval "$(pyenv init -)"' >> env.sh - echo "pyenv shell $PYTHON_VER" >> env.sh + if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then + if [[ "$PYTHON_VER" == "2.7" ]]; then + choco install python2 + echo 'PATH="/c/Python27:/c/Python27/Scripts:$PATH"' >> env.sh + else + echo 'PATH="/c/Python37:/c/Python37/Scripts:$PATH"' >> env.sh + fi + else + eval "$(pyenv init -)" + echo 'eval "$(pyenv init -)"' >> env.sh + pyenv install --skip-existing "$PYTHON_VER" + echo "pyenv global $PYTHON_VER" >> env.sh + fi fi diff --git a/scripts/ci/check_python.sh b/scripts/ci/check_python.sh new file mode 100644 index 0000000000..3ce7e5e5e9 --- /dev/null +++ b/scripts/ci/check_python.sh @@ -0,0 +1,24 @@ +set -e +set -x + +if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then + where python + where pip +else + which python + which pip +fi + +if [[ -z "$PYTHON_VER" ]]; then + exit 0 +fi + +if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then + if [[ "$(python -c 'import sys; print(sys.version[:3])')" != "$PYTHON_VER" ]]; then + exit 1 + fi +else + if [[ "$(python --version 2>&1)" != "Python $PYTHON_VER" ]]; then + exit 1 + fi +fi diff --git a/scripts/ci/install.sh b/scripts/ci/install.sh index 2d194c0f7a..40a73a133d 100644 --- a/scripts/ci/install.sh +++ b/scripts/ci/install.sh @@ -15,8 +15,7 @@ function retry { # networking issues. Thus, let's retry a few times to see if it will eventially # work or not. retry pip install --upgrade pip setuptools wheel -retry pip install -e .[all] -retry pip install -e .[tests] +retry pip install .[all,tests] git config --global user.email "dvctester@example.com" git config --global user.name "DVC Tester"