Skip to content

Commit 11b6f48

Browse files
committed
Merge coverage results
parser and prism will differ in what they do, so merge them together. jruby doesn't seem to support coverage (maybe jruby bug?): > KeyError: key not found: :branch
1 parent 160d5ca commit 11b6f48

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

.github/workflows/main.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,34 @@ jobs:
4747
with:
4848
ruby-version: "${{ matrix.ruby }}"
4949
bundler-cache: true
50-
- run: NO_COVERAGE=true bundle exec rake spec
50+
- run: bundle exec rake spec
5151
env:
5252
PARSER_ENGINE: ${{ matrix.parser_engine }}
53+
- name: Upload Coverage Artifact
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: coverage-ubuntu-${{ matrix.ruby }}-${{ matrix.parser_engine }}
57+
path: coverage/.resultset.json
58+
if-no-files-found: error
59+
include-hidden-files: true
5360

5461
coverage:
62+
name: Check Coverage
63+
needs: main
5564
runs-on: ubuntu-latest
56-
name: "Test coverage"
65+
5766
steps:
5867
- uses: actions/checkout@v4
68+
- uses: actions/download-artifact@v4
69+
name: Download Coverage Artifacts
70+
with:
71+
pattern: coverage-*
5972
- uses: ruby/setup-ruby@v1
6073
with:
61-
ruby-version: "3.4"
74+
ruby-version: ruby # Latest stable CRuby version
6275
bundler-cache: true
63-
- run: bundle exec rake spec
76+
77+
- run: bundle exec rake coverage:ci
6478

6579
edge-rubocop:
6680
runs-on: ubuntu-latest

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require 'rubocop'
44
require 'rubocop/rspec/support'
55

6-
require 'simplecov' unless ENV['NO_COVERAGE']
6+
require 'simplecov' unless ENV['NO_COVERAGE'] || RUBY_ENGINE == 'jruby'
77

88
module SpecHelper
99
ROOT = Pathname.new(__dir__).parent.freeze

tasks/coverage.rake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
namespace :coverage do
4+
desc 'Report Coverage from merged CI runs'
5+
task :ci do
6+
require 'simplecov'
7+
8+
SimpleCov.collate Dir['coverage-*/.resultset.json']
9+
end
10+
end

0 commit comments

Comments
 (0)