Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Improve build: use newer JRuby, enable build on docker and add GitLab CI support #195

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Cache gems in between builds
cache:
paths:
- vendor

variables:
LANG: "C.UTF-8"
REDIS_HOST: "redis"
REDIS_PORT: "6379"

.test-template: &test-common
services:
- redis:latest
before_script:
- apt-get update && apt-get install -y --quiet haveged && service haveged start && service haveged status
- gem update --system --no-document
- gem install bundler --no-ri --no-rdoc
- bundle install -j $(nproc) --path vendor --retry 3

test:2.0:
image: "ruby:2.0"
<<: *test-common
script:
- bundle exec rake

test:2.1:
image: "ruby:2.1"
<<: *test-common
script:
- bundle exec rake

test:2.2:
image: "ruby:2.2"
<<: *test-common
script:
- bundle exec rake

test:2.3:
image: "ruby:2.3"
<<: *test-common
script:
- bundle exec rake

test:jruby-9.1:
image: "jruby:9.1"
services:
- redis:latest
before_script:
- apt-get update && apt-get install -y --quiet haveged
- jgem update --system --no-document
- jgem install bundler --no-ri --no-rdoc
- bundle install -j $(nproc) --path vendor --retry 3
script:
- bundle exec rake
allow_failure: true

test:rubinius-latest:
image: "rubinius/docker:latest"
<<: *test-common
script:
- bundle exec rake
allow_failure: true
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ rvm:
- 2.0
- 2.1
- 2.2
- jruby-9.0.0.0
- jruby-9.1.2.0
- rbx-2
matrix:
allow_failures:
- rvm: jruby-9.0.0.0
- rvm: jruby-9.1.2.0
- rvm: rbx-2
fast_finish: true
script: bundle exec rake
Expand Down
6 changes: 5 additions & 1 deletion lib/lita/default_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ def http_config

# Builds config.redis
def redis_config
root.config :redis, type: Hash, default: {}
# Overrides Redis host/port defined by ENVIRONMENT variables
default = {}
default[:host] = ENV["REDIS_HOST"] if ENV["REDIS_HOST"]
default[:port] = ENV["REDIS_PORT"] if ENV["REDIS_PORT"]
root.config :redis, type: Hash, default: default
end

# Builds config.robot
Expand Down
23 changes: 21 additions & 2 deletions spec/lita/default_configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,27 @@
end

describe "redis config" do
it "has empty default options" do
expect(config.redis).to eq({})
before do
allow(ENV).to receive(:[]).with("REDIS_HOST") { nil }
allow(ENV).to receive(:[]).with("REDIS_PORT") { nil }
end

context "with no specific environmental variables" do
it "has empty default options" do
expect(config.redis).to eq({})
end
end

context "with specific environmental variables" do
it "defines a default redis host based on REDIS_HOST env variable" do
allow(ENV).to receive(:[]).with("REDIS_HOST") { "myredis" }
expect(config.redis).to eq(host: "myredis")
end

it "defines a default redis port based on REDIS_PORT env variable" do
allow(ENV).to receive(:[]).with("REDIS_PORT") { "6380" }
expect(config.redis).to eq(port: "6380")
end
end

it "can set options" do
Expand Down