v6.6.1 release in 12/2024. #173
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
#This workflow will build a Java project with Maven - to generate coverage in the file jacaco.csv. | |
# This file is then parsed to generate a coverage percentage. | |
# readme.MD is then updated with this value to make a coverage badge. | |
name: coverage | |
on: | |
push: | |
branches: [ "master" ] | |
# runs tests and generate Jacoco report | |
# | |
jobs: | |
# This workflow contains a single job called "coverage" | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up JDK 1.17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.17 | |
- name: Cache Maven packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Run tests with Maven | |
run: | | |
mvn test --file pom.xml | |
- name: Run coverage parse script | |
run: | | |
chmod +x scripts/coverage_percentage_git.sh | |
percent=`scripts/coverage_percentage_git.sh` | |
echo $percent > .github/coverage/percentage.txt | |
echo coverage = $percent | |
cat /home/runner/work/AuScope-Portal-API/AuScope-Portal-API/target/site/jacoco/jacoco.csv > .github/coverage/jacoco.csv | |
shell: bash | |
- name: Generate JaCoCo Badge | |
id: jacoco | |
uses: cicirello/jacoco-badge-generator@v2 | |
- name: Log coverage percentage | |
run: | | |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | |
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}" | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v8 | |
with: | |
author_name: ${{ github.actor }} | |
author_email: ${{ github.event.commits[0].author.email }} | |
message: Autogenerated JaCoCo coverage badge | |
add: .github/coverage/percentage.txt .github/coverage/jacoco.csv .github/badges/jacoco.svg |