Sync with internal repo (#190) #331
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: Test-Suite | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: # added using https://github.com/step-security/secure-workflows | |
contents: read | |
pull-requests: write | |
jobs: | |
test-suite: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: maven | |
- name: Build with Maven | |
run: mvn -B package -Pcoverage --file pom.xml | |
- name: Generate JaCoCo badge | |
id: jacoco | |
uses: cicirello/jacoco-badge-generator@a0c1eb19a496308187341ed2a736ef5df78b7003 | |
with: | |
badges-directory: badges | |
generate-summary: true | |
generate-coverage-endpoint: true | |
- name: Log coverage percentages to workflow output | |
run: | | |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | |
- name: Upload JaCoCo coverage report as a workflow artifact | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce | |
with: | |
name: jacoco-report | |
path: target/site/jacoco/ | |
- name: Comment on PR with coverage percentages | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
REPORT=$(<target/site/jacoco/index.html) | |
gh pr comment ${{github.event.pull_request.number}} -b "${REPORT}" | |
continue-on-error: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |