Skip to content

Commit

Permalink
Merge pull request #1 from hoppergee/codeclimate
Browse files Browse the repository at this point in the history
Codeclimate
  • Loading branch information
hoppergee authored May 21, 2022
2 parents 1b02920 + 3cb113d commit 0567ca7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Ruby
name: CI

on:
push:
Expand All @@ -12,7 +12,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }}
name: Ruby ${{ matrix.ruby }} & Rails ${{ matrix.rails_version }}
strategy:
matrix:
ruby:
Expand All @@ -30,6 +30,7 @@ jobs:

env:
RAILS_VERSION: "~> ${{ matrix.rails_version }}.0"
UPLOAD_COVERAGE_TO_CODECLIMATE: true

steps:
- uses: actions/checkout@v3
Expand All @@ -38,5 +39,19 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Setup Code Climate test-reporter
if: matrix.ruby == '3.1' && matrix.rails_version == '7.0'
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: Run the default task
run: bundle exec rake

- name: Publish code coverage
if: matrix.ruby == '3.1' && matrix.rails_version == '7.0'
run: |
export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
./cc-test-reporter after-build -r ${{secrets.CC_TEST_REPORTER_ID}}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# SolidService

[![CI](https://github.com/hoppergee/solidservice/actions/workflows/main.yml/badge.svg)](https://github.com/hoppergee/solidservice/actions/workflows/main.yml)
[![Maintainability](https://api.codeclimate.com/v1/badges/625ef769e60ab39159ce/maintainability)](https://codeclimate.com/github/hoppergee/solidservice/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/625ef769e60ab39159ce/test_coverage)](https://codeclimate.com/github/hoppergee/solidservice/test_coverage)

Servcie object with a simple API.

```ruby
Expand Down
6 changes: 6 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# frozen_string_literal: true

require 'simplecov'

if ENV['UPLOAD_COVERAGE_TO_CODECLIMATE']
require "simplecov_json_formatter"
SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter
end

SimpleCov.start do
add_filter "/test"
end
Expand Down

0 comments on commit 0567ca7

Please sign in to comment.