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 a51896d
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 11 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 tests
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
29 changes: 22 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
name: Tests
name: tests
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
ruby: ["3.1", "3.2", "3.3"]
runs-on: ubuntu-latest
environment: test
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"
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[![Tests](https://github.com/sferik/x-ruby/actions/workflows/test.yml/badge.svg)](https://github.com/sferik/x-ruby/actions/workflows/test.yml)
[![Linter](https://github.com/sferik/x-ruby/actions/workflows/lint.yml/badge.svg)](https://github.com/sferik/x-ruby/actions/workflows/lint.yml)
[![Test Coverage](https://api.codeclimate.com/v1/badges/40bbddf2c9170742ca9e/test_coverage)](https://codeclimate.com/github/sferik/x-ruby/test_coverage)
[![Mutant](https://github.com/sferik/x-ruby/actions/workflows/mutant.yml/badge.svg)](https://github.com/sferik/x-ruby/actions/workflows/mutant.yml)
[![Linter](https://github.com/sferik/x-ruby/actions/workflows/lint.yml/badge.svg)](https://github.com/sferik/x-ruby/actions/workflows/lint.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)
[![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 a51896d

Please sign in to comment.