Skip to content

Commit

Permalink
Improves test actions. (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeFnord authored Jan 18, 2022
1 parent eaf0878 commit a2fec35
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 28 deletions.
68 changes: 46 additions & 22 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,65 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Ruby

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
types: [assigned, opened, edited, synchronize, reopened]
push:
branches:
- 'master'

jobs:
test:
# pre-spec
#
rubocop:
runs-on: ubuntu-latest
steps:
- name: Check out branch
uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
- run: gem install rubocop --no-doc
- name: Run rubocop
run: rubocop --format progress --format json --out rubocop.json

test-ruby-3-rails-6:
runs-on: ubuntu-latest
needs: ['rubocop']
strategy:
matrix:
ruby-version: ['3.0', '3.1', 'head']
rails-version: ['~> 6.1.4']

steps:
- name: Check out branch
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
env:
RAILS_VERSION: ${{ matrix.rails-version }}
- name: Run tests
run: bundle exec rake test

test-rub-27:
runs-on: ubuntu-latest
needs: ['rubocop']
strategy:
matrix:
ruby-version: ['2.6', '2.7']
rails-version: ['~> 5.1.7', '~> 5.2.4', '~> 6.0.3', '~> 6.1.1']
ruby-version: ['2.7']
rails-version: ['~> 5.2.4', '~> 6.1.4']

steps:
- uses: actions/checkout@v2
- name: Check out branch
uses: actions/checkout@v2
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
bundler-cache: true
env:
RAILS_VERSION: ${{ matrix.rails-version }}
- name: Run tests
run: bundle exec rake test
# - name: Run rubocop
# run: bundle exec rubocop
# continue-on-error: true
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.7
Exclude:
- 'Gemfile'
- 'acts_as_follower.gemspec'
Expand Down
6 changes: 3 additions & 3 deletions acts_as_follower.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]

s.add_dependency 'activerecord', '>= 5.0'
s.add_dependency 'activerecord', '>= 5.0', '< 7.0'

s.add_development_dependency "sqlite3"
s.add_development_dependency "shoulda_create"
s.add_development_dependency "shoulda"
s.add_development_dependency "factory_bot"
s.add_development_dependency "rails", ">= 5.0"
s.add_development_dependency "rubocop", ">= 1.0"
s.add_development_dependency "rails", ">= 5.0", '< 7.0'
s.add_development_dependency "rubocop", ">= 1.20"
end
2 changes: 1 addition & 1 deletion lib/acts_as_follower/follow_scopes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

module ActsAsFollower #:nodoc:
module ActsAsFollower # :nodoc:
module FollowScopes
# returns Follow records where follower is the record passed in.
def for_follower(follower)
Expand Down
2 changes: 1 addition & 1 deletion lib/acts_as_follower/followable.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

module ActsAsFollower #:nodoc:
module ActsAsFollower # :nodoc:
module Followable
def self.included(base)
base.extend ClassMethods
Expand Down
2 changes: 1 addition & 1 deletion lib/acts_as_follower/follower.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

module ActsAsFollower #:nodoc:
module ActsAsFollower # :nodoc:
module Follower
def self.included(base)
base.extend ClassMethods
Expand Down
1 change: 1 addition & 0 deletions test/dummy30/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
config.eager_load = false

# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
Expand Down
1 change: 1 addition & 0 deletions test/dummy30/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
config.eager_load = false

# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
Expand Down

0 comments on commit a2fec35

Please sign in to comment.