Eat your own dog food #341
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: Eat your own dog food | |
on: | |
workflow_run: | |
workflows: ["CD"] | |
types: | |
- completed | |
jobs: | |
grade-test-data: | |
name: Run autograding with test data | |
runs-on: ubuntu-latest | |
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: Run Autograding with test data | |
uses: uhafner/autograding-github-action@main | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
checks-name: "Autograding with Test Data" | |
config: > | |
{ | |
"tests": { | |
"tools": [ | |
{ | |
"id": "test", | |
"pattern": "**/src/test/resources/**/TEST*.xml" | |
} | |
], | |
"name": "Tests", | |
"passedImpact": 10, | |
"skippedImpact": -1, | |
"failureImpact": -5, | |
"maxScore": 100 | |
}, | |
"analysis": [ | |
{ | |
"name": "Style", | |
"id": "style", | |
"tools": [ | |
{ | |
"id": "checkstyle", | |
"pattern": "**/src/test/resources/**/checkstyle*.xml" | |
}, | |
{ | |
"id": "pmd", | |
"name": "PMD", | |
"pattern": "**/src/test/resources/**/pmd*.xml" | |
} | |
], | |
"errorImpact": 1, | |
"highImpact": 2, | |
"normalImpact": 3, | |
"lowImpact": 4, | |
"maxScore": 100 | |
}, | |
{ | |
"name": "Bugs", | |
"id": "bugs", | |
"icon": "bug", | |
"tools": [ | |
{ | |
"id": "spotbugs", | |
"pattern": "**/src/test/resources/**/spotbugs*.xml" | |
} | |
], | |
"errorImpact": -11, | |
"highImpact": -12, | |
"normalImpact": -13, | |
"lowImpact": -14, | |
"maxScore": 100 | |
} | |
], | |
"coverage": [ | |
{ | |
"tools": [ | |
{ | |
"id": "jacoco", | |
"name": "Line Coverage", | |
"metric": "line", | |
"pattern": "**/src/test/resources/**/jacoco.xml" | |
}, | |
{ | |
"id": "jacoco", | |
"name": "Branch Coverage", | |
"metric": "branch", | |
"pattern": "**/src/test/resources/**/jacoco.xml" | |
} | |
], | |
"name": "JaCoCo", | |
"maxScore": 100, | |
"coveredPercentageImpact": 1, | |
"missedPercentageImpact": -1 | |
}, | |
{ | |
"tools": [ | |
{ | |
"id": "pit", | |
"name": "Mutation Coverage", | |
"metric": "mutation", | |
"pattern": "**/src/test/resources/**/mutations.xml" | |
} | |
], | |
"name": "PIT", | |
"maxScore": 100, | |
"coveredPercentageImpact": 1, | |
"missedPercentageImpact": -1 | |
} | |
] | |
} | |
grade-github-action: | |
name: Run autograding for the GitHub Autograding Action | |
runs-on: ubuntu-latest | |
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 | |
run: mvn -ntp clean verify -Pci -Ppit -Pdepgraph | |
- name: Run Autograding | |
uses: uhafner/autograding-github-action@main | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
checks-name: "Autograding GitHub Action" | |
- 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/badge-action@v2.0.3 | |
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/badge-action@v2.0.3 | |
with: | |
label: 'Branches' | |
status: ${{ steps.metrics.outputs.branch }}% | |
color: 'green' | |
path: badges/branch-coverage.svg | |
- name: Generate the badge SVG image for the mutation coverage | |
uses: emibcn/badge-action@v2.0.3 | |
with: | |
label: 'Mutations' | |
status: ${{ steps.metrics.outputs.mutation }}% | |
color: 'green' | |
path: badges/mutation-coverage.svg | |
- name: Generate the badge SVG image for the style warnings | |
uses: emibcn/badge-action@v2.0.3 | |
with: | |
label: 'Warnings' | |
status: ${{ steps.metrics.outputs.style }} | |
color: 'orange' | |
path: badges/style-warnings.svg | |
- name: Generate the badge SVG image for the potential bugs | |
uses: emibcn/badge-action@v2.0.3 | |
with: | |
label: 'Bugs' | |
status: ${{ steps.metrics.outputs.bugs }} | |
color: 'red' | |
path: badges/bugs.svg | |
- name: Commit updated badges | |
continue-on-error: true | |
run: | | |
git config --local user.email "action@github.com" | |
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 | |
- name: Push updated badges to GitHub repository | |
uses: ad-m/github-push-action@master | |
if: ${{ success() }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main |