Skip to content

Commit

Permalink
Add Maintainability and Test Coverage badges
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed May 21, 2024
1 parent 11573fc commit bb70897
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Linter
name: linter
on: [push, pull_request]
jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mutant.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Mutant
name: mutation testing
on: [push, pull_request]
jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/steep.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Type Checker
name: type checker
on: [push, pull_request]
jobs:
build:
Expand Down
26 changes: 19 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: tests
on: [push, pull_request]
jobs:
build:
Expand All @@ -7,9 +7,21 @@ jobs:
ruby: ["3.1", "3.2", "3.3"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake test
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Set up Code Climate test reporter
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
- name: Before build
run: ./cc-test-reporter before-build
- name: Run tests
run: bundle exec rake test
- name: After build
if: always() # Ensures that this step runs even if the test step fails
run: |
EXIT_CODE=${{ job.status == 'success' && '0' || '1' }}
./cc-test-reporter after-build --exit-code $EXIT_CODE -t simplecov -r 503b90af6f7d19fdb5efdfbebc093049baaf24fe6f15a206240ceef2a438620d
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ gem "rubocop-minitest", ">= 0.31"
gem "rubocop-performance", ">= 1.18"
gem "rubocop-rake", ">= 0.6"
gem "simplecov", ">= 0.22"
gem "simplecov-json", ">= 0.2.3"
gem "standard", ">= 1.30.1"
gem "steep", ">= 1.5.3"
gem "webmock", ">= 3.18.1"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
[![Linter](https://github.com/sferik/x-ruby/actions/workflows/lint.yml/badge.svg)](https://github.com/sferik/x-ruby/actions/workflows/lint.yml)
[![Mutant](https://github.com/sferik/x-ruby/actions/workflows/mutant.yml/badge.svg)](https://github.com/sferik/x-ruby/actions/workflows/mutant.yml)
[![Typer Checker](https://github.com/sferik/x-ruby/actions/workflows/steep.yml/badge.svg)](https://github.com/sferik/x-ruby/actions/workflows/steep.yml)
[![Test Coverage](https://api.codeclimate.com/v1/badges/40bbddf2c9170742ca9e/test_coverage)](https://codeclimate.com/github/sferik/x-ruby/test_coverage)
[![Maintainability](https://api.codeclimate.com/v1/badges/40bbddf2c9170742ca9e/maintainability)](https://codeclimate.com/github/sferik/x-ruby/maintainability)
[![Gem Version](https://badge.fury.io/rb/x.svg)](https://rubygems.org/gems/x)

# A [Ruby](https://www.ruby-lang.org) interface to the [X API](https://developer.x.com)
Expand Down
3 changes: 3 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

unless $PROGRAM_NAME.end_with?("mutant")
require "simplecov"
require "simplecov-json"

SimpleCov.formatters = [SimpleCov::Formatter::JSONFormatter]

SimpleCov.start do
add_filter "test"
Expand Down

0 comments on commit bb70897

Please sign in to comment.