Skip to content

Commit c178a2e

Browse files
Add GitHub actions workflow (#30)
Builds and runs unit tests for agent and ChatApp.
1 parent 56f4fa6 commit c178a2e

27 files changed

Lines changed: 337 additions & 112 deletions

File tree

‎.github/ci-gradle.properties‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ org.gradle.parallel=true
1919
org.gradle.workers.max=2
2020
org.gradle.configuration-cache=true
2121
org.gradle.configuration-cache.parallel=true
22+
org.gradle.jvmargs="-Xmx2g"
2223

2324
kotlin.incremental=false
2425

‎.github/workflows/agent.yaml‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Agent
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'agent/**'
9+
- '.github/workflows/agent.yaml'
10+
- '.github/ci-gradle.properties'
11+
pull_request:
12+
paths:
13+
- 'agent/**'
14+
- '.github/workflows/agent.yaml'
15+
- '.github/ci-gradle.properties'
16+
workflow_dispatch:
17+
18+
concurrency:
19+
group: agent-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
agent-build:
24+
name: "Agent build & test"
25+
runs-on: macos-14
26+
timeout-minutes: 45
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Copy CI gradle.properties
33+
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
34+
35+
- name: Set up JDK 21
36+
uses: actions/setup-java@v4
37+
with:
38+
distribution: 'zulu'
39+
java-version: 21
40+
41+
- name: Setup Gradle
42+
uses: gradle/actions/setup-gradle@v4
43+
44+
- name: Setup Android SDK
45+
uses: android-actions/setup-android@v4
46+
47+
- name: Run spotless
48+
run: ./gradlew spotlessCheck
49+
working-directory: agent
50+
51+
- name: Run unit tests
52+
run: ./gradlew test -PGEMINI_API_KEY=dummy_key
53+
working-directory: agent
54+
55+
- name: Build Debug and Release APKs
56+
run: ./gradlew assembleDebug assembleRelease -PGEMINI_API_KEY=dummy_key
57+
working-directory: agent
58+
59+
- name: Upload Agent APKs
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: agent-apks
63+
path: agent/app/build/outputs/apk/**/*.apk
64+
65+
# - name: Setup GMD
66+
# run: |
67+
# ./gradlew :app:pixel7Api35Setup \
68+
# --info \
69+
# -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true \
70+
# -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
71+
# working-directory: agent
72+
#
73+
# - name: Run instrumentation tests
74+
# run: |
75+
# ./gradlew :app:pixel7Api35Check -PGEMINI_API_KEY=dummy_key \
76+
# -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true \
77+
# -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
78+
# working-directory: agent

‎.github/workflows/chatapp.yaml‎

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: ChatApp
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'ChatApp/**'
9+
- '.github/workflows/chatapp.yaml'
10+
- '.github/ci-gradle.properties'
11+
pull_request:
12+
paths:
13+
- 'ChatApp/**'
14+
- '.github/workflows/chatapp.yaml'
15+
- '.github/ci-gradle.properties'
16+
workflow_dispatch:
17+
18+
concurrency:
19+
group: chatapp-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
chatapp-build:
24+
name: "ChatApp build & test"
25+
runs-on: macos-14
26+
timeout-minutes: 45
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Copy CI gradle.properties
33+
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
34+
35+
- name: Set up JDK 21
36+
uses: actions/setup-java@v4
37+
with:
38+
distribution: 'zulu'
39+
java-version: 21
40+
41+
- name: Setup Gradle
42+
uses: gradle/actions/setup-gradle@v4
43+
44+
- name: Setup Android SDK
45+
uses: android-actions/setup-android@v4
46+
47+
- name: Run spotless
48+
run: ./gradlew spotlessCheck
49+
working-directory: ChatApp
50+
51+
- name: Run unit tests
52+
run: ./gradlew test
53+
working-directory: ChatApp
54+
55+
- name: Build Debug and Release APKs
56+
run: ./gradlew assembleDebug assembleRelease
57+
working-directory: ChatApp
58+
59+
- name: Upload ChatApp APKs
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: chatapp-apks
63+
path: |
64+
ChatApp/app/build/outputs/apk/**/*.apk
65+
ChatApp/wear/build/outputs/apk/**/*.apk
66+
67+
# - name: Setup GMD
68+
# run: |
69+
# ./gradlew :app:pixel7Api35Setup \
70+
# --info \
71+
# -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true \
72+
# -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
73+
# working-directory: ChatApp
74+
#
75+
# - name: Run instrumentation tests
76+
# run: |
77+
# ./gradlew :app:pixel7Api35Check \
78+
# -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true \
79+
# -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
80+
# working-directory: ChatApp
81+
#
82+
# - name: Setup WearOS GMD
83+
# run: |
84+
# ./gradlew :wear:wearOS34Setup \
85+
# --info \
86+
# -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true \
87+
# -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
88+
# working-directory: ChatApp
89+
#
90+
# - name: Run WearOS instrumentation tests
91+
# run: |
92+
# ./gradlew :wear:wearOS34Check \
93+
# -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true \
94+
# -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
95+
# working-directory: ChatApp

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ build/
55
app/build
66
gradle/gradle-daemon-jvm.properties
77
local.properties
8+
!.editorconfig
9+

‎ChatApp/.editorconfig‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
root = true
2+
3+
[*.{kt,kts}]
4+
ktlint_code_style = ktlint_official
5+
ktlint_function_naming_ignore_when_annotated_with = Composable

‎ChatApp/app/build.gradle.kts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ android {
4949
targetCompatibility = JavaVersion.VERSION_17
5050
}
5151
buildFeatures { compose = true }
52+
53+
testOptions {
54+
managedDevices {
55+
localDevices {
56+
create("pixel7Api35") {
57+
device = "Pixel 7"
58+
apiLevel = 35
59+
systemImageSource = "aosp-atd"
60+
}
61+
}
62+
}
63+
}
5264
}
5365

5466
dependencies {

‎ChatApp/app/src/androidTest/kotlin/com/example/chatapp/appfunctions/AppFunctionInstrumentationTest.kt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import androidx.appfunctions.ExecuteAppFunctionRequest
2424
import androidx.appfunctions.ExecuteAppFunctionResponse
2525
import androidx.test.core.app.ApplicationProvider
2626
import androidx.test.ext.junit.runners.AndroidJUnit4
27-
import com.example.chatapp.appfunctions.ChatAppFunctionService
2827
import com.example.chatapp.data.MessageRepository
2928
import com.example.chatapp.data.RecipientsRepository
3029
import com.google.common.truth.Truth.assertThat

‎ChatApp/app/src/main/kotlin/com/example/chatapp/uicomponents/ChatScreen.kt‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,14 +269,16 @@ fun MessageBubble(
269269
}
270270
}
271271
if (message.content.isNotEmpty()) {
272-
val linkColor = if (message.isInbound) {
273-
MaterialTheme.colorScheme.primary
274-
} else {
275-
MaterialTheme.colorScheme.inversePrimary
276-
}
277-
val annotatedText = remember(message.content, linkColor) {
278-
linkifyString(message.content, linkColor = linkColor)
279-
}
272+
val linkColor =
273+
if (message.isInbound) {
274+
MaterialTheme.colorScheme.primary
275+
} else {
276+
MaterialTheme.colorScheme.inversePrimary
277+
}
278+
val annotatedText =
279+
remember(message.content, linkColor) {
280+
linkifyString(message.content, linkColor = linkColor)
281+
}
280282
Text(
281283
modifier = Modifier.padding(16.dp),
282284
text = annotatedText,

‎ChatApp/gradle/libs.versions.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ composeMaterialIconsAndroid = "1.11.1"
1313
composeMaterialIconsCore = "1.7.8"
1414
hilt = "2.59.2"
1515
androidxHiltNavigationCompose = "1.3.0"
16-
ksp = "2.3.6"
16+
ksp = "2.3.9"
1717
spotless = "8.5.0"
1818
truth = "1.4.5"
1919
coil = "2.7.0"

‎ChatApp/shared/build.gradle.kts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,4 @@ dependencies {
4848
// App functions
4949
implementation(libs.androidx.appfunctions)
5050
ksp(libs.androidx.appfunctions.compiler)
51-
5251
}

0 commit comments

Comments
 (0)