diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e756efc --- /dev/null +++ b/.github/workflows/build.yml @@ -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 }} diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 3048255..c0c224b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -9,6 +9,7 @@ plugins { alias(libs.plugins.compose.compiler) alias(libs.plugins.ktorfit) alias(libs.plugins.ksp) + alias(libs.plugins.kover) } kotlin { diff --git a/build.gradle.kts b/build.gradle.kts index 971150e..6fe14d6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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 } \ No newline at end of file diff --git a/gdg-chapter/build.gradle.kts b/gdg-chapter/build.gradle.kts index 76d8684..526541f 100644 --- a/gdg-chapter/build.gradle.kts +++ b/gdg-chapter/build.gradle.kts @@ -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 { diff --git a/gdg-chapter/src/commonTest/kotlin/id/gdg/chapter/domain/GetChapterListUseCaseList.kt b/gdg-chapter/src/commonTest/kotlin/id/gdg/chapter/domain/GetChapterListUseCaseList.kt index 11acea1..706bd7f 100644 --- a/gdg-chapter/src/commonTest/kotlin/id/gdg/chapter/domain/GetChapterListUseCaseList.kt +++ b/gdg-chapter/src/commonTest/kotlin/id/gdg/chapter/domain/GetChapterListUseCaseList.kt @@ -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() diff --git a/gdg-events/build.gradle.kts b/gdg-events/build.gradle.kts index b0c2844..e94d06e 100644 --- a/gdg-events/build.gradle.kts +++ b/gdg-events/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlinxSerialization) alias(libs.plugins.ktorfit) alias(libs.plugins.ksp) + alias(libs.plugins.kover) } kotlin { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9b2378d..f82e970 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -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" @@ -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" } \ No newline at end of file +kotlinxSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlinx-serialization" } +kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } \ No newline at end of file