Skip to content

Commit

Permalink
feat: add kover and setup github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
isfaaghyth committed Aug 24, 2024
1 parent 1fb9977 commit b5ef9a4
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 2 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
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 }}
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ plugins {
alias(libs.plugins.compose.compiler)
alias(libs.plugins.ktorfit)
alias(libs.plugins.ksp)
alias(libs.plugins.kover)
}

kotlin {
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ plugins {
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.jetbrains.kotlin.jvm) apply false
alias(libs.plugins.kotlinxSerialization) apply false
alias(libs.plugins.kover) apply false
}
1 change: 1 addition & 0 deletions gdg-chapter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.kover)
}

kotlin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ class GetChapterListUseCaseList {
ChapterModel(711, "GDG Depok"),
ChapterModel(712, "GDG Semarang"),
ChapterModel(1053, "GDG Makassar"),
ChapterModel(1332, "GDG Medan")
ChapterModel(1332, "GDG Medan"),
ChapterModel(76, "GDG Cloud Surabaya"),
ChapterModel(137, "GDG Cloud Bandung"),
ChapterModel(1158, "GDG Cloud Jakarta")
)

val useCase: GetChapterListUseCase = GetChapterListUseCaseImpl()
Expand Down
1 change: 1 addition & 0 deletions gdg-events/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
alias(libs.plugins.kotlinxSerialization)
alias(libs.plugins.ktorfit)
alias(libs.plugins.ksp)
alias(libs.plugins.kover)
}

kotlin {
Expand Down
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ kotlin = "2.0.0"
kotlin-coroutines = "1.8.0"
kotlin-serializable-json = "1.6.1"
kotlinx-serialization = "1.9.22"
kover = "0.8.3"
ksp = "2.0.0-1.0.24"
ktor = "2.3.10"
ktorfit = "2.0.0-beta1"
Expand Down Expand Up @@ -83,4 +84,5 @@ kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref =
jetbrains-kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "jetbrainsKotlinJvm" }
ktorfit = { id = "de.jensklingenberg.ktorfit", version.ref = "ktorfit" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
kotlinxSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlinx-serialization" }
kotlinxSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlinx-serialization" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }

0 comments on commit b5ef9a4

Please sign in to comment.