Permalink
Browse files

Cache Elasticsearch on Travis

  • Loading branch information...
ankane committed Dec 4, 2018
1 parent 097c834 commit 36222b6e5880e361026ddf0bc7af3c2e5a64e3bb
Showing with 29 additions and 19 deletions.
  1. +4 −2 .travis.yml
  2. +0 −17 test/ci/before_install.sh
  3. +25 −0 test/ci/install_elasticsearch.sh
@@ -8,9 +8,11 @@ services:
- redis-server
script: bundle exec rake test
before_install:
- gem install bundler
- psql -c 'CREATE DATABASE searchkick_test;' -U postgres || true
- ./test/ci/before_install.sh
- ./test/ci/install_elasticsearch.sh
cache:
directories:
- $HOME/elasticsearch
env:
- ELASTICSEARCH_VERSION=6.5.0
jdk: oraclejdk8

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -e
CACHE_DIR=$HOME/elasticsearch/$ELASTICSEARCH_VERSION
if [ ! -d "$CACHE_DIR" ]; then
if [[ $ELASTICSEARCH_VERSION == 1* ]]; then
URL=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-$ELASTICSEARCH_VERSION.tar.gz
elif [[ $ELASTICSEARCH_VERSION == 2* ]]; then
URL=https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/$ELASTICSEARCH_VERSION/elasticsearch-$ELASTICSEARCH_VERSION.tar.gz
else
URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ELASTICSEARCH_VERSION.tar.gz
fi
wget $URL
tar xvfz elasticsearch-$ELASTICSEARCH_VERSION.tar.gz
mv elasticsearch-$ELASTICSEARCH_VERSION $CACHE_DIR
else
echo "Elasticsearch cached"
fi
cd $CACHE_DIR
bin/elasticsearch -d
wget -O- --waitretry=5 --tries=12 --retry-connrefused -v http://127.0.0.1:9200/

0 comments on commit 36222b6

Please sign in to comment.