Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add integration test #225

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Integration Test"
on:
push:
branches:
- main
- release/**
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: macos-latest-xlarge

steps:
- uses: actions/checkout@v4

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

- name: Set up Xcode
run: sudo xcode-select -s /Applications/Xcode_15.3.app

- name: Update version
run: |
./scripts/bump-version.sh 0 1.0.0-integration-test

- name: Publish Maven Local & Build
run: |
./gradlew publishToMavenLocal
cd integrationtest && ./gradlew assemble
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
object Config {
val agpVersion = "7.4.2"
val kotlinVersion = "1.9.21"
val composeVersion = "1.5.11"
val kotlinVersion = "1.9.23"
val composeVersion = "1.6.1"
val gradleMavenPublishPluginVersion = "0.18.0"

val multiplatform = "multiplatform"
Expand Down
48 changes: 48 additions & 0 deletions integration-test/androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.kotlinAndroid)
}

android {
namespace = "sample.kmp.app.android"
compileSdk = 34
defaultConfig {
applicationId = "sample.kmp.app.android"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
implementation(projects.shared)
implementation(libs.compose.ui)
implementation(libs.compose.ui.tooling.preview)
implementation(libs.compose.material3)
implementation(libs.androidx.activity.compose)
debugImplementation(libs.compose.ui.tooling)
}
17 changes: 17 additions & 0 deletions integration-test/androidApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="false"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package sample.kmp.app.android

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import sample.kmp.app.Greeting

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MyApplicationTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
GreetingView(Greeting().greet())
}
}
}
}
}

@Composable
fun GreetingView(text: String) {
Text(text = text)
}

@Preview
@Composable
fun DefaultPreview() {
MyApplicationTheme {
GreetingView("Hello, Android!")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package sample.kmp.app.android

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Shapes
import androidx.compose.material3.Typography
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp

@Composable
fun MyApplicationTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable () -> Unit
) {
val colors = if (darkTheme) {
darkColorScheme(
primary = Color(0xFFBB86FC),
secondary = Color(0xFF03DAC5),
tertiary = Color(0xFF3700B3)
)
} else {
lightColorScheme(
primary = Color(0xFF6200EE),
secondary = Color(0xFF03DAC5),
tertiary = Color(0xFF3700B3)
)
}
val typography = Typography(
bodyMedium = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp
)
)
val shapes = Shapes(
small = RoundedCornerShape(4.dp),
medium = RoundedCornerShape(4.dp),
large = RoundedCornerShape(0.dp)
)

MaterialTheme(
colorScheme = colors,
typography = typography,
shapes = shapes,
content = content
)
}
3 changes: 3 additions & 0 deletions integration-test/androidApp/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<style name="AppTheme" parent="android:Theme.Material.NoActionBar"/>
</resources>
5 changes: 5 additions & 0 deletions integration-test/iosApp/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target 'iosApp' do
use_frameworks!
platform :ios, '16.0'
pod 'shared', :path => '../shared'
end
16 changes: 16 additions & 0 deletions integration-test/iosApp/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PODS:
- shared (1.0)

DEPENDENCIES:
- shared (from `../shared`)

EXTERNAL SOURCES:
shared:
:path: "../shared"

SPEC CHECKSUMS:
shared: c133c49697085ba65e4031b78e671fc97617a40d

PODFILE CHECKSUM: 78d6cc1b71b232202c48a29d4e6c34972c534c73

COCOAPODS: 1.15.2
Loading
Loading