Travis CI testing is slow and I want to speed it up. Looking at the log, pip install is taking a long time. Especially numpy installation is slow. Also, I want to skip the fact that the installed package is processed every time because it is specified in the cache directory.
.travis.yml
python:
- 2.7.9
cache:
apt: true
directories:
- "$HOME/.pip-cache/"
- "$HOME/virtualenv/python2.7.9"
before_install:
- sudo apt-get update
- sudo apt-get install XXX #Required package installation
install:
- pip install -r requirements.txt --download-cache $HOME/.pip-cache
#Omitted below
Change the install item so that the installation process runs only the difference compared to pip freeze
.travis.yml
install:
- pip freeze | comm -13 - requirements.txt | grep -v '^#' | xargs pip install --download-cache $HOME/.pip-cache
diff <(pip freeze | sort) <(cat requirements.txt | sort) | grep '^> ' | sed 's/^> //'
`grep -v'^ #`
The line installed by specifying tag from the git repository will always be a difference because the hash value of the commit is displayed in pip freeze.
Well, is it okay because the slowest numpy was skipped? I think.
Recommended Posts