diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9fddb0f..bc3ac2e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -15,6 +15,7 @@ on: jobs: docker: + name: Publish Docker Image runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/frameworkTesting.yml b/.github/workflows/frameworkTesting.yml index e5d303d..af4c5de 100644 --- a/.github/workflows/frameworkTesting.yml +++ b/.github/workflows/frameworkTesting.yml @@ -14,7 +14,8 @@ on: - "src/**" jobs: - run-converter-tests: + run-tests: + name: Run Tests runs-on: ubuntu-latest permissions: pull-requests: write @@ -29,7 +30,7 @@ jobs: - run: npm run test - - name: Convert code coverage results + - name: Convert code coverage results for summary uses: irongut/CodeCoverageSummary@v1.3.0 with: filename: coverage/*.xml @@ -46,3 +47,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/CodeCoverageSummary@v1.3.0 + 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 < 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 \ No newline at end of file diff --git a/README.md b/README.md index ff19390..ec40367 100644 --- a/README.md +++ b/README.md @@ -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)   [![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: