before_install.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env bash
  2. set -e
  3. set -o pipefail
  4. if [[ "${CI_TARGET}" == lint ]]; then
  5. exit
  6. fi
  7. echo 'Python info:'
  8. (
  9. set -x
  10. python3 --version
  11. python2 --version
  12. python --version
  13. pip3 --version
  14. pip2 --version
  15. pip --version
  16. pyenv --version
  17. pyenv versions
  18. ) 2>&1 | sed 's/^/ /' || true
  19. # Use pyenv, but not for OSX on Travis, where it only has the "system" version.
  20. if [[ "${TRAVIS_OS_NAME}" != osx ]] && command -v pyenv; then
  21. echo 'Setting Python versions via pyenv'
  22. # Prefer Python 2 over 3 (more conservative).
  23. pyenv global 2.7.15:3.7.1
  24. echo 'Updated Python info:'
  25. (
  26. set -x
  27. python3 --version
  28. python2 --version
  29. python --version
  30. python3 -m pip --version
  31. python2 -m pip --version
  32. ) 2>&1 | sed 's/^/ /'
  33. fi
  34. echo "Install node (LTS)"
  35. if [[ "${TRAVIS_OS_NAME}" == osx ]] || [ ! -f ~/.nvm/nvm.sh ]; then
  36. curl -o ~/.nvm/nvm.sh https://raw.githubusercontent.com/creationix/nvm/master/nvm.sh
  37. fi
  38. source ~/.nvm/nvm.sh
  39. nvm install --lts
  40. nvm use --lts
  41. if [[ -n "$CMAKE_URL" ]]; then
  42. echo "Installing custom CMake: $CMAKE_URL"
  43. curl --retry 5 --silent --fail -o /tmp/cmake-installer.sh "$CMAKE_URL"
  44. mkdir -p "$HOME/.local/bin" /opt/cmake-custom
  45. bash /tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license
  46. ln -sfn /opt/cmake-custom/bin/cmake "$HOME/.local/bin/cmake"
  47. cmake_version="$(cmake --version)"
  48. echo "$cmake_version" | grep -qF '2.8.12' || {
  49. echo "Unexpected CMake version: $cmake_version"
  50. exit 1
  51. }
  52. fi