From 58c32013891aea565b19606711fb86aac697ef9f Mon Sep 17 00:00:00 2001 From: Erik Berlin Date: Tue, 21 May 2024 14:04:36 -0700 Subject: [PATCH] Add Maintainability and Test Coverage badges --- .github/workflows/lint.yml | 2 +- .github/workflows/mutant.yml | 2 +- .github/workflows/steep.yml | 2 +- .github/workflows/test.yml | 26 +++++++++++++++++++------- README.md | 2 ++ test/test_helper.rb | 1 + 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 01821ad..1c1b36a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: Linter +name: linter on: [push, pull_request] jobs: build: diff --git a/.github/workflows/mutant.yml b/.github/workflows/mutant.yml index c82f5e3..e6bd92c 100644 --- a/.github/workflows/mutant.yml +++ b/.github/workflows/mutant.yml @@ -1,4 +1,4 @@ -name: Mutant +name: mutation testing on: [push, pull_request] jobs: build: diff --git a/.github/workflows/steep.yml b/.github/workflows/steep.yml index 713cf94..f1ebed7 100644 --- a/.github/workflows/steep.yml +++ b/.github/workflows/steep.yml @@ -1,4 +1,4 @@ -name: Type Checker +name: type checker on: [push, pull_request] jobs: build: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7207133..bb415c0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Tests +name: tests on: [push, pull_request] jobs: build: @@ -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 diff --git a/README.md b/README.md index de288ad..3e3082b 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/test/test_helper.rb b/test/test_helper.rb index 9254213..201b49a 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -5,6 +5,7 @@ SimpleCov.start do add_filter "test" + formatter SimpleCov::Formatter::SimpleFormatter minimum_coverage(100) end end