Skip to content

Commit

Permalink
Moving CI to github actions & trying to get it green
Browse files Browse the repository at this point in the history
Some of the missing combinations in the matrix:

* Ruby 3 with Rails 5.2 are skipped because my tests error when trying to start rails
* Rspec-rails 3 with Rails 6.1 because of a rails change rspec-rails needs rspec/rspec-rails#2215 or the more recent rspec/rspec-rails#2461
  • Loading branch information
alexrothenberg committed Feb 24, 2021
1 parent a3ccc6e commit 0bd6f65
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 88 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Ammeter CI
on:
push:
branches:
- 'main'
- 'gitub-action-ci'
pull_request:
branches:
- '*'
jobs:
test:
name: 'Ruby: ${{ matrix.ruby }}, Rspec: ${{matrix.env.RSPEC_VERSION}}, Rails: ${{ matrix.env.RAILS_VERSION }}'
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- ruby: 3.0
env:
RSPEC_VERSION: 'master'
RAILS_VERSION: '~> 6.1.0'
- ruby: 3.0
env:
RSPEC_VERSION: '~> 4.0'
RAILS_VERSION: '~> 6.1.0'
- ruby: 3.0
env:
RSPEC_VERSION: '~> 4.0'
RAILS_VERSION: '~> 6.0.0'
- ruby: 3.0
env:
RSPEC_VERSION: '~> 3.9'
RAILS_VERSION: '~> 6.0.0'
- ruby: 2.5
env:
RSPEC_VERSION: 'master'
RAILS_VERSION: '~> 6.1.0'
- ruby: 2.5
env:
RSPEC_VERSION: '~> 4.0'
RAILS_VERSION: '~> 6.1.0'
- ruby: 2.5
env:
RSPEC_VERSION: '~> 4.0'
RAILS_VERSION: '~> 6.0.0'
- ruby: 2.5
env:
RSPEC_VERSION: '~> 4.0'
RAILS_VERSION: '~> 5.2.0'
- ruby: 2.5
env:
RSPEC_VERSION: '~> 3.9'
RAILS_VERSION: '~> 6.0.0'
- ruby: 2.5
env:
RSPEC_VERSION: '~> 3.9'
RAILS_VERSION: '~> 5.2.0'
- ruby: ruby-head
env:
RSPEC_VERSION: 'master'
RAILS_VERSION: '~> 6.1.0'
env: ${{ matrix.env }}
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle install
- run: bundle exec rake ci
continue-on-error: ${{ matrix.allow_failure || false }}
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

44 changes: 11 additions & 33 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source "http://rubygems.org"
source 'https://rubygems.org'

rspec_version = ENV['RSPEC_VERSION']
rspec_major_version = (rspec_version && rspec_version != 'master') ? rspec_version.scan(/\d+/).first : '3'
rspec_version = ENV['RSPEC_VERSION'] || '~> 4.0'
rails_version = ENV['RAILS_VERSION'] || '>= 5.1.0'

if rspec_version == 'master'
gem "rspec-rails", :git => 'git://github.com/rspec/rspec-rails.git'
Expand All @@ -13,38 +13,16 @@ if rspec_version == 'master'
gem "rspec-support", :git => 'git://github.com/rspec/rspec-support.git'
else
gem 'rspec-rails', rspec_version
gem 'rspec', rspec_version
end

if rspec_major_version == '2' || RUBY_VERSION.to_f < 1.9
# rspec 2.x does not support Rails 4.1+ nor does Ruby 1.8.7
gem 'rails', '~> 3.2'
gem 'uglifier', '~> 1.2.4'
gem 'rake', '~> 0.9.2.2'
gem 'coffee-rails', '~> 3.2'
gem 'sass-rails', '~> 3.2'
gem 'jquery-rails', '~> 2.0'
gem 'haml-rails', '~> 0.4'
gem 'execjs', '~> 2.0.0'
elsif rspec_major_version == '3'
if RUBY_VERSION < '2.2.2'
gem 'rails', '< 5.0' # rails 5 is ruby >= 2.2.2
else
gem 'rails', '>= 4.0'
end
gem 'uglifier', '>= 1.3'
gem 'rake', '>= 0.10'
gem 'coffee-rails', '>= 4.0'
gem 'sass-rails', '>= 4.0'
gem 'jquery-rails', '>= 3.0'
gem 'haml-rails', '>= 0.5'
else
raise "rspec version #{rspec_version} is not supported"
end

gem "i18n", '< 0.7.0' if RUBY_VERSION < '1.9.3'
gem "rack", '<= 1.6.4' if RUBY_VERSION < '2.2.2'
gem 'rails', rails_version
gem 'uglifier'
gem 'rake'
gem 'coffee-rails'
gem 'sass-rails'
gem 'jquery-rails'
gem 'haml-rails'

# Specify your gem's dependencies in rspec-rails-generator-specs.gemspec
# Specify your gem's dependencies in ammeter.gemspec
gemspec

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Ammeter [![Build Status](https://secure.travis-ci.org/alexrothenberg/ammeter.png)](http://travis-ci.org/alexrothenberg/ammeter) [![Code Climate](https://codeclimate.com/github/alexrothenberg/ammeter.png)](https://codeclimate.com/github/alexrothenberg/ammeter) [![Gem Version](https://badge.fury.io/rb/ammeter.png)](http://badge.fury.io/rb/ammeter)
# Ammeter [![Ammeter CI](https://github.com/alexrothenberg/ammeter/actions/workflows/ci.yml/badge.svg)](https://github.com/alexrothenberg/ammeter/actions/workflows/ci.yml) [![Code Climate](https://codeclimate.com/github/alexrothenberg/ammeter.png)](https://codeclimate.com/github/alexrothenberg/ammeter) [![Gem Version](https://badge.fury.io/rb/ammeter.png)](http://badge.fury.io/rb/ammeter)


A gem that makes it easy to write specs for your Rails 3 Generators.
Expand Down
3 changes: 1 addition & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ end
namespace :generate do
desc "generate a fresh app with rspec installed"
task :app => :ensure_bundler_11 do |t|
sh "bundle exec rails new ./tmp/example_app -m 'features/templates/generate_example_app.rb' --skip-test-unit"
sh "bundle exec rails new ./tmp/example_app -m 'features/templates/generate_example_app.rb' --skip-test-unit --skip-bootsnap --skip-spring --skip-webpack-install"
sh "cp 'features/templates/rspec.rake' ./tmp/example_app/lib/tasks"
Dir.chdir("./tmp/example_app/") do
Bundler.unbundled_system 'bundle install'
Bundler.unbundled_system 'rake db:migrate'
Bundler.unbundled_system 'rails g rspec:install'
Bundler.unbundled_system 'spring stop'
end
end

Expand Down
2 changes: 0 additions & 2 deletions ammeter.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'activesupport', '>= 3.0'
s.add_runtime_dependency 'rspec-rails', '>= 2.2'

s.add_runtime_dependency 'bootsnap'

s.add_development_dependency 'rspec', '>= 2.2'
s.add_development_dependency 'rails', '>= 3.1'
s.add_development_dependency 'uglifier', '>= 1.2.4'
Expand Down
2 changes: 1 addition & 1 deletion features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def copy_to_aruba_from(gem_or_app_name)
if rspec_major_version == '2'
# rspec 2.x does not create rails_helper.rb so we create a symlink to avoid cluttering tests
write_symlink("tmp/#{gem_or_app_name}/spec/spec_helper.rb", gem_or_app_name, 'rails_helper.rb')
elsif rspec_major_version == '3'
elsif rspec_major_version >= '3'
write_symlink("tmp/#{gem_or_app_name}/spec/rails_helper.rb", gem_or_app_name)
end
end
Expand Down
1 change: 0 additions & 1 deletion features/templates/generate_example_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
gem "rspec-support", :git => 'git://github.com/rspec/rspec-support.git'
else
gem 'rspec-rails', rspec_version
gem 'rspec', rspec_version
end

gem "i18n", '< 0.7.0' if RUBY_VERSION < '1.9.3'
Expand Down
16 changes: 3 additions & 13 deletions features/templates/my_rails_gem/Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'

rspec_version = ENV['RSPEC_VERSION']
rspec_major_version = (rspec_version && rspec_version != 'master') ? rspec_version.scan(/\d+/).first : '3'
rspec_version = ENV['RSPEC_VERSION'] || '~> 4.0'
rails_version = ENV['RAILS_VERSION'] || '>= 5.1.0'

if rspec_version == 'master'
gem "rspec-rails", :git => 'git://github.com/rspec/rspec-rails.git'
Expand All @@ -13,19 +13,9 @@ if rspec_version == 'master'
gem "rspec-support", :git => 'git://github.com/rspec/rspec-support.git'
else
gem 'rspec-rails', rspec_version
gem 'rspec', rspec_version
end

if rspec_major_version == '2' || RUBY_VERSION.to_f < 1.9
gem 'rails', '~> 3.2.0'
# Execjs is causing problems on 1.8.7
gem 'execjs', '~> 2.0.0'
elsif rspec_major_version == '3'
gem 'rails', '>= 4.1'
else
raise "rspec version #{rspec_version} is not supported"
end

gem 'rails', rails_version

# Specify your gem's dependencies in my_gem.gemspec
gemspec
Expand Down
16 changes: 3 additions & 13 deletions features/templates/my_railties_gem/Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'

rspec_version = ENV['RSPEC_VERSION']
rspec_major_version = (rspec_version && rspec_version != 'master') ? rspec_version.scan(/\d+/).first : '3'
rspec_version = ENV['RSPEC_VERSION'] || '~> 4.0'
rails_version = ENV['RAILS_VERSION'] || '>= 5.1.0'

if rspec_version == 'master'
gem "rspec-rails", :git => 'git://github.com/rspec/rspec-rails.git'
Expand All @@ -13,19 +13,9 @@ if rspec_version == 'master'
gem "rspec-support", :git => 'git://github.com/rspec/rspec-support.git'
else
gem 'rspec-rails', rspec_version
gem 'rspec', rspec_version
end

if rspec_major_version == '2' || RUBY_VERSION.to_f < 1.9
gem 'railties', '~> 3.2.0'
# Execjs is causing problems on 1.8.7
#gem 'execjs', '~> 2.0.0'
elsif rspec_major_version == '3'
gem 'railties', '>= 4.1'
else
raise "rspec version #{rspec_version} is not supported"
end

gem 'railties', rails_version

# Specify your gem's dependencies in my_gem.gemspec
gemspec
Expand Down

0 comments on commit 0bd6f65

Please sign in to comment.