Task#60: Fix coverage issue with github action #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Quarkus CI with Maven' | |
on: | |
push: | |
branches: [ "develop" ] | |
pull_request: | |
branches: [ "develop" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
architecture: x64 | |
cache: maven | |
- name: Build with Maven and tests | |
run: mvn -B test | |
- name: Generate JaCoCo Badge | |
id: jacoco | |
uses: cicirello/jacoco-badge-generator@v2 | |
with: | |
generate-branches-badge: true | |
jacoco-csv-file: > | |
domain/target/site/jacoco/jacoco.csv | |
application/target/site/jacoco/jacoco.csv | |
client/target/site/jacoco/jacoco.csv | |
- name: Log coverage percentage | |
run: | | |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | |
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}" | |
- name: Commit and push | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
cd .github/badges | |
if [[ `git status --porcelain *.svg` ]]; then | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" | |
git add *.svg | |
git commit -m "Autogenerated JaCoCo coverage badge" *.svg | |
git push | |
fi | |
- name: Upload Jacoco coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jacoco-report | |
path: target/site/jacoco/ |