feat: add kover and setup github workflows #1
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: Build | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
# This allows a subsequently queued workflow run to interrupt previous runs | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Generate kover coverage report | |
run: ./gradlew koverXmlReport | |
- name: Add coverage report to PR | |
if: ${{ github.event_name == 'pull_request' }} | |
id: kover | |
uses: mi-kas/kover-report@v1 | |
with: | |
path: ${{ github.workspace }}/mobile/build/reports/kover/report.xml | |
token: ${{ secrets.GITHUB_TOKEN }} | |
title: Code Coverage | |
update-comment: true | |
min-coverage-overall: 80 | |
min-coverage-changed-files: 80 | |
build: | |
strategy: | |
matrix: | |
config: [ | |
{ target: android, os: ubuntu-latest, tasks: testDebugUnitTest testReleaseUnitTest, continueOnError: false }, | |
{ target: apple, os: macos-latest, tasks: iosX64Test iosSimulatorArm64Test macosX64Test macosArm64Test tvosX64Test tvosSimulatorArm64Test watchosX64Test watchosSimulatorArm64Test, continueOnError: false }, | |
{ target: windows, os: windows-latest, tasks: windowsTest, continueOnError: true }, # https://github.com/square/okio/issues/951 | |
{ target: linux, os: ubuntu-latest, tasks: linuxTest, continueOnError: false }, | |
{ target: js, os: ubuntu-latest, tasks: jsTest, continueOnError: false }, | |
{ target: wasm, os: ubuntu-latest, tasks: wasmJsTest, continueOnError: false }, | |
{ target: desktop, os: ubuntu-latest, tasks: desktopTest, continueOnError: false }, | |
] | |
runs-on: ${{ matrix.config.os }} | |
name: Build ${{ matrix.config.target }} | |
needs: check | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Test ${{ matrix.config.target }} targets | |
continue-on-error: ${{ matrix.config.continueOnError }} | |
run: ./gradlew ${{ matrix.config.tasks }} |