Adding services block to .travis.yml
@@ -5,8 +5,6 @@ language: python
python:
- "3.6"
-sudo: false
-
cache:
directories:
- $HOME/.cache
@@ -16,12 +14,8 @@ dist: trusty
env:
global:
- ES_JAVA_OPTS="-Xms512m -Xmx512m"
- - ES_VERSION=5.4.0 ES_DOWNLOAD_URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz
- - DATABASE_PORT="54321"
- PROJECT_DIR="$PWD"
- WHEELHOUSE="$HOME/.cache/wheelhouse"
- - LIBXML2_DEB="libxml2-dbg_2.9.4+dfsg1-7ubuntu3.1_amd64.deb"
- - POSTGRES_DEB="postgresql-9.5_9.5.13-2.pgdg70+1_amd64.deb"
before_install:
# cache directories
@@ -29,29 +23,21 @@ before_install:
mkdir -p $HOME/.cache/downloads
mkdir -p $HOME/.cache/pip
mkdir -p $HOME/.cache/wheelhouse
- # postgres
- - |
- cd $HOME/.cache/downloads
- if [ ! -f "$LIBXML2_DEB" ]; then
- curl -SLO http://security.ubuntu.com/ubuntu/pool/main/libx/libxml2/$LIBXML2_DEB
- fi
- if [ ! -f "$POSTGRES_DEB" ]; then
- curl -SLO http://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-9.5/$POSTGRES_DEB
- fi
- dpkg -x $LIBXML2_DEB /tmp/libxml2
- dpkg -x $POSTGRES_DEB /tmp/postgres
+ # eleasticsearch
- |
- export LD_LIBRARY_PATH=/tmp/libxml2/usr/lib/x86_64-linux-gnu
- /tmp/postgres/usr/lib/postgresql/9.5/bin/initdb /tmp/postgres/data --nosync -U postgres
- sed -i -e 's/#fsync.*/fsync = off/' /tmp/postgres/data/postgresql.conf
- sed -i -e 's/#synchronous_commit.*/synchronous_commit = off/' /tmp/postgres/data/postgresql.conf
- sed -i -e 's/#full_page_writes.*/full_page_writes = off/' /tmp/postgres/data/postgresql.conf
- /tmp/postgres/usr/lib/postgresql/9.5/bin/postgres -k /tmp -D /tmp/postgres/data -p 54321 > /dev/null & dpkg -x $POSTGRES_DEB /tmp/postgres
+ curl https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.0-amd64.deb -o elasticsearch.deb
+ sudo dpkg -i --force-confnew elasticsearch.deb
+ sudo chown -R elasticsearch:elasticsearch /etc/default/elasticsearch
+ sudo service elasticsearch restart
+
+services:
+ - postgresql
+ - elasticsearch
+
+addons:
+ postgresql: "9.5"
install:
- - wget ${ES_DOWNLOAD_URL}
- - tar -xzf elasticsearch-${ES_VERSION}.tar.gz
- - ./elasticsearch-${ES_VERSION}/bin/elasticsearch &
- cd $PROJECT_DIR
- travis_retry pip install --upgrade pip
- travis_retry pip install flake8==3.8.3 --force-reinstall --upgrade
