Move all apt related steps to before_install.
@@ -78,6 +78,12 @@ cache:
before_install:
# Work around for Travis timeout issues, see https://github.com/travis-ci/travis-ci/issues/9112
- sudo apt-get update --option Acquire::Retries=100 --option Acquire::http::Timeout="60"
+ # 1. Install MongoDB 3.4 and latest version of git
+ - sudo add-apt-repository -y ppa:git-core/ppa
+ - curl https://www.mongodb.org/static/pgp/server-3.4.asc | sudo apt-key add -
+ - echo "deb [arch=amd64] http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.4 multiverse" | sudo tee -a /etc/apt/sources.list
+ - sudo apt-get update -qq
+ - sudo apt-get install mongodb-org-server mongodb-org-shell git -y
- pip install --upgrade "pip>=9.0,<9.1"
- sudo pip install --upgrade "virtualenv==15.1.0"
@@ -89,12 +95,6 @@ install:
# See https://github.com/messagebus/lapine/wiki/Testing-on-Travis.
before_script:
# key_url no longer works for APT addon
- # 1. Install MongoDB 3.4 and latest version of git
- - sudo add-apt-repository ppa:git-core/ppa
- - curl https://www.mongodb.org/static/pgp/server-3.4.asc | sudo apt-key add -
- - echo "deb [arch=amd64] http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.4 multiverse" | sudo tee -a /etc/apt/sources.list
- - sudo apt-get update -qq
- - sudo apt-get install mongodb-org-server mongodb-org-shell git -y
# Use a custom mongod.conf which uses various speed optimizations
- sudo cp scripts/travis/mongod.conf /etc/mongod.conf
# Clean up any old MongoDB 3.4 data files laying around and make sure mongodb user can write to it
