Skip to content

Commit

Permalink
Adding services block to .travis.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mattclark authored and aaxelb committed Nov 9, 2020
1 parent c058a20 commit 9c776fb
Showing 1 changed file with 12 additions and 26 deletions.
38 changes: 12 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ language: python
python:
- "3.6"

sudo: false

cache:
directories:
- $HOME/.cache
Expand All @@ -16,42 +14,30 @@ 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
- |
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
Expand Down

0 comments on commit 9c776fb

Please sign in to comment.