diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71b0d53..22279e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,4 +31,15 @@ jobs: ruby-version: ${{ matrix.ruby }} bundler-cache: true - run: bundle exec standardrb - - run: COVERAGE=0 TEST_NODE_PARITY=1 bundle exec rake test + - name: Run tests with coverage + env: + COVERAGE: 1 + TEST_NODE_PARITY: 1 + run: bundle exec rake test + - name: Upload coverage to Codecov + if: matrix.ruby == 3.3 + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage/coverage.json + fail_ci_if_error: true diff --git a/Gemfile b/Gemfile index b4e2a20..ce1d73b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,8 @@ source "https://rubygems.org" +gem "rake" +gem "minitest" +gem "simplecov" +gem "simplecov-cobertura" + gemspec diff --git a/README.md b/README.md index 49e69f4..141438c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![Build Status](https://github.com/transloadit/ruby-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/transloadit/ruby-sdk/actions/workflows/ci.yml) -[![Code Climate](https://codeclimate.com/github/transloadit/ruby-sdk.png)](https://codeclimate.com/github/transloadit/ruby-sdk) +[![Coverage](https://codecov.io/gh/transloadit/ruby-sdk/branch/main/graph/badge.svg)](https://codecov.io/gh/transloadit/ruby-sdk) # Transloadit Ruby SDK diff --git a/test/test_helper.rb b/test/test_helper.rb index 8ff789f..78e5bfa 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -3,7 +3,13 @@ if ENV["COVERAGE"] != "0" require "simplecov" - SimpleCov.start { add_filter "/test/" } + SimpleCov.start do + add_filter "/test/" + enable_coverage :branch + end + + require "simplecov-cobertura" + SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter end require "minitest/autorun"