Skip to content

Commit 2458d1d

Browse files
committed
Adding Test Coverage
1 parent 4b6f6bd commit 2458d1d

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

.github/workflows/maven.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,24 @@ jobs:
2424
uses: actions/upload-artifact@v4
2525
with:
2626
name: coverage-report
27-
path: target/site/jacoco/
27+
path: target/site/jacoco/
28+
- name: Generate coverage badge
29+
run: |
30+
COVERAGE=$(grep -oP '(?<=<td>Total<\/td><td class="bar">)[^<]+' target/site/jacoco/index.html)
31+
echo "coverage=$COVERAGE" >> $GITHUB_ENV
32+
- name: Create coverage badge
33+
uses: schneegans/[email protected]
34+
with:
35+
auth: ${{ secrets.GITHUB_TOKEN }}
36+
name: coverage
37+
label: Coverage
38+
value: ${{ env.coverage }}
39+
color: green
40+
path: badges/coverage.svg
41+
- name: Commit coverage badge
42+
run: |
43+
git config --local user.email "[email protected]"
44+
git config --local user.name "GitHub Action"
45+
git add badges/coverage.svg
46+
git commit -m "Update coverage badge" || exit 0
47+
git push

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[![JUnit 5](https://img.shields.io/badge/JUnit-5-blue.svg)](https://junit.org/junit5/)
66
[![JaCoCo 0.8.x](https://img.shields.io/badge/JaCoCo-Coverage-blue.svg)](https://www.jacoco.org/jacoco/)
77
[![Build Status](https://github.com/luismr/dictionary-search-anagrams-java/actions/workflows/maven.yml/badge.svg)](https://github.com/luismr/dictionary-search-anagrams-java/actions/workflows/maven.yml)
8+
[![Coverage](https://github.com/luismr/dictionary-search-anagrams-java/blob/main/badges/coverage.svg)](https://github.com/luismr/dictionary-search-anagrams-java/actions/workflows/maven.yml)
89

910
A Java library for searching anagrams in a dictionary with different implementations.
1011

0 commit comments

Comments
 (0)