Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage report uploads to codecove.io #126

Merged
merged 1 commit into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/ruby-unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Install Depenencies
- name: Install Dependencies
run: sudo apt-get -y install raptor2-utils
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
Expand All @@ -29,5 +27,6 @@ jobs:
run: docker compose up -d
- name: Run tests
run: bundle exec rake test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3

10 changes: 7 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ gemspec
gem "activesupport"
gem "cube-ruby", require: "cube"
gem "faraday", '~> 1.9'
gem "minitest", '< 5.0'
gem "pry"
gem "rake"
gem "simplecov", require: false, group: :test
gem "uuid"

group :test do
gem "minitest", '< 5.0'
gem "pry"
gem 'simplecov'
gem 'simplecov-cobertura' # for submitting code coverage results to codecov.io
end

group :profiling do
gem "rack-accept"
gem "rack-post-body-to-params"
Expand Down
16 changes: 11 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,21 @@ GEM
rack (>= 0.4)
rack-post-body-to-params (0.1.8)
activesupport (>= 2.3)
rack-protection (3.0.2)
rack-protection (3.0.3)
rack
rake (13.0.6)
rdf (1.0.8)
addressable (>= 2.2)
redis (5.0.5)
redis-client (>= 0.9.0)
redis-client (0.11.0)
redis-client (0.11.1)
connection_pool
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.5)
rsolr (2.5.0)
builder (>= 2.1.2)
faraday (>= 0.9, < 3, != 2.0.0)
Expand All @@ -115,12 +116,15 @@ GEM
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-cobertura (2.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sinatra (3.0.2)
sinatra (3.0.3)
mustermann (~> 3.0)
rack (~> 2.2, >= 2.2.4)
rack-protection (= 3.0.2)
rack-protection (= 3.0.3)
tilt (~> 2.0)
systemu (2.6.5)
thin (1.8.1)
Expand All @@ -139,6 +143,7 @@ GEM
PLATFORMS
ruby
x86_64-darwin-16
x86_64-linux

DEPENDENCIES
activesupport
Expand All @@ -151,10 +156,11 @@ DEPENDENCIES
rack-post-body-to-params
rake
simplecov
simplecov-cobertura
sinatra
sparql-client!
thin
uuid

BUNDLED WITH
2.3.15
2.3.22
13 changes: 10 additions & 3 deletions test/test_case.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Start simplecov if this is a coverage task
if ENV["COVERAGE"].eql?("true")
require 'simplecov'
# Start simplecov if this is a coverage task or if it is run in the CI pipeline
if ENV["COVERAGE"] == "true" || ENV["CI"] == "true"
require "simplecov"
require "simplecov-cobertura"
# https://github.com/codecov/ruby-standard-2
# Generate HTML and Cobertura reports which can be consumed by codecov uploader
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::CoberturaFormatter
])
SimpleCov.start do
add_filter "/test/"
add_filter "app.rb"
Expand Down