Skip to content

Fix GitHub badges

Fix GitHub badges #694

Workflow file for this run

name: Build and Test
on:
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
permissions:
checks: write
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'adopt'
cache: maven
- name: Build with maven
run: mvn -Pgithub-action clean verify
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
#if: always() # clause guarantees that this action always runs, even if earlier steps (e.g., the unit test step) in your workflow fail.
with:
files: ${{ github.workspace }}/target/surefire-reports/**/*.xml
- name: Add coverage to PR
id: jacoco
uses: madrapps/jacoco-report@v1.6.1 # requires at least two pushes to a PR, see https://github.com/Madrapps/jacoco-report/issues/13
with:
paths: ${{ github.workspace }}/target/jacoco-report/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 40
min-coverage-changed-files: 60
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: target/jacoco-report/**
- name: ls
run: ls -al target/jacoco-report/
- name: Generate JaCoCo Badge
uses: cicirello/jacoco-badge-generator@v2
with:
jacoco-csv-file: target/jacoco-report/jacoco.csv
generate-coverage-badge: true
badges-directory: .github/badges
- name: Commit the badge (if it changed)
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
if [[ `git diff --exit-code .github/badges/jacoco.svg` ]]; then
git add .github/badges/jacoco.svg
git commit -m "Autogenerated JaCoCo coverage badge"
git push
fi
lint-markdown:
name: Lint all markdown files in project
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Lint markdowns
uses: nosborn/github-action-markdown-cli@v3.0.1
with:
files: '**/*.md'