From 5455d69af6935d63634262e5b0c7ddb7aeac8546 Mon Sep 17 00:00:00 2001 From: Marc Siegel Date: Tue, 4 May 2021 11:49:22 -0400 Subject: [PATCH] Add Github Actions CI configuration 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!) --- .github/workflows/main.yml | 26 ++++++++++++++++++++++++++ Gemfile | 2 +- README.md | 17 +++++++++++++---- docile.gemspec | 4 ++-- spec/spec_helper.rb | 4 ++-- 5 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..6543979 --- /dev/null +++ b/.github/workflows/main.yml @@ -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 diff --git a/Gemfile b/Gemfile index d4197fe..a7e939e 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/README.md b/README.md index 907738d..f6be351 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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 @@ -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. diff --git a/docile.gemspec b/docile.gemspec index 4de5065..7a7ef86 100644 --- a/docile.gemspec +++ b/docile.gemspec @@ -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" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 81f64f7..810699a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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