Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added build status badges #8

Merged
merged 3 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/badges/branches.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .github/badges/jacoco.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[issue]: https://github.com/NunopRolo/medicines/issues

![Medicines Backend Build](https://github.com/NunopRolo/medicines/actions/workflows/backend.yml/badge.svg)
![Medicines Backend Build](https://github.com/NunopRolo/medicines/actions/workflows/frontend.yml/badge.svg)
![Medicines Backend Tests Coverage](.github/badges/jacoco.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