Update README.md #40
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: Report coverage | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '8' | |
- name: Build with Maven | |
run: mvn -B verify --file pom.xml | |
- name: Merge coverage | |
run: mvn jacoco:merge@merge-id -pl starts-core | |
- name: Report | |
run: mvn jacoco:report@report-id -pl starts-core | |
- name: Generate JaCoCo Badge | |
id: jacoco | |
uses: cicirello/jacoco-badge-generator@v2 | |
with: | |
jacoco-csv-file: starts-core/target/site/jacoco-merged/jacoco.csv | |
generate-branches-badge: true | |
- name: Log coverage percentage | |
run: | | |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | |
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}" | |
- name: Commit and push the badge (if it changed) | |
uses: EndBug/add-and-commit@v7 | |
if: ${{ github.event_name == 'push' }} | |
with: | |
default_author: github_actions | |
message: 'commit badge' | |
add: '*.svg' | |
# Getting: RequestError [HttpError]: Resource not accessible by integration | |
# - name: Add comment to PR | |
# uses: actions/github-script@v4 | |
# if: ${{ github.event_name == 'pull_request' }} | |
# with: | |
# github-token: ${{secrets.GITHUB_TOKEN}} | |
# script: | | |
# github.issues.createComment({ | |
# issue_number: context.issue.number, | |
# owner: context.repo.owner, | |
# repo: context.repo.repo, | |
# body: 'Statement coverage = ${{ steps.jacoco.outputs.coverage }}\n\nBranch coverage = ${{ steps.jacoco.outputs.branches }}' | |
# }) |