chore: fixing licence badge #21
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: Main branch | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
env: | |
PRIVATE_MVN_REGISTRY_TOKEN: ${{ secrets.GITLAB_PKG_REGISTRY_TOKEN }} | |
PRIVATE_MVN_REGISTRY_URL: ${{ secrets.GITLAB_MAVEN_REGISTRY_URL }} | |
PRIVATE_DOCKER_REGISTRY_URL: ${{ secrets.GITLAB_DOCKER_REGISTRY_URL }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Checkout badges branch | |
uses: actions/checkout@v3 | |
with: | |
ref: badges | |
path: badges | |
- name: Set up JDK 18 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '18' | |
distribution: 'temurin' | |
cache: maven | |
- name: Build | |
run: mvn --batch-mode --update-snapshots clean package -DskipTests | |
- name: Test | |
run: mvn --batch-mode --update-snapshots clean verify | |
- name: Generate Jacoco Badge | |
id: jacoco | |
uses: cicirello/jacoco-badge-generator@v2 | |
with: | |
badges-directory: badges | |
generate-branches-badge: true | |
jacoco-csv-file: api/target/site/jacoco/jacoco.csv | |
- name: Log coverage percentage | |
run: | | |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | |
echo "branches = ${{ steps.jacoco.outputs.branches }}" | |
- name: Commit and push badges | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
cd badges | |
if [[ `git status --porcelain *.svg` ]]; then | |
git config --global user.name 'github-actions' | |
git config --global user.email '41898282+github-actions[bot]@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@v3 | |
with: | |
name: jacoco-report | |
path: api/target/site/jacoco/ |