Skip to content

Commit

Permalink
Re-enable simplecov and codecov coverage analysis (#253)
Browse files Browse the repository at this point in the history
* Re-enable simplecov and codecov coverage analysis

This got lost when I moved the CI from Travis to GitHub action. Let's
use it again!

* Add the CoberturaFormatter

Uploading the XML-formatted report to codecov via GitHub action.
  • Loading branch information
adomokos authored Sep 8, 2024
1 parent f9ce8af commit 138bfa6
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 12 deletions.
37 changes: 29 additions & 8 deletions .github/workflows/project-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,45 @@ name: CI Tests

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
test:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
os: [ubuntu-latest, macos-latest]
ruby: ['3.1', '3.2', '3.3']
runs-on: ${{ matrix.os }}
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
env:
RUN_COVERAGE_REPORT: true
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
- name: Checkout
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rspec spec
- run: bundle exec rubocop

- name: Install dependencies
run: bundle install

- name: Run tests and Rubocop
run: |
bundle exec rspec spec
bundle exec rubocop
- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./coverage/coverage.xml
flags: unittests
verbose: true

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Gem Version](https://img.shields.io/gem/v/light-service.svg)](https://rubygems.org/gems/light-service)
[![CI Tests](https://github.com/adomokos/light-service/actions/workflows/project-build.yml/badge.svg)](https://github.com/adomokos/light-service/actions/workflows/project-build.yml)
[![Codecov](https://codecov.io/gh/adomokos/light-service/branch/master/graph/badge.svg)](https://codecov.io/gh/adomokos/light-service)
[![Codecov](https://codecov.io/gh/adomokos/light-service/branch/main/graph/badge.svg)](https://codecov.io/gh/adomokos/light-service)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
[![Download Count](https://img.shields.io/badge/download%3A-~5%20million-blue)](https://rubygems.org/gems/light-service)
[![Code Climate](https://codeclimate.com/github/adomokos/light-service.svg)](https://codeclimate.com/github/adomokos/light-service)
Expand Down
2 changes: 2 additions & 0 deletions lib/light-service/deprecation_warning.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module LightService
module Deprecation
class << self
# :nocov:
# Basic implementation of a deprecation warning
def warn(message, callstack = caller)
# Construct the warning message
Expand All @@ -12,6 +13,7 @@ def warn(message, callstack = caller)

# Additional logging or actions can be added here
end
# :nocov:
end
end
end
2 changes: 1 addition & 1 deletion light-service.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency("test-unit", "~> 3.0") # Needed for generator specs.
gem.add_development_dependency("rspec", "~> 3.0")
gem.add_development_dependency("simplecov", "~> 0.17")
gem.add_development_dependency("codecov", "~> 0.1")
gem.add_development_dependency("simplecov-cobertura", "~> 2.1")
gem.add_development_dependency("rubocop", "~> 1.26.0")
gem.add_development_dependency("rubocop-performance", "~> 1.2.0")
gem.add_development_dependency("pry", "~> 0.14")
Expand Down
6 changes: 4 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
end
SimpleCov.minimum_coverage_by_file 90

require 'codecov'
SimpleCov.formatter = SimpleCov::Formatter::Codecov
require 'simplecov-cobertura'
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
# require 'codecov'
# SimpleCov.formatter = SimpleCov::Formatter::Codecov
end

require 'light-service'
Expand Down

0 comments on commit 138bfa6

Please sign in to comment.