Skip to content

Commit 9743fe1

Browse files
committed
Update coverage badge workflow
1 parent 6f755ce commit 9743fe1

2 files changed

Lines changed: 25 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
os: [ubuntu-latest]
1111
ruby-version:
1212
- head
13-
- '4.0'
13+
- ruby
1414
- '3.4'
1515
- '3.3'
1616
- '3.2'
@@ -52,3 +52,26 @@ jobs:
5252
bundle install --jobs 3 --retry 3
5353
- name: Run tests
5454
run: bundle exec rake test
55+
- name: Read coverage
56+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.os == 'ubuntu-latest' && matrix.ruby-version == 'ruby' }}
57+
run: |
58+
ruby -rjson -e '
59+
coverage = JSON.parse(File.read("coverage/.last_run.json")).dig("result", "line")
60+
abort "coverage result not found" unless coverage
61+
62+
File.open(ENV.fetch("GITHUB_ENV"), "a") do |env|
63+
env.puts "COVERAGE=#{format("%.2f", coverage)}"
64+
end
65+
'
66+
- name: Update coverage badge
67+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.os == 'ubuntu-latest' && matrix.ruby-version == 'ruby' }}
68+
uses: Schneegans/dynamic-badges-action@v1.8.0
69+
with:
70+
auth: ${{ secrets.GIST_TOKEN }}
71+
gistID: 70532e48ae064176aaded5fbbdbf2ffc
72+
filename: highline-coverage.json
73+
label: coverage
74+
message: ${{ env.COVERAGE }}%
75+
valColorRange: ${{ env.COVERAGE }}
76+
maxColorRange: 100
77+
minColorRange: 0

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ HighLine
33

44
[![Tests](https://github.com/JEG2/highline/actions/workflows/ci.yml/badge.svg)](https://github.com/JEG2/highline/actions/workflows/ci.yml)
55
[![Gem Version](https://badge.fury.io/rb/highline.svg)](https://badge.fury.io/rb/highline)
6-
[![Code Climate](https://codeclimate.com/github/JEG2/highline/badges/gpa.svg)](https://codeclimate.com/github/JEG2/highline)
7-
[![Test Coverage](https://codeclimate.com/github/JEG2/highline/badges/coverage.svg)](https://codeclimate.com/github/JEG2/highline/coverage)
6+
[![Test Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/abinoam/70532e48ae064176aaded5fbbdbf2ffc/raw/highline-coverage.json)](https://github.com/JEG2/highline/actions/workflows/ci.yml)
87
[![Inline docs](http://inch-ci.org/github/JEG2/highline.svg?branch=master)](http://inch-ci.org/github/JEG2/highline)
98

109
Description

0 commit comments

Comments
 (0)