diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 6b91476..ae1fcc7 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -16,5 +16,33 @@ jobs: uses: actions/setup-java@v1 with: java-version: 11 + - name: Build with Maven run: mvn clean package + + - name: Generate Jacoco Badge + id: jacoco + uses: cicirello/jacoco-badge-generator@v2 + with: + generate-branches-badge: true + jacoco-csv-file: > + easy-rules-core/target/site/jacoco/jacoco.csv + easy-rules-jexl/target/site/jacoco/jacoco.csv + easy-rules-mvel/target/site/jacoco/jacoco.csv + easy-rules-spel/target/site/jacoco/jacoco.csv + easy-rules-support/target/site/jacoco/jacoco.csv + + - name: Log coverage percentage + run: | + echo "coverage = ${{ steps.jacoco.outputs.coverage }}" + echo "branches = ${{ steps.jacoco.outputs.branches }}" + + - name: Commit the badge (if it changed) + run: | + if [[ `git status --porcelain` ]]; then + git config --global user.name "dvgaba" + git config --global user.email "3621249+dvgaba@users.noreply.github.com" + git add -A + git commit -m "Autogenerated JaCoCo coverage badge" + git push + fi