Skip to content

Commit

Permalink
Merge branch 'feature/2.0.0-ci-improvements' into feature/remove-depr…
Browse files Browse the repository at this point in the history
…ecated-methods
  • Loading branch information
Daeda88 committed Jun 12, 2024
2 parents c1a28e1 + 69e7ddf commit 67a0873
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 32 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,40 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

- name: set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17

- name: run Android unit tests
run: ./gradlew testDebugUnitTest koverHtmlReport
run: ./gradlew testDebugUnitTest koverHtmlReport koverXmlReport
- name: add coverage report to PR
id: kover
uses: mi-kas/kover-report@v1
# this action fails if there is no report, unlike the above actions, so check if there are files
if: ${{ always() && hashFiles('${{ github.workspace }}/build/reports/kover/report.xml') != '' }}
if: ${{ always() && hashFiles(format('{0}/build/reports/kover/report.xml', github.workspace)) != '' }}
with:
path: ${{ github.workspace }}/build/reports/kover/report.xml
token: ${{ secrets.CI_SPLENDO_PAT }}
title: Code coverage
update-comment: true
coverage-counter-type: LINE
- name: Upload Android test artifact
uses: actions/upload-artifact@v4
if: failure()
with:
name: "Android Test Report HTML"
path: "**/build/reports/tests/testDebugUnitTest"
- name: Upload Coverage report
uses: actions/upload-artifact@v4
if: ${{ always() && hashFiles(format('{0}/build/reports/kover/html/index.html', github.workspace)) != '' }}
with:
name: "Android Test Report HTML"
path: "**/build/reports/kover/html"
- name: run apiCheck
run: ./gradlew apiCheck
2 changes: 1 addition & 1 deletion .github/workflows/emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
arch: ${{ runner.arch == 'X86' && 'x86' || runner.arch == 'X64' && 'x86_64' || runner.arch == 'ARM' && 'arm32' || 'arm64' }}

- name: AVD cache
uses: actions/cache@v3
uses: actions/cache@v4
id: avd-cache
with:
path: |
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/ios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
module: ${{ fromJSON(needs.build.outputs.projects) }}
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup tools and cache for workspace
uses: ./.github/workflows/setup_tools_macos/
Expand All @@ -55,3 +55,9 @@ jobs:

- name: run iOS tests
run: ./gradlew :${{ matrix.module }}:ios${{ runner.arch == 'X86' && 'X86' || runner.arch == 'X64' && 'x86_64' || runner.arch == 'ARM' && 'SimulatorArm32' || 'SimulatorArm64' }}Test
- name: Upload iOS test artifact
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ matrix.module}} iOS Test Report HTML
path: ${{ format('**{0}/build/reports/tests/ios{1}Test', matrix.module, runner.arch == 'X86' && 'X86' || runner.arch == 'X64' && 'x86_64' || runner.arch == 'ARM' && 'SimulatorArm32' || 'SimulatorArm64') }}
6 changes: 3 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ${{ github.ref_name == 'master' && 'tartelet' || 'macos-14' }}
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -29,13 +29,13 @@ jobs:
# TODO: use setup_tools_macos

- name : set up JDK 17
uses : actions/setup-java@v3
uses : actions/setup-java@v4
with :
distribution : 'temurin'
java-version : 17

- name: Konan cache
uses: actions/cache@v3
uses: actions/cache@v4
id: konan-cache
with:
path: ~/.konan/*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rerun_emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- run: gh run rerun ${{ github.event.workflow_run.id }} --failed
4 changes: 2 additions & 2 deletions .github/workflows/setup_macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
run: ./gradlew :${{ inputs.project }}:${{ inputs.gradleTask }}

- name: Make cache of workspace
uses: actions/cache/save@v3
uses: actions/cache/save@v4
id: store-build
with:
path: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/setup_tools_macos/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ runs:
using: "composite"
steps:
- name: set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
Expand All @@ -32,15 +32,15 @@ runs:
xcode-version: '15'

- name: Gradle cache
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: ${{ inputs.gradle-cache-read-only }}
gradle-home-cache-includes: |
caches
notifications
- name: Konan cache
uses: actions/cache@v3
uses: actions/cache@v4
id: konan-cache
with:
path: |
Expand All @@ -50,7 +50,7 @@ runs:
key: konan-${{ inputs.kotlinVersion }}

- name: Make cache of workspace
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
if: ${{ inputs.restore-workspace-cache != 'false' }}
id: restore-build
with:
Expand Down
10 changes: 1 addition & 9 deletions base/src/jsMain/kotlin/runBlocking.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ package com.splendo.kaluga.base
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlin.coroutines.CoroutineContext

/**
Expand All @@ -31,10 +29,4 @@ import kotlin.coroutines.CoroutineContext
* @param context the context of the coroutine. The default value is an event loop on the current thread.
* @param block the coroutine code.
*/
actual fun <T> runBlocking(context: CoroutineContext, block: suspend CoroutineScope.() -> T): T {
val result = GlobalScope.async { block(this) }
while (!result.isCompleted) {
GlobalScope.launch { delay(10) }
}
return result.getCompleted()
}
actual fun <T> runBlocking(context: CoroutineContext, block: suspend CoroutineScope.() -> T): T = GlobalScope.async { block(this) }.asDynamic()
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ abstract class BaseKalugaAndroidSubprojectExtension(
objects: ObjectFactory,
) : BaseKalugaSubprojectExtension(versionCatalog, libraryExtension, namespacePostfix, objects) {

override fun Project.setupSubproject() {}

override fun Project.configureSubproject() {
extensions.configure(KotlinAndroidProjectExtension::class) {
compilerOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ sealed class BaseKalugaSubprojectExtension(
).map { it.asDependency() }

override fun Project.beforeEvaluated() {
setupSubproject()
libraryExtension.apply {
compileSdk = versionCatalog.findVersion("androidCompileSdk").get().displayName.toInt()
buildToolsVersion = versionCatalog.findVersion("androidBuildTools").get().displayName
Expand Down Expand Up @@ -113,6 +114,9 @@ sealed class BaseKalugaSubprojectExtension(
configure()
}
}

protected abstract fun Project.setupSubproject()

override fun Project.afterProjectEvaluated() {
if (moduleName.isEmpty()) {
throw RuntimeException("moduleName must be configured")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ open class KalugaMultiplatformSubprojectExtension @Inject constructor(
frameworkConfig = action
}

override fun Project.setupSubproject() {
// Android Target must be setup before project is evaluated as publishing will break otherwise
extensions.configure(KotlinMultiplatformExtension::class) {
androidTarget("androidLib") {
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
unitTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
publishAllLibraryVariants()
}
}
}
@OptIn(ExperimentalKotlinGradlePluginApi::class)
override fun Project.configureSubproject() {
extensions.configure(KotlinMultiplatformExtension::class) {
Expand Down Expand Up @@ -142,12 +152,6 @@ open class KalugaMultiplatformSubprojectExtension @Inject constructor(
}
}

androidTarget("androidLib") {
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
unitTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
publishAllLibraryVariants()
}

val iosTargets = project.iosTargets.map { iosTarget ->
when (iosTarget) {
IOSTarget.Arm64 -> iosArm64()
Expand Down
2 changes: 1 addition & 1 deletion libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
# kotlin version is included since it will affect building
androidGradle = "8.5.0-rc01"
androidGradle = "8.5.0-rc02"
androidBuildTools = "34.0.0"
androidCompileSdk = "34"
androidMinSdk = "24"
Expand Down

0 comments on commit 67a0873

Please sign in to comment.