mirror of
https://github.com/Magnus167/rustframe.git
synced 2025-08-20 04:00:01 +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
|
||||
run: |
|
||||
jq '{schemaVersion: 1,
|
||||
label: "tarpaulin",
|
||||
message: (printf("%.2f"; .coverage)),
|
||||
color: "blue"}' tarpaulin-report.json > tarpaulin-badge.json
|
||||
|
||||
# extract raw coverage
|
||||
coverage=$(jq '.coverage' tarpaulin-report.json)
|
||||
# round to 2 decimal places
|
||||
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
|
||||
run: |
|
||||
mkdir output
|
||||
|
Loading…
x
Reference in New Issue
Block a user