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 8909d38
Show file tree
Hide file tree
Showing 7 changed files with 30 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
28 changes: 21 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,23 @@ 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
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
EXIT_CODE=${{ job.status == 'success' && '0' || '1' }}
./cc-test-reporter after-build --exit-code $EXIT_CODE -t simplecov
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_formatter", ">= 0.1.4"
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_formatter"

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

SimpleCov.start do
add_filter "test"
Expand Down

0 comments on commit 8909d38

Please sign in to comment.