Skip to content

Commit

Permalink
Added build status badges
Browse files Browse the repository at this point in the history
  • Loading branch information
NunopRolo committed Jul 29, 2024
1 parent 4fbf1f5 commit c083359
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/gradle.yml → .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Java CI with Gradle
name: Medicines Backend Build

on:
push:
Expand All @@ -18,10 +18,12 @@ jobs:

runs-on: ubuntu-latest
permissions:
contents: read
contents: write

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
Expand All @@ -41,4 +43,21 @@ jobs:
working-directory: ./medicines
run: ./gradlew build -x test

- name: Generate Jacoco Badge
id: jacoco
uses: cicirello/jacoco-badge-generator@v2
with:
generate-branches-badge: true
jacoco-csv-file: medicines/build/reports/jacoco/test/jacocoTestReport.csv

- name: Commit the badge (if it changed)
working-directory: ./medicines
run: |
if [[ `git status --porcelain` ]]; then
git config --global user.name 'Nuno Rolo'
git config --global user.email '[email protected]'
git add -A
git commit -m "Autogenerated JaCoCo coverage badge"
git push
fi
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[issue]: https://github.com/NunopRolo/medicines/issues

![Medicines Backend Build](https://github.com/NunopRolo/medicines/actions/workflows/gradle.yml/badge.svg)
![Medicines Backend Build](https://github.com/NunopRolo/medicines/actions/workflows/frontend.yml/badge.svg)
# Medicines
Medicines app is a web application to manage portuguese medicines.

Expand Down
2 changes: 1 addition & 1 deletion medicines/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jacocoTestReport {

reports {
xml.required = true
csv.required = false
csv.required = true
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
xml.outputLocation = layout.buildDirectory.file('reports/jacoco.xml')
}
Expand Down

0 comments on commit c083359

Please sign in to comment.