|
| 1 | +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time |
| 2 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven |
| 3 | + |
| 4 | +# This workflow uses actions that are not certified by GitHub. |
| 5 | +# They are provided by a third-party and are governed by |
| 6 | +# separate terms of service, privacy policy, and support |
| 7 | +# documentation. |
| 8 | + |
| 9 | +name: Code coverage |
| 10 | + |
| 11 | +on: |
| 12 | + push: |
| 13 | + branches: [ "master" ] |
| 14 | + |
| 15 | +jobs: |
| 16 | + codecov: |
| 17 | + permissions: |
| 18 | + checks: write |
| 19 | + contents: read |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v3 |
| 23 | + - name: Set up JDK 11 |
| 24 | + uses: actions/setup-java@v3 |
| 25 | + with: |
| 26 | + java-version: '11' |
| 27 | + distribution: 'temurin' |
| 28 | + cache: maven |
| 29 | + - uses: ankane/setup-elasticsearch@v1 |
| 30 | + with: |
| 31 | + elasticsearch-version: 8 |
| 32 | + config: | |
| 33 | + http.port: 9200 |
| 34 | + - name: Clear existing docker image cache |
| 35 | + shell: bash |
| 36 | + run: docker image prune -af |
| 37 | + - name: Integration Test with Maven |
| 38 | + run: mvn clean install test-compile failsafe:integration-test failsafe:verify jacoco:report --batch-mode --fail-at-end |
| 39 | + - name: Publish Test Report |
| 40 | + uses: mikepenz/action-junit-report@v3 |
| 41 | + if: success() || failure() # always run even if the previous step fails |
| 42 | + with: |
| 43 | + report_paths: '**/target/failsafe-reports/TEST-*.xml' |
| 44 | + - name: Publish test coverage results |
| 45 | + uses: PavanMudigonda/jacoco-reporter@v4.8 |
| 46 | + with: |
| 47 | + coverage_results_path: 'target/site/jacoco/jacoco.xml' |
| 48 | + coverage_report_title: 'Test coverage results' |
| 49 | + coverage_report_name: 'Test coverage results' |
| 50 | + - name: Upload Code Coverage Artifacts |
| 51 | + uses: actions/upload-artifact@v2 |
| 52 | + with: |
| 53 | + name: code-coverage-report-markdown |
| 54 | + path: '*/coverage-results.md' |
0 commit comments