aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <max@magorsch.de>2019-12-30 22:30:34 +0100
committerMax Magorsch <max@magorsch.de>2019-12-30 22:30:34 +0100
commitb8240b26580bd3fcda169a27e8d750cd517f0551 (patch)
treea90c141f7c8f240bf4bba4c0963fb98a1865c059
parenttravis: improve ES startup time (diff)
downloadpackages-5-b8240b26580bd3fcda169a27e8d750cd517f0551.tar.gz
packages-5-b8240b26580bd3fcda169a27e8d750cd517f0551.tar.bz2
packages-5-b8240b26580bd3fcda169a27e8d750cd517f0551.zip
Add a docker based travis script for dev/main
The travis script has been split up into multiple files: .travis.yml imports the appropriate build script from .travis/ depending on the current branch: - on the master branch the old travis script is still used - on the dev/main branch a new docker based travis script is used Signed-off-by: Max Magorsch <max@magorsch.de>
-rw-r--r--.travis.yml59
-rw-r--r--.travis/travis.docker.yml10
-rw-r--r--.travis/travis.yml54
3 files changed, 69 insertions, 54 deletions
diff --git a/.travis.yml b/.travis.yml
index 3e80390..b8d7be3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,54 +1,5 @@
-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 test test/ RAILS_ENV=test
-
-# vim:ft=yaml et ts=2 sts=2 sw=2:
+import:
+ - source: .travis/travis.yml
+ if: branch = master
+ - source: .travis/travis.docker.yml
+ if: branch = dev/main \ No newline at end of file
diff --git a/.travis/travis.docker.yml b/.travis/travis.docker.yml
new file mode 100644
index 0000000..d9639b3
--- /dev/null
+++ b/.travis/travis.docker.yml
@@ -0,0 +1,10 @@
+language: generic
+
+services:
+ - docker
+
+before_install:
+ - docker-compose build
+
+script:
+ - docker-compose -f docker-compose.test.yml up --exit-code-from http-serving \ No newline at end of file
diff --git a/.travis/travis.yml b/.travis/travis.yml
new file mode 100644
index 0000000..ec1f722
--- /dev/null
+++ b/.travis/travis.yml
@@ -0,0 +1,54 @@
+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 test test/ RAILS_ENV=test
+
+# vim:ft=yaml et ts=2 sts=2 sw=2: \ No newline at end of file