Skip to content

Commit

Permalink
Use Codecov for coverage reports
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdeyen committed Mar 8, 2024
1 parent 7c0c483 commit 7cd5946
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,15 @@ jobs:
- name: Prepare database
run: |
bundle exec rake alchemy:spec:prepare
- name: Run tests & publish code coverage
uses: paambaati/codeclimate-action@v3.2.0
env:
CC_TEST_REPORTER_ID: bca4349e32f97919210ac8a450b04904b90683fcdd57d65a22c0f5065482bc22
- name: Run tests
run: |
bundle exec rspec
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
coverageCommand: bundle exec rspec
token: ${{ secrets.CODECOV_TOKEN }}
slug: AlchemyCMS/alchemy_cms
file: ./coverage/coverage.xml
- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ group :development, :test do
gem "standard", "~> 1.25", require: false

if ENV["GITHUB_ACTIONS"]
gem "simplecov-cobertura", "~> 2.1"
# Necessary because GH Actions gem cache does not have this "Bundled with Ruby" gem installed
gem "rexml", "~> 3.2.4"
gem "sassc", "~> 2.4.0" # https://github.com/sass/sassc-ruby/issues/146
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
[![Brakeman Scan](https://github.com/AlchemyCMS/alchemy_cms/actions/workflows/brakeman-analysis.yml/badge.svg)](https://github.com/AlchemyCMS/alchemy_cms/actions/workflows/brakeman-analysis.yml)

[![Gem Version](https://badge.fury.io/rb/alchemy_cms.svg)](https://badge.fury.io/rb/alchemy_cms)
[![Maintainability](https://api.codeclimate.com/v1/badges/196c56c56568ed24a697/maintainability)](https://codeclimate.com/github/AlchemyCMS/alchemy_cms/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/196c56c56568ed24a697/test_coverage)](https://codeclimate.com/github/AlchemyCMS/alchemy_cms/test_coverage)
[![codecov](https://codecov.io/gh/AlchemyCMS/alchemy_cms/graph/badge.svg?token=uUHQGfB2xe)](https://codecov.io/gh/AlchemyCMS/alchemy_cms)
[![Lint](https://github.com/AlchemyCMS/alchemy_cms/actions/workflows/lint.yml/badge.svg)](https://github.com/AlchemyCMS/alchemy_cms/actions/workflows/lint.yml)
[![Depfu](https://badges.depfu.com/badges/ebe56d2dd7b7044a8ae700cc81212a8e/overview.svg)](https://depfu.com/github/AlchemyCMS/alchemy_cms?project_id=4600)

Expand Down
5 changes: 5 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# frozen_string_literal: true

require "simplecov"
if ENV["GITHUB_ACTIONS"]
require "simplecov-cobertura"
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
end

SimpleCov.start "rails" do
add_filter "/lib/alchemy/upgrader"
add_filter "/lib/alchemy/version"
Expand Down

0 comments on commit 7cd5946

Please sign in to comment.