Skip to content

Commit bb405c7

Browse files
authored
Coverage4 (#194)
Add script to generate coverage badge.
1 parent 6d29340 commit bb405c7

File tree

7 files changed

+30
-31
lines changed

7 files changed

+30
-31
lines changed

.github/workflows/CI.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Go
22

33
on:
44
push:
5-
#branches: [ develop, master ]
5+
branches: [ develop, master ]
66
pull_request:
77
branches: [ develop ]
88

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ cover: lint
2424
$Q grep github asm/cov.out >> cov.out
2525
$Q go tool cover -func=cov.out | grep "total:"
2626
$(eval COVERAGE = $(shell go tool cover -func=cov.out | grep "total:" | grep -Eo "[0-9]+\.[0-9]+"))
27-
echo "coverage:" $(COVERAGE)
27+
sh ./gen-coverage-badge.sh $(COVERAGE)
2828

2929
test: cover
3030

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

77
Optimized JSON for Go is a high performance parser with a variety of
88
additional JSON tools. OjG is optimized to processing huge data sets

assets/coverage-badge-template.svg

+8
Loading

assets/coverage-badge.svg

+5-27
Loading

gen-coverage-badge.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
COV=`echo "$1" | sed 's/[.].*//'`
4+
5+
if [ "$COV" -lt "50" ]; then
6+
COLOR="#c00000"
7+
elif [ "$COV" -lt "80" ]; then
8+
COLOR="#c08000"
9+
else
10+
COLOR="#00c000"
11+
fi
12+
13+
sed -e "s/999/$1/" -e "s/#888888/$COLOR/" assets/coverage-badge-template.svg > assets/coverage-badge.svg

notes

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

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

6+
77
- parse
88
- add discover option to find JSON or SEN in a string or file
99
- 3 states

0 commit comments

Comments
 (0)