add jacoco report #11
Workflow file for this run
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
# https://github.com/Kotlin/multiplatform-library-template/blob/main/.github/workflows/gradle.yml | |
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
name: kmp-socketio build and test. | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
workflow_call: | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: "17" | |
distribution: "temurin" | |
cache: "gradle" | |
- uses: gradle/actions/setup-gradle@v3 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 14 | |
- name: Setup Test Env | |
run: | | |
cd kmp-socketio/src/jvmTest/resources/ | |
npm install | |
- name: Run Jvm tests | |
run: | | |
./gradlew :kmp-socketio:jvmTest --info | |
- name: Gen coverage | |
run: | | |
./gradlew koverXmlReport | |
- name: Add coverage to PR | |
id: jacoco | |
uses: madrapps/[email protected] | |
with: | |
paths: ${{ github.workspace }}/kmp-socketio/build/reports/kover/report.xml | |
token: ${{ secrets.GITHUB_TOKEN }} | |
min-coverage-overall: 80 | |
min-coverage-changed-files: 80 | |
pass-emoji: ":white_check_mark:" | |
fail-emoji: ":negative_squared_cross_mark:" | |
- name: Coverage check | |
if: ${{ steps.jacoco.outputs.coverage-overall < 80.0 }} || ${{ steps.jacoco.outputs.coverage-changed-files < 80.0 }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
core.setFailed("Coverage check failed! overall ${{ steps.jacoco.outputs.coverage-overall }}, diff ${{ steps.jacoco.outputs.coverage-changed-files }}") |