Skip to content

Commit

Permalink
travis: don't override before_install (iterative#2239)
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop authored Jul 7, 2019
1 parent a4720d0 commit 7ad3c56
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 32 deletions.
17 changes: 10 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -107,6 +109,7 @@ deploy:
- dvc*.rpm
- dvc*.deb
- dvc*.pkg
- dvc*.exe
skip_cleanup: true
on:
tags: true
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_windows.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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... ======
Expand Down
59 changes: 37 additions & 22 deletions scripts/ci/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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
24 changes: 24 additions & 0 deletions scripts/ci/check_python.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions scripts/ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "[email protected]"
git config --global user.name "DVC Tester"
Expand Down

0 comments on commit 7ad3c56

Please sign in to comment.