Skip to content

Merge pull request #1108 from jenkinsci/dependabot/maven/commons-io-c… #199

Merge pull request #1108 from jenkinsci/dependabot/maven/commons-io-c…

Merge pull request #1108 from jenkinsci/dependabot/maven/commons-io-c… #199

Workflow file for this run

name: 'Quality Badges'
on:
push:
branches:
- main
jobs:
coverage:
runs-on: [ubuntu-latest]
name: Update quality badges
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
check-latest: true
cache: 'maven'
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.9.9
- name: Build and test with Maven
run: mvn -V --color always -ntp clean verify -Pci -Pdepgraph | tee maven.log
- name: Run Quality Monitor
uses: uhafner/quality-monitor@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
config: >
{
"tests": {
"tools": [
{
"id": "test",
"name": "Tests",
"pattern": "**/target/*-reports/TEST*.xml"
}
],
"name": "Tests"
},
"analysis": [
{
"name": "Style",
"id": "style",
"tools": [
{
"id": "checkstyle",
"name": "CheckStyle",
"pattern": "**/target/checkstyle-result.xml"
},
{
"id": "pmd",
"name": "PMD",
"pattern": "**/target/pmd.xml"
}
]
},
{
"name": "Bugs",
"id": "bugs",
"icon": "bug",
"tools": [
{
"id": "spotbugs",
"name": "SpotBugs",
"sourcePath": "src/main/java",
"pattern": "**/target/spotbugsXml.xml"
}
]
}
],
"coverage": [
{
"name": "Code Coverage",
"tools": [
{
"id": "jacoco",
"name": "Line Coverage",
"metric": "line",
"sourcePath": "src/main/java",
"pattern": "**/target/site/jacoco/jacoco.xml"
},
{
"id": "jacoco",
"name": "Branch Coverage",
"metric": "branch",
"sourcePath": "src/main/java",
"pattern": "**/target/site/jacoco/jacoco.xml"
}
]
}
]
}
- name: Write metrics to GitHub output
id: metrics
run: |
cat metrics.env >> "${GITHUB_OUTPUT}"
mkdir -p badges
- name: Generate the badge SVG image for the line coverage
uses: emibcn/[email protected]
with:
label: 'Lines'
status: ${{ steps.metrics.outputs.line }}%
color: 'green'
path: badges/line-coverage.svg
- name: Generate the badge SVG image for the branch coverage
uses: emibcn/[email protected]
with:
label: 'Branches'
status: ${{ steps.metrics.outputs.branch }}%
color: 'green'
path: badges/branch-coverage.svg
- name: Generate the badge SVG image for the style warnings
uses: emibcn/[email protected]
with:
label: 'Warnings'
status: ${{ steps.metrics.outputs.style }}
color: 'orange'
path: badges/style.svg
- name: Generate the badge SVG image for the bugs
uses: emibcn/[email protected]
with:
label: 'Bugs'
status: ${{ steps.metrics.outputs.bugs }}
color: 'orange'
path: badges/bugs.svg
- name: Build and test with Maven
run: mvn -V --color always -ntp test -Dtest=UpdateSupportedFormats#run
- name: Commit updated files
continue-on-error: true
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add badges/*.svg
git commit -m "Update badges with results from latest autograding" || true
git add doc/dependency-graph.puml
git commit -m "Update dependency graph to latest versions from POM" || true
git add SUPPORTED-FORMATS.md
git commit -m "Generate list of supported formats" || true
- name: Push updated badges to GitHub repository
uses: ad-m/github-push-action@master
if: ${{ success() }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main