Skip to content

Commit 5ae54ad

Browse files
aggregate and publish coverage
1 parent b196ac3 commit 5ae54ad

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.github/workflows/test.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,39 @@ jobs:
6666
path: coverage/
6767
include-hidden-files: true
6868

69+
coverage:
70+
needs: test
71+
runs-on: ubuntu-latest
72+
73+
steps:
74+
- uses: actions/checkout@v4
75+
76+
- name: Setup Ruby
77+
uses: ruby/setup-ruby@v1
78+
with:
79+
ruby-version: 3.3
80+
bundler-cache: true
81+
82+
- name: Download coverage results
83+
uses: actions/download-artifact@v4
84+
with:
85+
pattern: coverage-*
86+
path: coverage
87+
88+
- name: coverage
89+
env:
90+
CI: 1
91+
run: |
92+
find coverage -name "*resultset.json" -exec sed -i 's?${{ github.workspace }}?'`pwd`'?' {} \;
93+
bundle exec rake coverage:report
94+
95+
- uses: joshmfrankel/simplecov-check-action@main
96+
with:
97+
github_token: ${{ secrets.GITHUB_TOKEN }}
98+
99+
- name: Publish coverage report
100+
uses: tsunematsu21/[email protected]
101+
with:
102+
dir: coverage
103+
branch: gh-pages
104+
token: ${{ secrets.ACCESS_TOKEN }}

Rakefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ require "rubocop/rake_task"
1313

1414
RuboCop::RakeTask.new
1515

16+
namespace :coverage do
17+
desc "Aggregates coverage reports"
18+
task :report do
19+
return unless ENV.key?("CI")
20+
21+
require "simplecov"
22+
23+
puts Dir["coverage/**/.resultset.json"].inspect
24+
SimpleCov.collate Dir["coverage/**/.resultset.json"]
25+
end
26+
end
27+
1628
if RUBY_ENGINE == "ruby" && RUBY_VERSION > "3.0.0" && !Gem.win_platform?
1729
task :type_check do
1830
# Steep doesn't provide Rake integration yet,

0 commit comments

Comments
 (0)