xxKeAd7C gitInspector #112
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: Java DEV CI | |
on: | |
pull_request: | |
branches: | |
- dev | |
push: | |
branches: | |
- dev | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: temurin | |
- name: Build with Maven | |
run: mvn -B test | |
- name: Generate JaCoCo Badge | |
id: jacoco | |
uses: cicirello/jacoco-badge-generator@v2 | |
with: | |
colors: '#4c1 #97ca00 #a4a61d #dfb317 #fe7d37 #e05d44' | |
fail-if-coverage-less-than: 80 | |
generate-workflow-summary: true | |
workflow-summary-heading: JaCoCo Test Coverage Summary | |
generate-coverage-endpoint: true | |
generate-coverage-badge: true | |
coverage-badge-filename: jacoco.svg | |
- name: Log coverage percentage | |
run: | | |
coverage=$(echo "${{ steps.jacoco.outputs.coverage }} * 100" | bc) | |
branches=$(echo "${{ steps.jacoco.outputs.branches }} * 100" | bc) | |
echo "Coverage = ${coverage}%" | |
echo "Branch Coverage = ${branches}%" | |
- name: Upload JaCoCo badge | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jacoco-badge | |
path: .github/badges/jacoco.svg | |
- name: Upload JaCoCo coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jacoco-report | |
path: target/site/jacoco/ | |
- name: Install and Run gitinspector | |
run: | | |
pip install git+https://github.com/jpwhite3/gitinspector.git | |
mkdir -p .github/reports | |
gitinspector --format=html --since=2024-01-12 --weeks --list-file-types --timeline -b dev > .github/reports/gi-report.html | |
- name: Push coverage badge and gi-report to gh-pages | |
run: | | |
mkdir -p public | |
cp .github/badges/jacoco.svg public/coverage-badge.svg | |
cp .github/reports/gi-report.html public/gitinspector-report.html | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
git fetch origin | |
git checkout -b gh-pages origin/gh-pages || git checkout -b gh-pages | |
mv public/* . | |
git add -f coverage-badge.svg | |
git add -f gitinspector-report.html | |
git commit -m "Update coverage badge and gi-report [skip ci]" || echo "No changes to commit" | |
git push -f origin gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} |