Commit 36222b6e5880e361026ddf0bc7af3c2e5a64e3bb
1 parent
097c8345
Exists in
master
and in
17 other branches
Cache Elasticsearch on Travis
Showing
3 changed files
with
29 additions
and
19 deletions
Show diff stats
.travis.yml
... | ... | @@ -8,9 +8,11 @@ services: |
8 | 8 | - redis-server |
9 | 9 | script: bundle exec rake test |
10 | 10 | before_install: |
11 | - - gem install bundler | |
12 | 11 | - psql -c 'CREATE DATABASE searchkick_test;' -U postgres || true |
13 | - - ./test/ci/before_install.sh | |
12 | + - ./test/ci/install_elasticsearch.sh | |
13 | +cache: | |
14 | + directories: | |
15 | + - $HOME/elasticsearch | |
14 | 16 | env: |
15 | 17 | - ELASTICSEARCH_VERSION=6.5.0 |
16 | 18 | jdk: oraclejdk8 | ... | ... |
test/ci/before_install.sh
... | ... | @@ -1,17 +0,0 @@ |
1 | -#!/usr/bin/env bash | |
2 | - | |
3 | -set -e | |
4 | - | |
5 | -gem install bundler | |
6 | - | |
7 | -if [[ $ELASTICSEARCH_VERSION == 1* ]]; then | |
8 | - curl -L -O https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-$ELASTICSEARCH_VERSION.tar.gz | |
9 | -elif [[ $ELASTICSEARCH_VERSION == 2* ]]; then | |
10 | - curl -L -O https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/$ELASTICSEARCH_VERSION/elasticsearch-$ELASTICSEARCH_VERSION.tar.gz | |
11 | -else | |
12 | - curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ELASTICSEARCH_VERSION.tar.gz | |
13 | -fi | |
14 | -tar -xvf elasticsearch-$ELASTICSEARCH_VERSION.tar.gz | |
15 | -cd elasticsearch-$ELASTICSEARCH_VERSION/bin | |
16 | -./elasticsearch -d | |
17 | -wget -O- --waitretry=1 --tries=60 --retry-connrefused -v http://127.0.0.1:9200/ |
... | ... | @@ -0,0 +1,25 @@ |
1 | +#!/usr/bin/env bash | |
2 | + | |
3 | +set -e | |
4 | + | |
5 | +CACHE_DIR=$HOME/elasticsearch/$ELASTICSEARCH_VERSION | |
6 | + | |
7 | +if [ ! -d "$CACHE_DIR" ]; then | |
8 | + if [[ $ELASTICSEARCH_VERSION == 1* ]]; then | |
9 | + URL=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-$ELASTICSEARCH_VERSION.tar.gz | |
10 | + elif [[ $ELASTICSEARCH_VERSION == 2* ]]; then | |
11 | + URL=https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/$ELASTICSEARCH_VERSION/elasticsearch-$ELASTICSEARCH_VERSION.tar.gz | |
12 | + else | |
13 | + URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ELASTICSEARCH_VERSION.tar.gz | |
14 | + fi | |
15 | + | |
16 | + wget $URL | |
17 | + tar xvfz elasticsearch-$ELASTICSEARCH_VERSION.tar.gz | |
18 | + mv elasticsearch-$ELASTICSEARCH_VERSION $CACHE_DIR | |
19 | +else | |
20 | + echo "Elasticsearch cached" | |
21 | +fi | |
22 | + | |
23 | +cd $CACHE_DIR | |
24 | +bin/elasticsearch -d | |
25 | +wget -O- --waitretry=5 --tries=12 --retry-connrefused -v http://127.0.0.1:9200/ | ... | ... |