Skip to content

Commit

Permalink
Merge pull request #1128 from collectiveidea/dg-move-to-github-actions
Browse files Browse the repository at this point in the history
Move to GitHub Actions
  • Loading branch information
albus522 committed Dec 9, 2020
2 parents 5ac5ade + 44412a5 commit c7809c3
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 76 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,65 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: [2.5, 2.6, 2.7, jruby, jruby-head, ruby-head]
rails_version:
- '5.2.0'
- '6.0.0'
- 'edge'
include:
#
# The past
#
# EOL Active Record
- ruby: 2.2
rails_version: '3.2.0'
- ruby: 2.1
rails_version: '4.1.0'
- ruby: 2.4
rails_version: '4.2.0'
- ruby: 2.4
rails_version: '5.0.0'
- ruby: 2.5
rails_version: '5.1.0'

continue-on-error: ${{ matrix.rails_version == 'edge' || endsWith(matrix.ruby, 'head') }}

steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
env:
RAILS_VERSION: ${{ matrix.rails_version }}
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
env:
RAILS_VERSION: ${{ matrix.rails_version }}
run: bundle exec rspec
- name: Coveralls Parallel
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
flag-name: run-${{ matrix.ruby }}-${{ matrix.rails_version }}
parallel: true

finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
30 changes: 30 additions & 0 deletions .github/workflows/rubocop.yml
@@ -0,0 +1,30 @@
name: RuboCop

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Generate lockfile for cache key
run: bundle lock
- name: Cache gems
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-rubocop-
- name: Install gems
run: |
bundle config path vendor/bundle
bundle config set without 'default test'
bundle install --jobs 4 --retry 3
- name: Run RuboCop
run: bundle exec rubocop
62 changes: 0 additions & 62 deletions .travis.yml

This file was deleted.

27 changes: 20 additions & 7 deletions Gemfile
Expand Up @@ -5,15 +5,15 @@ gem 'rake'
platforms :ruby do
# Rails 5.1 is the first to work with sqlite 1.4
# Rails 6 now requires sqlite 1.4
if ENV['RAILS_VERSION'] && ENV['RAILS_VERSION'].split.last < '5.1'
if ENV['RAILS_VERSION'] && ENV['RAILS_VERSION'] < '5.1'
gem 'sqlite3', '< 1.4'
else
gem 'sqlite3'
end
end

platforms :jruby do
if ENV['RAILS_VERSION'] == '~> 4.2.0'
if ENV['RAILS_VERSION'] == '4.2.0'
gem 'activerecord-jdbcsqlite3-adapter', '< 50.0'
else
gem 'activerecord-jdbcsqlite3-adapter'
Expand All @@ -22,8 +22,10 @@ platforms :jruby do
gem 'mime-types', ['~> 2.6', '< 2.99']
if ENV['RAILS_VERSION'] == 'edge'
gem 'railties', :github => 'rails/rails'
elsif ENV['RAILS_VERSION']
gem 'railties', "~> #{ENV['RAILS_VERSION']}"
else
gem 'railties', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.3'])
gem 'railties', ['>= 3.0', '< 5.3']
end
end

Expand All @@ -35,15 +37,26 @@ group :test do
if ENV['RAILS_VERSION'] == 'edge'
gem 'actionmailer', :github => 'rails/rails'
gem 'activerecord', :github => 'rails/rails'
elsif ENV['RAILS_VERSION']
gem 'actionmailer', "~> #{ENV['RAILS_VERSION']}"
gem 'activerecord', "~> #{ENV['RAILS_VERSION']}"
else
gem 'actionmailer', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.3'])
gem 'activerecord', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.3'])
gem 'actionmailer', ['>= 3.0', '< 5.3']
gem 'activerecord', ['>= 3.0', '< 5.3']
end

gem 'coveralls', :require => false
gem 'rspec', '>= 3'
gem 'simplecov', :require => false
if /\A2.[12]/ =~ RUBY_VERSION
# 0.8.0 doesn't work with simplecov < 0.18.0 and older ruby can't run 0.18.0
gem 'simplecov-lcov', '< 0.8.0', :require => false
else
gem 'simplecov-lcov', :require => false
end
end

group :rubocop do
gem 'rubocop', '>= 0.25', '< 0.49'
gem 'simplecov', '>= 0.9'
end

gemspec
3 changes: 1 addition & 2 deletions README.md
Expand Up @@ -6,12 +6,11 @@ you're reading the documentation for the master branch.
Delayed::Job
============
[![Gem Version](https://badge.fury.io/rb/delayed_job.svg)][gem]
[![Build Status](https://travis-ci.org/collectiveidea/delayed_job.svg?branch=master)][travis]
![CI](https://github.com/collectiveidea/delayed_job/workflows/CI/badge.svg)
[![Code Climate](https://codeclimate.com/github/collectiveidea/delayed_job.svg)][codeclimate]
[![Coverage Status](https://coveralls.io/repos/collectiveidea/delayed_job/badge.svg?branch=master)][coveralls]

[gem]: https://rubygems.org/gems/delayed_job
[travis]: https://travis-ci.org/collectiveidea/delayed_job
[codeclimate]: https://codeclimate.com/github/collectiveidea/delayed_job
[coveralls]: https://coveralls.io/r/collectiveidea/delayed_job

Expand Down
16 changes: 11 additions & 5 deletions spec/helper.rb
@@ -1,13 +1,19 @@
require 'simplecov'
require 'coveralls'
require 'simplecov-lcov'

SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
c.single_report_path = 'coverage/lcov.info'
end
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::LcovFormatter
]
)

SimpleCov.start do
add_filter '/spec/'
# Each version of ruby and version of rails test different things
# This should probably just be removed.
minimum_coverage(85.0)
end

require 'logger'
Expand Down

0 comments on commit c7809c3

Please sign in to comment.