aboutsummaryrefslogtreecommitdiff
blob: 9330a589a7ecccc89fa8e5d6cf5a1c6da2619555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
language: ruby
dist: bionic
cache: bundler
rvm:
  - 2.5.7

gemfiles:
  - Gemfile
  - Gemfile.ci # rails 5

branches:
  only:
    - master

services:
  - elasticsearch
  - redis-server

before_install:
  # Specifically target older Bundler
  - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
  - gem install bundler -v '< 2'
  # https://docs.travis-ci.com/user/database-setup/#elasticsearch
  - curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.1-amd64.deb
  # Verify checksum
  - echo e566a88e15d8f85cf793c8f971b51eeae6465a0aa73f968ae4b1ee6aa71e4c20 elasticsearch-7.5.1-amd64.deb | sha256sum -c
  # Stop before install
  - sudo service elasticsearch stop
  # Install
  - sudo dpkg -i --force-confnew elasticsearch-7.5.1-amd64.deb
  # Fix permissions from install
  - sudo chmod 0644 /etc/default/elasticsearch
  # Shave startup time
  - echo ES_STARTUP_SLEEP_TIME=1 | sudo tee -a /etc/default/elasticsearch >/dev/null
  # Start up again or fail
  - sudo service elasticsearch start && sudo service elasticsearch status || ( sudo journalctl -xe ; exit 1 )

before_script:
  - cp config/secrets.yml.dist config/secrets.yml
  - cp config/initializers/kkuleomi_config.rb.test config/initializers/kkuleomi_config.rb
  # Wait for Elasticsearch
  # If it starts up in less than 10 seconds, this wins!
  - curl --retry-delay 1 --retry-connrefused --retry 10 --connect-timeout 1 --max-time 15 -o - 'http://127.0.0.1:9200/_cat/health?format=json&v&pretty'

script:
  # This code needs style improvements before higher strictness in lint.
  - bundle exec rubocop --fail-level E
  # Steps from bin/test.sh
  - bundle exec rake tmp:create RAILS_ENV=test
  - bundle exec rake assets:precompile RAILS_ENV=test
  - bundle exec rake kkuleomi:index:init RAILS_ENV=test
  - bundle exec rake kkuleomi:update:all RAILS_ENV=test
  - bundle exec rake test test/ RAILS_ENV=test

# vim:ft=yaml et ts=2 sts=2 sw=2: