Skip to content

Commit

Permalink
Add Github Actions CI configuration
Browse files Browse the repository at this point in the history
Based on: https://github.com/ruby/setup-ruby

Re: #60

Some notes on the initial Github Actions config:

  1. Set min ruby version to 2.5 in order to support JRuby,
     which as of 9.2.17.0 has a RUBY_VERSION of 2.5.

  2. For CodeCov exclude JRuby and TruffleRuby, to avoid
     errors sending the results in Github Actions on those
     jobs rather than debugging them further.

  3. Plan is to next remove Travis CI, and then to convert
     the CodeCov config to use the Github Action for CodeCov
     (thanks @taichi-ishitani for this suggestion!)
  • Loading branch information
ms-ati committed May 6, 2021
1 parent bcc9d78 commit 5455d69
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 9 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Main
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: 'CI Tests'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
ruby: [jruby, truffleruby, 2.5, 2.6, 2.7, '3.0', head]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: false
- run: bundle install
- run: bundle exec rspec
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source "https://rubygems.org"

# Travis-only dependencies go here
if ENV["CI"] == "true"
if ENV["CI"] == "true" && RUBY_ENGINE == "ruby"
gem "codecov", require: false, group: "test"
end

Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/ms-ati/docile)
[![Docs Coverage](http://inch-ci.org/github/ms-ati/docile.png)](http://inch-ci.org/github/ms-ati/docile)

[![Build Status](https://github.com/ms-ati/docile/actions/workflows/main.yml/badge.svg)](https://github.com/ms-ati/docile/actions/workflows/main.yml)
[![Build Status](https://img.shields.io/travis/ms-ati/docile/master.svg)](https://travis-ci.org/ms-ati/docile)
[![Code Coverage](https://img.shields.io/codecov/c/github/ms-ati/docile.svg)](https://codecov.io/github/ms-ati/docile)
[![Maintainability](https://api.codeclimate.com/v1/badges/79ca631bc123f7b83b34/maintainability)](https://codeclimate.com/github/ms-ati/docile/maintainability)
Expand Down Expand Up @@ -351,13 +352,20 @@ $ gem install docile

## Status

Works on [all currently supported ruby versions](https://github.com/ms-ati/docile/blob/master/.travis.yml), or so Travis CI [tells us](https://travis-ci.org/ms-ati/docile).
Works on [all currently supported ruby versions](https://github.com/ms-ati/docile/blob/master/.github/workflows/main.yml),
or so [Github Actions](https://github.com/ms-ati/docile/actions)
and [Travis CI](https://travis-ci.org/ms-ati/docile)
tell us.

Used by some pretty cool gems to implement their DSLs, notably including [SimpleCov](https://github.com/colszowka/simplecov). Keep an eye out for new gems using Docile at the [Ruby Toolbox](https://www.ruby-toolbox.com/projects/docile).
Used by some pretty cool gems to implement their DSLs, notably including
[SimpleCov](https://github.com/colszowka/simplecov). Keep an eye out for new
gems using Docile at the
[Ruby Toolbox](https://www.ruby-toolbox.com/projects/docile).

## Release Policy

Docile releases follow [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html).
Docile releases follow
[Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html).

## Note on Patches/Pull Requests

Expand All @@ -376,4 +384,5 @@ Docile releases follow [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.

Copyright (c) 2012-2021 Marc Siegel.

Licensed under the [MIT License](http://choosealicense.com/licenses/mit/), see [LICENSE](LICENSE) for details.
Licensed under the [MIT License](http://choosealicense.com/licenses/mit/),
see [LICENSE](LICENSE) for details.
4 changes: 2 additions & 2 deletions docile.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Gem::Specification.new do |s|
end
s.require_paths = ["lib"]

# Specify oldest supported Ruby version
s.required_ruby_version = ">= 2.6.0"
# Specify oldest supported Ruby version (2.5 to support JRuby 9.2.17.0)
s.required_ruby_version = ">= 2.5.0"

s.add_development_dependency "rake", "~> 12.3.3"
s.add_development_dependency "rspec", "~> 3.9"
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
add_filter "/vendor/" # exclude gems which are vendored on Travis CI
end

# On CI we publish simplecov results to codecov.io
if ENV["CI"] == "true"
# On CI we publish coverage to codecov.io, except on JRuby and TruffleRuby
if ENV["CI"] == "true" && RUBY_ENGINE == "ruby"
require "codecov"
SimpleCov.formatter = SimpleCov::Formatter::Codecov
end
Expand Down

0 comments on commit 5455d69

Please sign in to comment.