diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..76833c9 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,57 @@ +on: + push: + branches: [ main ] + pull_request: + types: [ opened, synchronize ] +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - ruby_version: '2.7' + gemfile: rails_7_0 + upload_coverage: true + - ruby_version: '2.5' + gemfile: rails_6_1 + - ruby_version: '2.3' + gemfile: rails_5_0 + - ruby_version: '2.3' + gemfile: rails_4_2 + bundler: '1' + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + CI: 1 + BUNDLE_GEMFILE: ${{ github.workspace }}/spec/gemfiles/${{ matrix.gemfile }}.gemfile + steps: + - name: "Determine whether to upload coverage" + if: ${{ env.CC_TEST_REPORTER_ID && matrix.upload_coverage }} + run: echo COVERAGE=1 >> $GITHUB_ENV + - uses: actions/checkout@v3 + - name: Set up Ruby ${{ matrix.ruby_version }} and ${{ matrix.gemfile }}.gemfile + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby_version }} + bundler: ${{ matrix.bundler || 'Gemfile.lock' }} + bundler-cache: true + - name: Run tests + if: ${{ !env.COVERAGE }} + run: bundle exec rspec --format d + - name: Run tests and upload coverage + uses: paambaati/codeclimate-action@v3.0.0 + if: ${{ env.COVERAGE }} + with: + coverageCommand: bundle exec rspec --format d + i18n-tasks: + runs-on: ubuntu-latest + env: + BUNDLE_GEMFILE: ${{ github.workspace }}/spec/gemfiles/i18n-tasks.gemfile + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby and i18n-tasks.gemfile + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.2 + bundler-cache: true + - name: Run i18n-tasks + run: bundle exec i18n-tasks health diff --git a/.simplecov b/.simplecov index 5399a41..0d56d2a 100644 --- a/.simplecov +++ b/.simplecov @@ -11,5 +11,5 @@ SimpleCov.start do add_group 'Policies', 'app/policies' add_group 'View models', 'app/view_models' add_group 'Lib', 'lib/' - formatter SimpleCov::Formatter::HTMLFormatter unless ENV['TRAVIS'] + formatter SimpleCov::Formatter::HTMLFormatter unless ENV['CI'] end diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 553b1bc..0000000 --- a/.travis.yml +++ /dev/null @@ -1,44 +0,0 @@ -language: ruby -os: linux -rvm: - - 2.3.8 - - jruby-9 - - rbx-3 -gemfile: - - spec/gemfiles/rails_4_2.gemfile - - spec/gemfiles/rails_5_0.gemfile - - spec/gemfiles/rails_5_2.gemfile -git: - submodules: false -env: - global: - - TRAVIS=1 -jobs: - allow_failures: - - rvm: rbx-3 - exclude: - - rvm: jruby-9 - gemfile: spec/gemfiles/rails_4_2.gemfile -cache: bundler -bundler_args: --path ../../vendor/bundle --without debug - -before_install: - # Rails 4.x requires bundler version < 2.0. - - > - if [[ $BUNDLE_GEMFILE == "${PWD}/spec/gemfiles/rails_4_2.gemfile" ]]; then - "find /home/travis/.rvm/rubies -wholename '*default/bundler-*.gemspec' -delete" - gem install bundler --version='~> 1.17' - bundler --version - fi - -script: -- > - if [[ "$(rvm current)" = "ruby-"* ]]; then - COVERAGE=1 bundle exec rspec --format d - else - bundle exec rspec --format d - fi -- > - if [[ "$(rvm current)" = "ruby-"* ]]; then - bundle exec codeclimate-test-reporter - fi diff --git a/Gemfile b/Gemfile index a62be3f..2fe87ba 100644 --- a/Gemfile +++ b/Gemfile @@ -3,5 +3,6 @@ source 'https://rubygems.org' gemspec gem 'rails' +gem 'i18n-tasks' -eval_gemfile './shared.gemfile' \ No newline at end of file +eval_gemfile './shared.gemfile' diff --git a/README.md b/README.md index 4dae91f..65a02d5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Rails Email Preview [![Build Status][travis-badge]][travis] [![Test Coverage][coverage-badge]][coverage] [![Code Climate][codeclimate-badge]][codeclimate] [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/glebm/rails_email_preview?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +# Rails Email Preview [![Build Status][badge-ci]][ci] [![Test Coverage][coverage-badge]][coverage] [![Code Climate][codeclimate-badge]][codeclimate] [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/glebm/rails_email_preview?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Preview email in the browser with this Rails engine. Compatible with Rails 4.2+. @@ -269,11 +269,11 @@ This project rocks and uses MIT-LICENSE. [rep-nav-screenshot]: https://raw.github.com/glebm/rails_email_preview/master/doc/img/rep-nav.png "Email List Screenshot" [rep-show-screenshot]: https://raw.github.com/glebm/rails_email_preview/master/doc/img/rep-show.png "Show Email Screenshot" [rep-show-default-screenshot]: https://raw.github.com/glebm/rails_email_preview/master/doc/img/rep-show-default.png "Show Email Screenshot (default styles)" -[travis]: http://travis-ci.org/glebm/rails_email_preview -[travis-badge]: http://img.shields.io/travis/glebm/rails_email_preview.svg +[ci]: https://github.com/glebm/rails_email_preview/actions/workflows/tests.yml +[badge-ci]: https://github.com/glebm/rails_email_preview/actions/workflows/tests.yml/badge.svg [gem]: https://rubygems.org/gems/rails_email_preview [gem-badge]: http://img.shields.io/gem/v/rails_email_preview.svg -[codeclimate]: https://codeclimate.com/github/glebm/rails_email_preview -[codeclimate-badge]: http://img.shields.io/codeclimate/github/glebm/rails_email_preview.svg -[coverage]: https://codeclimate.com/github/glebm/rails_email_preview -[coverage-badge]: https://codeclimate.com/github/glebm/rails_email_preview/badges/coverage.svg +[codeclimate]: https://codeclimate.com/github/glebm/rails_email_preview/maintainability +[codeclimate-badge]: https://api.codeclimate.com/v1/badges/b2b4b63c3f63e316b1e4/maintainability +[coverage]: https://codeclimate.com/github/glebm/rails_email_preview/test_coverage +[coverage-badge]: https://api.codeclimate.com/v1/badges/b2b4b63c3f63e316b1e4/test_coverage diff --git a/rails_email_preview.gemspec b/rails_email_preview.gemspec index a8a8a54..807058b 100644 --- a/rails_email_preview.gemspec +++ b/rails_email_preview.gemspec @@ -22,11 +22,10 @@ Gem::Specification.new do |s| s.add_dependency 'turbolinks' s.add_dependency 'request_store' - s.add_development_dependency 'i18n-tasks', '>= 0.9.25' - s.add_development_dependency 'capybara', '>= 3.8.2' + s.add_development_dependency 'capybara', '>= 3.1.1' s.add_development_dependency 'cuprite', '>= 0.10' s.add_development_dependency 'rspec-rails', '>= 3.8.0' - s.add_development_dependency 'puma', '>= 3.12.0' + s.add_development_dependency 'puma', '>= 3.9.1' s.version = RailsEmailPreview::VERSION end diff --git a/shared.gemfile b/shared.gemfile index 370412d..bfdfb46 100644 --- a/shared.gemfile +++ b/shared.gemfile @@ -1,27 +1,16 @@ -platform :rbx do - gem 'rubysl', '~> 2.0' - gem 'racc' -end - if defined?(JRUBY_VERSION) # JRuby attempts to install v0.9.2 even though jruby's reported required version is too low for it. gem 'i18n-tasks', '~> 0.8.7' end - -if ENV['TRAVIS'] - gem 'codeclimate-test-reporter', group: :test, require: false -else +if !ENV['CI'] group :test, :development do - gem 'byebug', platform: :mri_21, require: false - gem 'coffee-rails' - end - - group :development do - gem 'puma' + gem 'byebug', platform: [:mri], require: false end +end +if ENV['COVERAGE'] group :test do gem 'simplecov', require: false end -end \ No newline at end of file +end diff --git a/spec/gemfiles/i18n-tasks.gemfile b/spec/gemfiles/i18n-tasks.gemfile new file mode 100644 index 0000000..5c2b317 --- /dev/null +++ b/spec/gemfiles/i18n-tasks.gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'i18n-tasks' diff --git a/spec/gemfiles/rails_4_2.gemfile b/spec/gemfiles/rails_4_2.gemfile index 7345d1b..6fc5f89 100644 --- a/spec/gemfiles/rails_4_2.gemfile +++ b/spec/gemfiles/rails_4_2.gemfile @@ -1,7 +1,6 @@ -source "http://rubygems.org" +source 'https://rubygems.org' gemspec path: '../..' eval_gemfile '../../shared.gemfile' gem 'rails', '~> 4.2.0' - diff --git a/spec/gemfiles/rails_5_0.gemfile b/spec/gemfiles/rails_5_0.gemfile index b2ffe42..1ce822c 100644 --- a/spec/gemfiles/rails_5_0.gemfile +++ b/spec/gemfiles/rails_5_0.gemfile @@ -1,6 +1,6 @@ -source 'http://rubygems.org' +source 'https://rubygems.org' gemspec path: '../..' +eval_gemfile '../../shared.gemfile' gem 'rails', '~> 5.0.2' -eval_gemfile '../../shared.gemfile' diff --git a/spec/gemfiles/rails_5_2.gemfile b/spec/gemfiles/rails_5_2.gemfile index d531626..a1443b6 100644 --- a/spec/gemfiles/rails_5_2.gemfile +++ b/spec/gemfiles/rails_5_2.gemfile @@ -1,4 +1,4 @@ -source 'http://rubygems.org' +source 'https://rubygems.org' gemspec path: '../..' eval_gemfile '../../shared.gemfile' diff --git a/spec/gemfiles/rails_6_1.gemfile b/spec/gemfiles/rails_6_1.gemfile new file mode 100644 index 0000000..10a46fb --- /dev/null +++ b/spec/gemfiles/rails_6_1.gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +gemspec path: '../..' +eval_gemfile '../../shared.gemfile' + +gem 'rails', '~> 6.1.7' +gem 'puma', '~> 5.6.5' diff --git a/spec/gemfiles/rails_7_0.gemfile b/spec/gemfiles/rails_7_0.gemfile new file mode 100644 index 0000000..d243f15 --- /dev/null +++ b/spec/gemfiles/rails_7_0.gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +gemspec path: '../..' +eval_gemfile '../../shared.gemfile' + +gem 'rails', '~> 7.0.4' + diff --git a/spec/i18n_keys_spec.rb b/spec/i18n_keys_spec.rb deleted file mode 100644 index 45f446d..0000000 --- a/spec/i18n_keys_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'spec_helper' -require 'i18n/tasks' - -describe 'Translation keys' do - let(:i18n) { I18n::Tasks::BaseTask.new } - - around(:each) do |e| - Dir.chdir File.expand_path('..', File.dirname(__FILE__)) do - e.run - end - end - - it 'are all present' do - expect(i18n.missing_keys).to be_empty - end - - it 'are all used' do - expect(i18n.unused_keys).to be_empty - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f4e5fe2..52ed996 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -25,7 +25,8 @@ Capybara.register_driver :cuprite do |app| options = { - window_size: [800, 800] + window_size: [800, 800], + timeout: 15, } options[:browser_path] = browser_path if browser_path Capybara::Cuprite::Driver.new(app, options)