From a8cf353766c5f96aeb95e83ce3dbb30dc167dae1 Mon Sep 17 00:00:00 2001 From: HoneyryderChuck Date: Fri, 3 Jan 2025 23:35:58 +0000 Subject: [PATCH] aggregate and publish coverage --- .github/workflows/test.yml | 36 ++++++++++++++++++++++++++++++++++++ Rakefile | 12 ++++++++++++ 2 files changed, 48 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7e55659..f583760 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -66,3 +66,39 @@ jobs: path: coverage/ include-hidden-files: true + coverage: + needs: test + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + + steps: + - uses: actions/checkout@v4 + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.4 + bundler-cache: true + + - name: Download coverage results + uses: actions/download-artifact@v4 + with: + pattern: coverage-* + path: coverage + + - name: coverage + env: + CI: 1 + run: | + find coverage -name "*resultset.json" -exec sed -i 's?${{ github.workspace }}?'`pwd`'?' {} \; + bundle exec rake coverage:report + + - uses: joshmfrankel/simplecov-check-action@main + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish coverage report + uses: actions/deploy-pages@v4 + id: deployment \ No newline at end of file diff --git a/Rakefile b/Rakefile index b9d3441..c13ded7 100644 --- a/Rakefile +++ b/Rakefile @@ -13,6 +13,18 @@ require "rubocop/rake_task" RuboCop::RakeTask.new +namespace :coverage do + desc "Aggregates coverage reports" + task :report do + return unless ENV.key?("CI") + + require "simplecov" + + puts Dir["coverage/**/.resultset.json"].inspect + SimpleCov.collate Dir["coverage/**/.resultset.json"] + end +end + if RUBY_ENGINE == "ruby" && RUBY_VERSION > "3.0.0" && !Gem.win_platform? task :type_check do # Steep doesn't provide Rake integration yet,