Skip to content

Commit

Permalink
Switch to GitHub Actions
Browse files Browse the repository at this point in the history
* Use GitHub Actions for CI
* Update Coveralls integration: generate lcov report with SimpleCov and
  send it after the test suite using coveralls GitHub Actions plugin
* Update and cleanup RSpec config
* Cleanup Rakefile
* Remove active_model dependency (certificate_authority was fixed)

PS: GH Actions syntax is ugly.
  Should we switch to Cirlce CI or GitLab CI? XD

Resolves: #633
  • Loading branch information
ixti committed Dec 20, 2020
1 parent e0af615 commit 7d75ea9
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 88 deletions.
1 change: 0 additions & 1 deletion .coveralls.yml

This file was deleted.

80 changes: 80 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: CI

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

jobs:
test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
ruby: [ ruby-2.4, ruby-2.5, ruby-2.6, ruby-2.7, jruby-9.2.11 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]

steps:
- uses: actions/checkout@v2

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

- uses: actions/cache@v1
with:
path: vendor/bundle
key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-

- name: bundle install
run: |
bundle config set path "vendor/bundle"
bundle config set without "development"
bundle install --jobs 4
- run: bundle exec rspec --format progress --force-colour

- name: Prepare Coveralls test coverage report
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: "${{ matrix.ruby }} @${{ matrix.os }}"
path-to-lcov: ./coverage/lcov/lcov.info
parallel: true

coveralls:
needs: test
runs-on: ubuntu-latest
steps:
- name: Finalize Coveralls test coverage report
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.4

- uses: actions/cache@v1
with:
path: vendor/bundle
key: bundle-use-ruby-lint-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: bundle-use-ruby-lint-

- name: bundle install
run: |
bundle config set path "vendor/bundle"
bundle config set without "development"
bundle install --jobs 4
- run: bundle exec rubocop --color
- run: bundle exec rake verify_measurements
16 changes: 6 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
*.gem
.bundle
.config
.rvmrc
.ruby-version
.yardoc
Gemfile.lock
InstalledFiles
_yardoc
coverage

.bundle
.ruby-version
doc
lib/bundler/man
measurement
coverage
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
spec/examples.txt
tmp
Gemfile.lock
4 changes: 0 additions & 4 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
--backtrace
--color
--format=documentation
--order random
--require spec_helper
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

13 changes: 7 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ group :development do
gem "nokogiri", :require => false
gem "pry", :require => false

platform :ruby_20 do
gem "pry-debugger", :require => false
gem "pry-stack_explorer", :require => false
# RSpec formatter
gem "fuubar", :require => false

platform :mri do
gem "pry-byebug"
end
end

group :test do
gem "activemodel", :require => false # Used by certificate_authority
gem "certificate_authority", :require => false

gem "backports"

gem "coveralls", :require => false
gem "simplecov", ">= 0.9"
gem "simplecov", :require => false
gem "simplecov-lcov", :require => false

gem "rspec", "~> 3.0"
gem "rspec-its"
Expand Down
10 changes: 1 addition & 9 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,4 @@ task :generate_status_codes do
end
end

if ENV["CI"].nil?
task :default => %i[spec rubocop verify_measurements]
else
case ENV["SUITE"]
when "rubocop" then task :default => :rubocop
when "yardstick" then task :default => :verify_measurements
else task :default => :spec
end
end
task :default => %i[spec rubocop verify_measurements]
42 changes: 21 additions & 21 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
# frozen_string_literal: true

require "simplecov"
require "coveralls"

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
)

SimpleCov.start do
add_filter "/spec/"
minimum_coverage 80
end
require_relative "./support/simplecov"
require_relative "./support/fuubar" unless ENV["CI"]

require "http"
require "rspec/its"
Expand All @@ -40,6 +28,13 @@
mocks.verify_partial_doubles = true
end

# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
# have no way to turn it off -- the option exists only for backwards
# compatibility in RSpec 3). It causes shared context metadata to be
# inherited by the metadata hash of host groups and examples, rather than
# triggering implicit auto-inclusion in groups with matching metadata.
config.shared_context_metadata_behavior = :apply_to_host_groups

# These two settings work together to allow you to limit a spec run
# to individual examples or groups you care about by tagging them with
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
Expand All @@ -48,17 +43,22 @@
config.filter_run_excluding :flaky if defined?(JRUBY_VERSION) && ENV["CI"]
config.run_all_when_everything_filtered = true

# Limits the available syntax to the non-monkey patched syntax that is recommended.
# For more details, see:
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
config.disable_monkey_patching!

# This setting enables warnings. It's recommended, but in some cases may
# be too noisy due to issues in dependencies.
config.warnings = 0 == ENV["GUARD_RSPEC"].to_i

# Allows RSpec to persist some state between runs in order to support
# the `--only-failures` and `--next-failure` CLI options. We recommend
# you configure your source control system to ignore this file.
config.example_status_persistence_file_path = "spec/examples.txt"

# Limits the available syntax to the non-monkey patched syntax that is
# recommended. For more details, see:
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
config.disable_monkey_patching!

# Many RSpec users commonly either run the entire suite or an individual
# file, and it's useful to allow more verbose output when running an
# individual spec file.
Expand Down
21 changes: 21 additions & 0 deletions spec/support/fuubar.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

require "fuubar"

RSpec.configure do |config|
# Use Fuubar instafail-alike formatter, unless a formatter has already been
# configured (e.g. via a command-line flag).
config.default_formatter = "Fuubar"

# Disable auto-refresh of the fuubar progress bar to avoid surprises during
# debugiing. And simply because there's next to absolutely no point in having
# this turned on.
#
# > By default fuubar will automatically refresh the bar (and therefore
# > the ETA) every second. Unfortunately this doesn't play well with things
# > like debuggers. When you're debugging, having a bar show up every second
# > is undesireable.
#
# See: https://github.com/thekompanee/fuubar#disabling-auto-refresh
config.fuubar_auto_refresh = false
end
19 changes: 19 additions & 0 deletions spec/support/simplecov.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

require "simplecov"

if ENV["CI"]
require "simplecov-lcov"

SimpleCov::Formatter::LcovFormatter.config do |config|
config.report_with_single_file = true
config.lcov_file_name = "lcov.info"
end

SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
end

SimpleCov.start do
add_filter "/spec/"
minimum_coverage 80
end

0 comments on commit 7d75ea9

Please sign in to comment.