Bump org.cicirello:core from 2.6.0 to 2.7.0 #387
Workflow file for this run
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: build | |
on: | |
push: | |
branches: [ main ] | |
paths: [ '**.java', '.github/workflows/build.yml' ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Checkout badges branch to a badges directory nested inside first checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: badges | |
path: badges | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Build with Maven | |
run: mvn -B package -Pcoverage | |
- name: Generate JaCoCo badge | |
id: jacoco | |
uses: cicirello/jacoco-badge-generator@v2 | |
with: | |
badges-directory: badges | |
generate-branches-badge: true | |
generate-summary: true | |
- name: Log coverage percentages to workflow output | |
run: | | |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | |
echo "branches = ${{ steps.jacoco.outputs.branches }}" | |
- name: Upload JaCoCo coverage report as a workflow artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jacoco-report | |
path: target/site/jacoco/ | |
- name: Commit and push the coverage badges and summary file | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
cd badges | |
if [[ `git status --porcelain *.svg *.json` ]]; then | |
git config --global user.name 'github-actions' | |
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
git add *.svg *.json | |
git commit -m "Autogenerated JaCoCo coverage badges" *.svg *.json | |
git push | |
fi | |
- name: Comment on PR with coverage percentages | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
REPORT=$(<badges/coverage-summary.json) | |
COVERAGE=$(jq -r '.coverage' <<< "$REPORT")% | |
BRANCHES=$(jq -r '.branches' <<< "$REPORT")% | |
NEWLINE=$'\n' | |
BODY="## JaCoCo Test Coverage Summary Statistics${NEWLINE}* __Coverage:__ ${COVERAGE}${NEWLINE}* __Branches:__ ${BRANCHES}" | |
gh pr comment ${{github.event.pull_request.number}} -b "${BODY}" | |
continue-on-error: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
examples: | |
name: build the examples | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Build the examples with Maven | |
run: | | |
cd examples | |
mvn -B package |