From 2076cfd42e2a85fad8ebe221732b1f57ac8eef51 Mon Sep 17 00:00:00 2001 From: Annie Li Date: Wed, 24 Aug 2022 09:56:47 -0700 Subject: [PATCH 1/4] Add coveralls --- .github/workflows/ci.yml | 4 ++++ Gemfile | 1 + README.md | 1 + test/test_helper.rb | 5 +++++ 4 files changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 577ba1cb2..0784a7d9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,6 +54,10 @@ jobs: run: docker run -d -p 12111-12112:12111-12112 stripe/stripe-mock && sleep 5 - name: test run: bundle install && bundle exec rake test + env: + GITHUB_TOKEN: ${{ secrets.github_token }} + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + COVERALLS_SERVICE_NAME: github-action publish: name: Publish diff --git a/Gemfile b/Gemfile index ab22a8a0e..450146e6f 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,7 @@ source "https://rubygems.org" gemspec group :development do + gem "coveralls_reborn", "~> 0.25.0" if RUBY_VERSION >= "3.1" gem "mocha", "~> 0.13.2" gem "rack", ">= 2.0.6" gem "rake" diff --git a/README.md b/README.md index bc2401460..e32af3dd7 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Gem Version](https://badge.fury.io/rb/stripe.svg)](https://badge.fury.io/rb/stripe) [![Build Status](https://github.com/stripe/stripe-ruby/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-ruby/actions?query=branch%3Amaster) +[![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-ruby/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-ruby?branch=master) The Stripe Ruby library provides convenient access to the Stripe API from applications written in the Ruby language. It includes a pre-defined set of diff --git a/test/test_helper.rb b/test/test_helper.rb index 7af834b0e..55650ede9 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,5 +1,10 @@ # frozen_string_literal: true +if RUBY_VERSION >= "3.1" + require "coveralls" + Coveralls.wear! +end + require "stripe" require "test/unit" require "mocha/setup" From f6474127896c7d0e812f9f0e6b6cd2aadaf682dd Mon Sep 17 00:00:00 2001 From: Annie Li Date: Wed, 24 Aug 2022 10:56:47 -0700 Subject: [PATCH 2/4] Add comment and change to starts_with --- test/test_helper.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 55650ede9..555105f7d 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,6 +1,9 @@ # frozen_string_literal: true -if RUBY_VERSION >= "3.1" +# Report test coverage to coveralls for only one Ruby version to avoid +# repeated builds. This also accounts for coveralls_reborn requiring +# RUBY_VERSION >= 2.5. +if RUBY_VERSION.start_with?("3.1") require "coveralls" Coveralls.wear! end From dc93d96cb9646ea782e9efe597a1e0ddd6b1a707 Mon Sep 17 00:00:00 2001 From: Annie Li Date: Wed, 24 Aug 2022 11:01:48 -0700 Subject: [PATCH 3/4] Change check to 3.1. --- test/test_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 555105f7d..4876b9fba 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -3,7 +3,7 @@ # Report test coverage to coveralls for only one Ruby version to avoid # repeated builds. This also accounts for coveralls_reborn requiring # RUBY_VERSION >= 2.5. -if RUBY_VERSION.start_with?("3.1") +if RUBY_VERSION.start_with?("3.1.") require "coveralls" Coveralls.wear! end From 4d87c3af1e34be04e46f20b8a6178c4531f95deb Mon Sep 17 00:00:00 2001 From: Annie Li Date: Wed, 24 Aug 2022 11:55:55 -0700 Subject: [PATCH 4/4] Restart CI due to Github Actions incident