Skip to content

Commit

Permalink
Run test coverage as a standalone step
Browse files Browse the repository at this point in the history
  • Loading branch information
z4kn4fein committed Aug 20, 2022
1 parent 0b1f0be commit 785f1c6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/ruby-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
matrix:
ruby-versions: [ 2.4, 2.5, 2.6, 2.7, '3.0' ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -27,19 +27,32 @@ jobs:

- name: Run tests
run: bundle exec rake

coverage:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
bundler-cache: true
- name: Run tests with coverage
run: bundle exec rake
env:
COV: true

publish:
needs: test
needs: coverage
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6

- name: Publish to RubyGems
run: |
mkdir -p $HOME/.gem
Expand Down
10 changes: 6 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'configcat'
require 'simplecov'
require 'codecov'
require 'webmock/rspec'
WebMock.allow_net_connect!
ConfigCat.logger.level = Logger::WARN
SimpleCov.start
SimpleCov.formatter = SimpleCov::Formatter::Codecov
if ENV['COV'] == 'true'
require 'simplecov'
require 'codecov'
SimpleCov.start
SimpleCov.formatter = SimpleCov::Formatter::Codecov
end

0 comments on commit 785f1c6

Please sign in to comment.