Skip to content

Commit a8cf353

Browse files
aggregate and publish coverage
1 parent b196ac3 commit a8cf353

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+
permissions:
73+
pages: write
74+
id-token: write
75+
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- name: Setup Ruby
80+
uses: ruby/setup-ruby@v1
81+
with:
82+
ruby-version: 3.4
83+
bundler-cache: true
84+
85+
- name: Download coverage results
86+
uses: actions/download-artifact@v4
87+
with:
88+
pattern: coverage-*
89+
path: coverage
90+
91+
- name: coverage
92+
env:
93+
CI: 1
94+
run: |
95+
find coverage -name "*resultset.json" -exec sed -i 's?${{ github.workspace }}?'`pwd`'?' {} \;
96+
bundle exec rake coverage:report
97+
98+
- uses: joshmfrankel/simplecov-check-action@main
99+
with:
100+
github_token: ${{ secrets.GITHUB_TOKEN }}
101+
102+
- name: Publish coverage report
103+
uses: actions/deploy-pages@v4
104+
id: deployment

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)