Skip to content

Commit

Permalink
chore: add ruby 2.4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
TamarinEA committed Aug 6, 2021
1 parent 4867f2d commit 06cc372
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 45 deletions.
95 changes: 73 additions & 22 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,83 @@
build:
test:
image: abakpress/dind-testing
pull: true
privileged: true
volumes:
- /home/data/drone/images:/images
- /home/data/drone/gems:/bundle
name: build

kind: pipeline
type: docker

volumes:
- name: images
host:
path: /home/data/drone/images
- name: bundle
host:
path: /home/data/drone/gems
- name: keys
host:
path: /home/data/drone/key_cache

spec_step_common: &spec_step_common
image: abakpress/dind-testing:1.0.3
pull: if-not-exists
privileged: true
volumes:
- name: images
path: /images
- name: bundle
path: /bundle
- name: keys
path: /ssh_keys
commands:
- prepare-build

- fetch-images
--image whilp/ssh-agent
--image abakpress/ruby-app:$RUBY_IMAGE_TAG
--image abakpress/postgres-db:$POSTGRES_IMAGE_TAG
--image redis:$REDIS_IMAGE_TAG

- dip ssh add -T -v /ssh_keys -k /ssh_keys/id_rsa
- dip provision
- dip rspec

steps:
- name: Tests Ruby 2.2
environment:
- COMPOSE_FILE_EXT=drone
- POSTGRES_IMAGE_TAG=9.6-latest
- RUBY_IMAGE_TAG=2.2-latest
commands:
- wrapdocker docker -v
COMPOSE_FILE_EXT: drone
DOCKER_RUBY_VERSION: 2.2
RUBY_IMAGE_TAG: 2.2-latest
POSTGRES_IMAGE_TAG: 9.6-latest
REDIS_IMAGE_TAG: 4-alpine
RAILS_ENV: test
<<: *spec_step_common

- fetch-images
--image abakpress/ruby-app:$RUBY_IMAGE_TAG
--image abakpress/postgres-db:$POSTGRES_IMAGE_TAG
- name: Tests Ruby 2.3
environment:
COMPOSE_FILE_EXT: drone
DOCKER_RUBY_VERSION: 2.3
RUBY_IMAGE_TAG: 2.3-latest
POSTGRES_IMAGE_TAG: 9.6-latest
REDIS_IMAGE_TAG: 4-alpine
RAILS_ENV: test
<<: *spec_step_common

- dip provision
- dip rspec
- name: Tests Ruby 2.4
environment:
COMPOSE_FILE_EXT: drone
DOCKER_RUBY_VERSION: 2.4
RUBY_IMAGE_TAG: 2.4-latest
POSTGRES_IMAGE_TAG: 9.6-latest
REDIS_IMAGE_TAG: 4-alpine
RAILS_ENV: test
<<: *spec_step_common

release:
image: abakpress/gem-publication
pull: true
- name: release
image: abakpress/gem-publication:latest
pull: if-not-exists
when:
event: push
branch: master
status: success
volumes:
- /home/data/drone/rubygems:/root/.gem
- name: rubygems
path: /root/.gem
commands:
- release-gem --public
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
*.o
*.a
mkmf.log
/.idea/
19 changes: 8 additions & 11 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
appraise 'rails3.2' do
gem 'activesupport', '~> 3.2.14'
gem 'activerecord', '~> 3.2.14'
if RUBY_VERSION < '2.4'
appraise 'rails4.0' do
gem 'activesupport', '~> 4.0.0'
gem 'activerecord', '~> 4.0.0'
end
end

appraise 'rails4.0' do
gem 'activesupport', '~> 4.0.0'
gem 'activerecord', '~> 4.0.0'
end

appraise 'rails4.1' do
gem 'activesupport', '~> 4.1.0'
gem 'activerecord', '~> 4.1.0'
appraise 'rails4.2' do
gem 'activesupport', '~> 4.2.0'
gem 'activerecord', '~> 4.2.0'
end
5 changes: 3 additions & 2 deletions dip.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
version: '1'

environment:
DOCKER_RUBY_VERSION: 2.2
RUBY_IMAGE_TAG: 2.2-latest
DOCKER_RUBY_VERSION: 2.4
RUBY_IMAGE_TAG: 2.4-latest
POSTGRES_IMAGE_TAG: 9.6-latest
REDIS_IMAGE_TAG: 4-alpine
COMPOSE_FILE_EXT: development

compose:
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ services:
- TEST_DB_HOST=db
- TEST_DB_NAME=docker
- TEST_DB_USERNAME=postgres
- TEST_REDIS_HOST=redis
command: bash
depends_on:
- db
- redis

db:
image: abakpress/postgres-db:$POSTGRES_IMAGE_TAG
environment:
- POSTGRES_DB=docker

redis:
image: redis:$REDIS_IMAGE_TAG
command: 'redis-server --bind 0.0.0.0'
3 changes: 1 addition & 2 deletions redis_counters-dumpers.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'bundler', '>= 1.7'
spec.add_development_dependency 'rake', '>= 10.0'
spec.add_development_dependency 'rspec', '>= 3.2'
spec.add_development_dependency 'rspec-rails', '>= 3.2'
spec.add_development_dependency 'rspec-rails', '~> 3.9.1'
spec.add_development_dependency 'appraisal', '>= 1.0.2'
spec.add_development_dependency 'mock_redis'
spec.add_development_dependency 'combustion'
spec.add_development_dependency 'pry-byebug'
spec.add_development_dependency 'test-unit'
end
2 changes: 1 addition & 1 deletion spec/lib/redis_counters/dumpers/engine_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
end

before do
allow(dumper).to receive(:redis_session).and_return(MockRedis.new)
allow(dumper).to receive(:redis_session).and_return(Redis.new(host: ENV['TEST_REDIS_HOST']))
end

describe '#process!' do
Expand Down
8 changes: 1 addition & 7 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
require 'redis_counters/dumpers'

if ::ActiveRecord::VERSION::MAJOR < 4
require 'activerecord-postgres-hstore'
require 'simple_hstore_accessor'
end

require 'combustion'
Combustion.initialize! :active_record

require 'rspec/rails'
require 'pry-byebug'

require 'mock_redis'
require 'redis'
Redis.current = MockRedis.new
Redis.current = Redis.new(host: ENV['TEST_REDIS_HOST'])

RSpec.configure do |config|
config.use_transactional_fixtures = true
Expand Down

0 comments on commit 06cc372

Please sign in to comment.