Skip to content

Commit

Permalink
add workflow for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
micha37-martins committed Aug 22, 2024
1 parent 82e1462 commit 1dd652d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/github-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ jobs:
chmod +x ./coverage.sh
bash ./coverage.sh
# Info: sed is used as the js file is no strict json format
- name: Extract coverage percentage from index.js
id: coverage
shell: bash
run: |
coverage=$(sed -n '/var data = /,/};/p' ./coverage/test_smartmon.coverage/index.js | sed '1s/.*= //' | sed '$s/};/}/' | jq -r '.files[0].covered')
echo "Extracted coverage percentage: $coverage"
echo "::set-output name=coverage::$coverage"
coverage=$(grep -oP '(?<=covered":")[^"]+' ./coverage/test_smartmon.coverage/index.js | head -n 1)
echo "Extracted coverage percentage: $coverage"
echo "::set-output name=coverage::$coverage"

- name: Update README.md with coverage badge
run: |
Expand Down

0 comments on commit 1dd652d

Please sign in to comment.