Skip to content

Commit

Permalink
Use github action for testing and update test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
fwininger committed Jan 13, 2022
1 parent 10272f9 commit 7d3c321
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 76 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: main
on:
- push
- pull_request
jobs:
rspec:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
ruby-version:
- 2.6
- 2.7
- 3.0.0
- 3.1
gemfile:
- rails5_2.gemfile
- rails6_0.gemfile
- rails6_1.gemfile
- rails7_0.gemfile
exclude:
- ruby-version: 2.6
gemfile: rails7_0.gemfile
- ruby-version: 3.0.0
gemfile: rails5_2.gemfile
- ruby-version: 3.1
gemfile: rails5_2.gemfile
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true

- name: Install required gems
run: BUNDLE_GEMFILE=gemfiles/${{ matrix.gemfile }} bundle install --jobs=3 --retry=3

- name: Run rspec tests
run: BUNDLE_GEMFILE=gemfiles/${{ matrix.gemfile }} bundle exec rake test

rubocop:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.0
bundler-cache: true

- name: Install required gems
run: bundle install

- name: Run rubocop
run: bundle exec rubocop
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ AllCops:
DisplayCopNames: true
Exclude:
- "gemfiles/**/*"
- vendor/bundle/**/*

Style/Documentation:
Enabled: false
Expand Down
45 changes: 6 additions & 39 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
language: ruby
cache: bundler
rvm:
- 2.3.8
- 2.4.9
- 2.5.7
- 2.6.5
- 2.7.0
- 3.0.0

env:
- COVERALLS_SILENT=true
before_install:
Expand All @@ -18,46 +17,14 @@ install:
- "mkdir -p test/dummy/tmp/non_default_location"

gemfile:
- gemfiles/rails4_0.gemfile
- gemfiles/rails4_1.gemfile
- gemfiles/rails4_2.gemfile
- gemfiles/rails5_0.gemfile
- gemfiles/rails5_1.gemfile
- gemfiles/rails5_2.gemfile
- gemfiles/rails6_0.gemfile

matrix:
exclude:
# Rails 6 supports Ruby 2.5 and up
- rvm: 2.3.8
gemfile: gemfiles/rails6_0.gemfile
- rvm: 2.4.9
gemfile: gemfiles/rails6_0.gemfile
# rails <=4.1 segfaults with ruby 2.4+
- rvm: 2.4.9
gemfile: gemfiles/rails4_0.gemfile
- rvm: 2.4.9
gemfile: gemfiles/rails4_1.gemfile
- rvm: 2.5.7
gemfile: gemfiles/rails4_0.gemfile
- rvm: 2.5.7
gemfile: gemfiles/rails4_1.gemfile
- rvm: 2.6.5
gemfile: gemfiles/rails4_0.gemfile
- rvm: 2.6.5
gemfile: gemfiles/rails4_1.gemfile
- rvm: 2.7.0
gemfile: gemfiles/rails4_0.gemfile
- rvm: 2.7.0
gemfile: gemfiles/rails4_1.gemfile
# Uninstalling bundler 2 will no longer work since it's a default ruby gem now
- rvm: 2.7.0
gemfile: gemfiles/rails4_2.gemfile

- gemfiles/rails6_1.gemfile
- gemfiles/rails7_0.gemfile

jobs:
include:
- stage: Lint
rvm: 2.7.0
gemfile: gemfiles/rails6_0.gemfile
rvm: 3.0.0
gemfile: gemfiles/rails7_0.gemfile
script: bundle exec rubocop
2 changes: 1 addition & 1 deletion Appraisals
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

rails_versions = ['~> 4.0.5', '~> 4.1.1', '~> 4.2.0', '~> 5.0.0', '~> 5.1.0', '~> 5.2.0', '~> 6.0.0']
rails_versions = ['~> 5.2.0', '~> 6.0.0', '~> 6.1.0', '~> 7.0.0']

rails_versions.each do |rails_version|
appraise "rails#{rails_version.slice(/\d+\.\d+/).tr('.', '_')}" do
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ There's a great [Railscast about Exception Notification](http://railscasts.com/e

## Requirements

* Ruby 2.3 or greater
* Rails 4.0 or greater, Sinatra or another Rack-based application.
* Ruby 2.5 or greater
* Rails 5.2 or greater, Sinatra or another Rack-based application.

## Getting Started

Expand All @@ -35,7 +35,6 @@ ExceptionNotification is used as a rack middleware, or in the environment you wa
```ruby
Rails.application.config.middleware.use ExceptionNotification::Rack,
email: {
deliver_with: :deliver, # Rails >= 4.2.1 do not need this option since it defaults to :deliver_now
email_prefix: '[PREFIX] ',
sender_address: %{"notifier" <[email protected]>},
exception_recipients: %w{[email protected]}
Expand Down Expand Up @@ -270,7 +269,6 @@ def server_error(exception)
end
```


## Extras

### Rails
Expand Down
6 changes: 3 additions & 3 deletions exception_notification.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -- test`.split("\n")
s.require_path = 'lib'

s.add_dependency('actionmailer', '>= 4.0', '< 8')
s.add_dependency('activesupport', '>= 4.0', '< 8')
s.add_dependency('actionmailer', '>= 5.2', '< 8')
s.add_dependency('activesupport', '>= 5.2', '< 8')

s.add_development_dependency 'appraisal', '~> 2.2.0'
s.add_development_dependency 'aws-sdk-sns', '~> 1'
Expand All @@ -32,7 +32,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'httparty', '~> 0.10.2'
s.add_development_dependency 'mocha', '>= 0.13.0'
s.add_development_dependency 'mock_redis', '~> 0.19.0'
s.add_development_dependency 'rails', '>= 4.0', '< 8'
s.add_development_dependency 'rails', '>= 5.2', '< 8'
s.add_development_dependency 'resque', '~> 1.8.0'
s.add_development_dependency 'rubocop', '0.78.0'
s.add_development_dependency 'sidekiq', '>= 5.0.4'
Expand Down
7 changes: 0 additions & 7 deletions gemfiles/rails4_2.gemfile

This file was deleted.

7 changes: 0 additions & 7 deletions gemfiles/rails5_0.gemfile

This file was deleted.

7 changes: 0 additions & 7 deletions gemfiles/rails5_1.gemfile

This file was deleted.

2 changes: 1 addition & 1 deletion gemfiles/rails4_0.gemfile → gemfiles/rails6_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

source "https://rubygems.org"

gem "rails", "~> 4.0.5"
gem "rails", "~> 6.1.0"

gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails4_1.gemfile → gemfiles/rails7_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

source "https://rubygems.org"

gem "rails", "~> 4.1.1"
gem "rails", "~> 7.0.0"

gemspec path: "../"
2 changes: 1 addition & 1 deletion lib/exception_notifier/modules/error_grouping.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "active_support"
require 'active_support'
require 'active_support/core_ext/numeric/time'
require 'active_support/concern'

Expand Down
1 change: 0 additions & 1 deletion lib/exception_notifier/modules/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ def controller_and_action
def rails_app_name
return unless defined?(::Rails) && ::Rails.respond_to?(:application)


if Rails::VERSION::MAJOR >= 6
Rails.application.class.module_parent_name.underscore
else
Expand Down
7 changes: 3 additions & 4 deletions test/exception_notifier/sns_notifier_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def setup
'REQUEST_METHOD' => 'GET',
'REQUEST_URI' => '/examples',
'action_controller.instance' => controller,
'exception_notifier.exception_data' => {current_user: 12}
'exception_notifier.exception_data' => { current_user: 12 }
})
end
test 'should put optional data into text' do
Expand All @@ -146,12 +146,11 @@ def setup
env: {
'REQUEST_METHOD' => 'GET',
'REQUEST_URI' => '/examples',
'action_controller.instance' => controller,
'action_controller.instance' => controller
},
data: {
current_user: 12
}
)
})
end

private
Expand Down

0 comments on commit 7d3c321

Please sign in to comment.