From 46b853202c0681a082057c8473eb73e4ba16bd7b Mon Sep 17 00:00:00 2001 From: Tony Mak Date: Mon, 23 Nov 2026 10:52:22 +0000 Subject: [PATCH 1/7] ci: enable ChatApp GMD tests on ubuntu-latest and add Gemini Code Assist config --- .gemini/config.yaml | 8 +++++ .gemini/styleguide.md | 18 ++++++++++ .github/workflows/chatapp.yaml | 65 +++++++++++++++------------------- 3 files changed, 55 insertions(+), 36 deletions(-) create mode 100644 .gemini/config.yaml create mode 100644 .gemini/styleguide.md diff --git a/.gemini/config.yaml b/.gemini/config.yaml new file mode 100644 index 00000000..b1dc38ca --- /dev/null +++ b/.gemini/config.yaml @@ -0,0 +1,8 @@ +have_fun: false +code_review: + disable: false + comment_severity_threshold: MEDIUM +ignore_patterns: + - "**/*.pb.kt" + - "**/build/**" + - "**/.gradle/**" diff --git a/.gemini/styleguide.md b/.gemini/styleguide.md new file mode 100644 index 00000000..20cd82be --- /dev/null +++ b/.gemini/styleguide.md @@ -0,0 +1,18 @@ +# Android AppFunctions Code Review Style Guide + +This repository contains Android Kotlin and Jetpack Compose projects (`ChatApp/` and `agent/`). + +## General +- Follow the [Android Kotlin Style Guide](https://developer.android.com/kotlin/style-guide); formatting is enforced by Spotless (`./gradlew spotlessCheck`). +- Keep changes focused and minimal; avoid unrelated refactoring. +- Ensure new public APIs and non-trivial logic include unit or instrumentation tests. + +## Android & Compose +- Follow Unidirectional Data Flow (UDF): state flows down, events flow up. +- Avoid blocking calls on the main thread; use structured concurrency and appropriate `CoroutineDispatcher`s. +- Prefer `StateFlow` / immutable UI state models over mutable shared state. +- Check for resource leaks, lifecycle issues, and missing permission/nullability checks. + +## GitHub Actions +- Pin third-party actions to full commit SHAs with a version comment (e.g. `@ # vX`). +- Declare minimal `permissions:` on workflow jobs. diff --git a/.github/workflows/chatapp.yaml b/.github/workflows/chatapp.yaml index a2fb8c86..2fc91fdb 100644 --- a/.github/workflows/chatapp.yaml +++ b/.github/workflows/chatapp.yaml @@ -22,27 +22,29 @@ concurrency: jobs: chatapp-build: name: "ChatApp build & test" - runs-on: macos-26 + runs-on: ubuntu-latest timeout-minutes: 45 + permissions: + contents: read steps: - name: Checkout - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - name: Copy CI gradle.properties run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties - name: Set up JDK 21 - uses: actions/setup-java@v6 + uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6 with: distribution: 'zulu' java-version: 21 - name: Setup Gradle - uses: gradle/actions/setup-gradle@v6 + uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6 - name: Setup Android SDK - uses: android-actions/setup-android@v4 + uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4 - name: Run spotless run: ./gradlew spotlessCheck @@ -52,44 +54,35 @@ jobs: run: ./gradlew test working-directory: ChatApp + - name: Enable KVM group perms + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + + - name: Setup GMD + run: | + ./gradlew :app:pixel7Api35Setup \ + --info \ + -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true \ + -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" + working-directory: ChatApp + + - name: Run instrumentation tests + run: | + ./gradlew :app:pixel7Api35Check \ + -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true \ + -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" + working-directory: ChatApp + - name: Build Debug and Release APKs run: ./gradlew assembleDebug assembleRelease working-directory: ChatApp - name: Upload ChatApp APKs - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 with: name: chatapp-apks path: | ChatApp/app/build/outputs/apk/**/*.apk ChatApp/wear/build/outputs/apk/**/*.apk - -# - name: Setup GMD -# run: | -# ./gradlew :app:pixel7Api35Setup \ -# --info \ -# -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true \ -# -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" -# working-directory: ChatApp -# -# - name: Run instrumentation tests -# run: | -# ./gradlew :app:pixel7Api35Check \ -# -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true \ -# -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" -# working-directory: ChatApp -# -# - name: Setup WearOS GMD -# run: | -# ./gradlew :wear:wearOS34Setup \ -# --info \ -# -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true \ -# -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" -# working-directory: ChatApp -# -# - name: Run WearOS instrumentation tests -# run: | -# ./gradlew :wear:wearOS34Check \ -# -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true \ -# -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" -# working-directory: ChatApp From a66eb0d5b885c149662613123fe4ecd41f8af262 Mon Sep 17 00:00:00 2001 From: Tony Mak Date: Mon, 23 Nov 2026 11:02:03 +0000 Subject: [PATCH 2/7] ci: upload ChatApp instrumentation test report on failure --- .github/workflows/chatapp.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/chatapp.yaml b/.github/workflows/chatapp.yaml index 2fc91fdb..559b70f4 100644 --- a/.github/workflows/chatapp.yaml +++ b/.github/workflows/chatapp.yaml @@ -75,6 +75,13 @@ jobs: -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" working-directory: ChatApp + - name: Upload instrumentation test report + if: failure() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 + with: + name: chatapp-androidtest-report + path: ChatApp/app/build/reports/androidTests/ + - name: Build Debug and Release APKs run: ./gradlew assembleDebug assembleRelease working-directory: ChatApp From cb2aedb52e98ec1a17d60fc18ed1933047a071b2 Mon Sep 17 00:00:00 2001 From: Tony Mak Date: Mon, 23 Nov 2026 11:09:44 +0000 Subject: [PATCH 3/7] fix: use pixel7Api37 (google_apis) GMD for ChatApp AppFunctionManager tests --- .github/workflows/chatapp.yaml | 4 ++-- ChatApp/app/build.gradle.kts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/chatapp.yaml b/.github/workflows/chatapp.yaml index 559b70f4..10d468bf 100644 --- a/.github/workflows/chatapp.yaml +++ b/.github/workflows/chatapp.yaml @@ -62,7 +62,7 @@ jobs: - name: Setup GMD run: | - ./gradlew :app:pixel7Api35Setup \ + ./gradlew :app:pixel7Api37Setup \ --info \ -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true \ -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" @@ -70,7 +70,7 @@ jobs: - name: Run instrumentation tests run: | - ./gradlew :app:pixel7Api35Check \ + ./gradlew :app:pixel7Api37Check \ -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true \ -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" working-directory: ChatApp diff --git a/ChatApp/app/build.gradle.kts b/ChatApp/app/build.gradle.kts index 77513208..720f99ad 100644 --- a/ChatApp/app/build.gradle.kts +++ b/ChatApp/app/build.gradle.kts @@ -53,10 +53,10 @@ android { testOptions { managedDevices { localDevices { - create("pixel7Api35") { + create("pixel7Api37") { device = "Pixel 7" - apiLevel = 35 - systemImageSource = "aosp-atd" + apiLevel = 37 + systemImageSource = "google_apis" } } } From de6b090dae966e9e878247e02c20f08f4875509a Mon Sep 17 00:00:00 2001 From: Tony Mak Date: Mon, 23 Nov 2026 11:10:44 +0000 Subject: [PATCH 4/7] chore: remove .gemini config --- .gemini/config.yaml | 8 -------- .gemini/styleguide.md | 18 ------------------ 2 files changed, 26 deletions(-) delete mode 100644 .gemini/config.yaml delete mode 100644 .gemini/styleguide.md diff --git a/.gemini/config.yaml b/.gemini/config.yaml deleted file mode 100644 index b1dc38ca..00000000 --- a/.gemini/config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -have_fun: false -code_review: - disable: false - comment_severity_threshold: MEDIUM -ignore_patterns: - - "**/*.pb.kt" - - "**/build/**" - - "**/.gradle/**" diff --git a/.gemini/styleguide.md b/.gemini/styleguide.md deleted file mode 100644 index 20cd82be..00000000 --- a/.gemini/styleguide.md +++ /dev/null @@ -1,18 +0,0 @@ -# Android AppFunctions Code Review Style Guide - -This repository contains Android Kotlin and Jetpack Compose projects (`ChatApp/` and `agent/`). - -## General -- Follow the [Android Kotlin Style Guide](https://developer.android.com/kotlin/style-guide); formatting is enforced by Spotless (`./gradlew spotlessCheck`). -- Keep changes focused and minimal; avoid unrelated refactoring. -- Ensure new public APIs and non-trivial logic include unit or instrumentation tests. - -## Android & Compose -- Follow Unidirectional Data Flow (UDF): state flows down, events flow up. -- Avoid blocking calls on the main thread; use structured concurrency and appropriate `CoroutineDispatcher`s. -- Prefer `StateFlow` / immutable UI state models over mutable shared state. -- Check for resource leaks, lifecycle issues, and missing permission/nullability checks. - -## GitHub Actions -- Pin third-party actions to full commit SHAs with a version comment (e.g. `@ # vX`). -- Declare minimal `permissions:` on workflow jobs. From 334f4c8a15e0ccc33f904a3016fcea2e9f4410b0 Mon Sep 17 00:00:00 2001 From: Tony Mak Date: Mon, 23 Nov 2026 11:23:15 +0000 Subject: [PATCH 5/7] ci: move PR path filtering into job so required checks skip cleanly --- .github/workflows/agent.yaml | 33 +++++++++++++++++++++++++++++---- .github/workflows/chatapp.yaml | 33 +++++++++++++++++++++++++++++---- 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/.github/workflows/agent.yaml b/.github/workflows/agent.yaml index c28a151b..d02951ab 100644 --- a/.github/workflows/agent.yaml +++ b/.github/workflows/agent.yaml @@ -9,10 +9,6 @@ on: - '.github/workflows/agent.yaml' - '.github/ci-gradle.properties' pull_request: - paths: - - 'agent/**' - - '.github/workflows/agent.yaml' - - '.github/ci-gradle.properties' workflow_dispatch: concurrency: @@ -20,8 +16,37 @@ concurrency: cancel-in-progress: true jobs: + changes: + name: "Check changes" + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + run_ci: ${{ steps.filter.outputs.run_ci }} + steps: + - name: Checkout + if: github.event_name == 'pull_request' + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + fetch-depth: 0 + + - name: Check changed paths + id: filter + run: | + if [ "${{ github.event_name }}" != "pull_request" ]; then + echo "run_ci=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + if git diff --name-only "origin/${{ github.base_ref }}...HEAD" | grep -qE '^(agent/|\.github/workflows/agent\.yaml|\.github/ci-gradle\.properties)'; then + echo "run_ci=true" >> "$GITHUB_OUTPUT" + else + echo "run_ci=false" >> "$GITHUB_OUTPUT" + fi + agent-build: name: "Agent build & test" + needs: changes + if: needs.changes.outputs.run_ci == 'true' runs-on: ubuntu-latest timeout-minutes: 45 permissions: diff --git a/.github/workflows/chatapp.yaml b/.github/workflows/chatapp.yaml index 10d468bf..9f9abb51 100644 --- a/.github/workflows/chatapp.yaml +++ b/.github/workflows/chatapp.yaml @@ -9,10 +9,6 @@ on: - '.github/workflows/chatapp.yaml' - '.github/ci-gradle.properties' pull_request: - paths: - - 'ChatApp/**' - - '.github/workflows/chatapp.yaml' - - '.github/ci-gradle.properties' workflow_dispatch: concurrency: @@ -20,8 +16,37 @@ concurrency: cancel-in-progress: true jobs: + changes: + name: "Check changes" + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + run_ci: ${{ steps.filter.outputs.run_ci }} + steps: + - name: Checkout + if: github.event_name == 'pull_request' + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + fetch-depth: 0 + + - name: Check changed paths + id: filter + run: | + if [ "${{ github.event_name }}" != "pull_request" ]; then + echo "run_ci=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + if git diff --name-only "origin/${{ github.base_ref }}...HEAD" | grep -qE '^(ChatApp/|\.github/workflows/chatapp\.yaml|\.github/ci-gradle\.properties)'; then + echo "run_ci=true" >> "$GITHUB_OUTPUT" + else + echo "run_ci=false" >> "$GITHUB_OUTPUT" + fi + chatapp-build: name: "ChatApp build & test" + needs: changes + if: needs.changes.outputs.run_ci == 'true' runs-on: ubuntu-latest timeout-minutes: 45 permissions: From 1f06e143abf877d7079f8cbb8db5b32253f4e908 Mon Sep 17 00:00:00 2001 From: Tony Mak Date: Mon, 23 Nov 2026 11:39:01 +0000 Subject: [PATCH 6/7] fix: pass github context via env in changes step for zizmor --- .github/workflows/agent.yaml | 7 +++++-- .github/workflows/chatapp.yaml | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/agent.yaml b/.github/workflows/agent.yaml index d02951ab..21322e9c 100644 --- a/.github/workflows/agent.yaml +++ b/.github/workflows/agent.yaml @@ -32,12 +32,15 @@ jobs: - name: Check changed paths id: filter + env: + EVENT_NAME: ${{ github.event_name }} + BASE_REF: ${{ github.base_ref }} run: | - if [ "${{ github.event_name }}" != "pull_request" ]; then + if [ "$EVENT_NAME" != "pull_request" ]; then echo "run_ci=true" >> "$GITHUB_OUTPUT" exit 0 fi - if git diff --name-only "origin/${{ github.base_ref }}...HEAD" | grep -qE '^(agent/|\.github/workflows/agent\.yaml|\.github/ci-gradle\.properties)'; then + if git diff --name-only "origin/$BASE_REF...HEAD" | grep -qE '^(agent/|\.github/workflows/agent\.yaml|\.github/ci-gradle\.properties)'; then echo "run_ci=true" >> "$GITHUB_OUTPUT" else echo "run_ci=false" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/chatapp.yaml b/.github/workflows/chatapp.yaml index 9f9abb51..d694848c 100644 --- a/.github/workflows/chatapp.yaml +++ b/.github/workflows/chatapp.yaml @@ -32,12 +32,15 @@ jobs: - name: Check changed paths id: filter + env: + EVENT_NAME: ${{ github.event_name }} + BASE_REF: ${{ github.base_ref }} run: | - if [ "${{ github.event_name }}" != "pull_request" ]; then + if [ "$EVENT_NAME" != "pull_request" ]; then echo "run_ci=true" >> "$GITHUB_OUTPUT" exit 0 fi - if git diff --name-only "origin/${{ github.base_ref }}...HEAD" | grep -qE '^(ChatApp/|\.github/workflows/chatapp\.yaml|\.github/ci-gradle\.properties)'; then + if git diff --name-only "origin/$BASE_REF...HEAD" | grep -qE '^(ChatApp/|\.github/workflows/chatapp\.yaml|\.github/ci-gradle\.properties)'; then echo "run_ci=true" >> "$GITHUB_OUTPUT" else echo "run_ci=false" >> "$GITHUB_OUTPUT" From 4e88ea50bcd6a1c1691618a1e9f8904b930723af Mon Sep 17 00:00:00 2001 From: Tony Mak Date: Mon, 23 Nov 2026 11:40:42 +0000 Subject: [PATCH 7/7] fix: update actions/setup-java SHA to v6.3.0 for zizmor --- .github/workflows/agent.yaml | 2 +- .github/workflows/chatapp.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/agent.yaml b/.github/workflows/agent.yaml index 21322e9c..afccfa80 100644 --- a/.github/workflows/agent.yaml +++ b/.github/workflows/agent.yaml @@ -63,7 +63,7 @@ jobs: run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties - name: Set up JDK 21 - uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6 + uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6 with: distribution: 'zulu' java-version: 21 diff --git a/.github/workflows/chatapp.yaml b/.github/workflows/chatapp.yaml index d694848c..316797dc 100644 --- a/.github/workflows/chatapp.yaml +++ b/.github/workflows/chatapp.yaml @@ -63,7 +63,7 @@ jobs: run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties - name: Set up JDK 21 - uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6 + uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6 with: distribution: 'zulu' java-version: 21