Skip to content

Commit

Permalink
Coverage4 (#194)
Browse files Browse the repository at this point in the history
Add script to generate coverage badge.
  • Loading branch information
ohler55 authored Dec 28, 2024
1 parent 6d29340 commit bb405c7
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Go

on:
push:
#branches: [ develop, master ]
branches: [ develop, master ]
pull_request:
branches: [ develop ]

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cover: lint
$Q grep github asm/cov.out >> cov.out
$Q go tool cover -func=cov.out | grep "total:"
$(eval COVERAGE = $(shell go tool cover -func=cov.out | grep "total:" | grep -Eo "[0-9]+\.[0-9]+"))
echo "coverage:" $(COVERAGE)
sh ./gen-coverage-badge.sh $(COVERAGE)

test: cover

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://github.com/ohler55/ojg/actions/workflows/CI.yml/badge.svg)](https://github.com/ohler55/ojg/actions)
[![Go Report Card](https://goreportcard.com/badge/github.com/ohler55/ojg)](https://goreportcard.com/report/github.com/ohler55/ojg)
![99%](assets/coverage-badge.svg)
![](assets/coverage-badge.svg)

Optimized JSON for Go is a high performance parser with a variety of
additional JSON tools. OjG is optimized to processing huge data sets
Expand Down
8 changes: 8 additions & 0 deletions assets/coverage-badge-template.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 5 additions & 27 deletions assets/coverage-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions gen-coverage-badge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

COV=`echo "$1" | sed 's/[.].*//'`

if [ "$COV" -lt "50" ]; then
COLOR="#c00000"
elif [ "$COV" -lt "80" ]; then
COLOR="#c08000"
else
COLOR="#00c000"
fi

sed -e "s/999/$1/" -e "s/#888888/$COLOR/" assets/coverage-badge-template.svg > assets/coverage-badge.svg
2 changes: 1 addition & 1 deletion notes
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

- coverage
- badge
- option for fast vs accurate parse
- doc should indicate 16th place variation and diff in performance for float parse


- parse
- add discover option to find JSON or SEN in a string or file
- 3 states
Expand Down

0 comments on commit bb405c7

Please sign in to comment.