Skip to content

Commit

Permalink
Show test coverage badge
Browse files Browse the repository at this point in the history
  • Loading branch information
dickwolff authored Feb 10, 2024
1 parent 6380880 commit 64bd373
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:

jobs:
docker:
name: Publish Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
41 changes: 39 additions & 2 deletions .github/workflows/frameworkTesting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ on:
- "src/**"

jobs:
run-converter-tests:
run-tests:
name: Run Tests
runs-on: ubuntu-latest
permissions:
pull-requests: write
Expand All @@ -30,7 +31,7 @@ jobs:

- run: npm run test

- name: Convert code coverage results
- name: Convert code coverage results for summary
uses: irongut/[email protected]
with:
filename: coverage/*.xml
Expand All @@ -47,3 +48,39 @@ jobs:

- name: Write to job summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY

- name: Convert code coverage results for badge
uses: irongut/[email protected]
if: github.event_name != 'pull_request'
with:
filename: coverage/*.xml
hide_branch_rate: true
hide_complexity: true
badge: true
output: 'file'

- name: Extract code coverage badge
if: github.event_name != 'pull_request'
run: |
read -r line < code-coverage-results.txt
coverage=$(echo "$line" | sed -n 's/.*Code%20Coverage-\([0-9]*\)%.*/\1/p')
condition=$(echo "$line" | sed -n 's/.*%25-\([a-z]*\)?.*/\1/p')
[[ $condition == "critical" ]] && color="#e05d44" || color="#44cc11"
cat <<EOF > cov.json
{
"schemaVersion": 1,
"label": "Code Coverage",
"message": "$coverage",
"style": "for-the-badge",
"color": "$color"
}
- name: Publish code coverage badge
uses: exuanbo/actions-deploy-gist@v1
if: github.event_name != 'pull_request'
with:
token: ${{ secrets.GIST_SECRET }}
gist_id: dd5dc24ffa62de59b3d836f856f48a10
file_path: cov.json
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Github-sponsors](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/dickwolff) &nbsp;
[![BuyMeACoffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/dickw0lff)

![Code Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/dickwolff/dd5dc24ffa62de59b3d836f856f48a10/raw/cov.json)

This tool allows you to convert a multiple transaction exports (CSV) to an import file that can be read by [Ghostfolio](https://github.com/ghostfolio/ghostfolio/). Currently there is support for:

Expand Down

0 comments on commit 64bd373

Please sign in to comment.