mirror of
https://github.com/Magnus167/rustframe.git
synced 2025-08-20 08:00:00 +00:00
refactor badge JSON export to extract and format coverage value
This commit is contained in:
parent
3dd7a65726
commit
df775bde58
18
.github/workflows/docs-and-testcov.yml
vendored
18
.github/workflows/docs-and-testcov.yml
vendored
@ -53,11 +53,19 @@ jobs:
|
|||||||
|
|
||||||
- name: Export tarpaulin coverage badge JSON
|
- name: Export tarpaulin coverage badge JSON
|
||||||
run: |
|
run: |
|
||||||
jq '{schemaVersion: 1,
|
# extract raw coverage
|
||||||
label: "tarpaulin",
|
coverage=$(jq '.coverage' tarpaulin-report.json)
|
||||||
message: (printf("%.2f"; .coverage)),
|
# round to 2 decimal places
|
||||||
color: "blue"}' tarpaulin-report.json > tarpaulin-badge.json
|
formatted=$(printf "%.2f" "$coverage")
|
||||||
|
# build the badge JSON using the pre-formatted string
|
||||||
|
jq --arg message "$formatted" \
|
||||||
|
'{schemaVersion:1,
|
||||||
|
label:"tarpaulin",
|
||||||
|
message:$message,
|
||||||
|
color:"blue"}' \
|
||||||
|
tarpaulin-report.json \
|
||||||
|
> tarpaulin-badge.json
|
||||||
|
|
||||||
- name: Copy files to output directory
|
- name: Copy files to output directory
|
||||||
run: |
|
run: |
|
||||||
mkdir output
|
mkdir output
|
||||||
|
Loading…
x
Reference in New Issue
Block a user