Skip to content
Merged
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
15 changes: 15 additions & 0 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,18 @@ jobs:
with:
name: clawdroid-embedded-release-apks
path: android/app/build/outputs/apk/embedded/release/*.apk

gate:
if: always()
needs: [termux, embedded]
runs-on: ubuntu-latest
steps:
- name: Check results
run: |
for result in \
"${{ needs.termux.result }}" \
"${{ needs.embedded.result }}"; do
if [ "$result" = "failure" ] || [ "$result" = "cancelled" ]; then
exit 1
fi
done
131 changes: 131 additions & 0 deletions .github/workflows/android-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Android PR Checks

on:
pull_request:
paths:
- "android/**"
- ".github/workflows/android-pr.yml"

jobs:
ktlint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: android
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Run ktlint
run: ./gradlew ktlintCheck

lint-termux:
runs-on: ubuntu-latest
defaults:
run:
working-directory: android
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Run Android Lint (Termux)
run: ./gradlew :app:lintTermuxDebug

lint-embedded:
runs-on: ubuntu-latest
defaults:
run:
working-directory: android
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Run Android Lint (Embedded)
run: ./gradlew :app:lintEmbeddedDebug

test-termux:
runs-on: ubuntu-latest
defaults:
run:
working-directory: android
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Run unit tests (Termux)
run: ./gradlew testTermuxDebugUnitTest

test-embedded:
runs-on: ubuntu-latest
defaults:
run:
working-directory: android
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Run unit tests (Embedded)
run: ./gradlew testEmbeddedDebugUnitTest

gate:
if: always()
needs: [ktlint, lint-termux, lint-embedded, test-termux, test-embedded]
runs-on: ubuntu-latest
steps:
- name: Check results
run: |
for result in \
"${{ needs.ktlint.result }}" \
"${{ needs.lint-termux.result }}" \
"${{ needs.lint-embedded.result }}" \
"${{ needs.test-termux.result }}" \
"${{ needs.test-embedded.result }}"; do
if [ "$result" = "failure" ] || [ "$result" = "cancelled" ]; then
exit 1
fi
done
22 changes: 14 additions & 8 deletions .github/workflows/build.yml → .github/workflows/go-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build
name: go-build

on:
push:
Expand All @@ -9,15 +9,15 @@ on:
- "go.mod"
- "go.sum"
- "Makefile"
- ".github/workflows/build.yml"
- ".github/workflows/go-build.yml"
pull_request:
paths:
- "cmd/**"
- "pkg/**"
- "go.mod"
- "go.sum"
- "Makefile"
- ".github/workflows/build.yml"
- ".github/workflows/go-build.yml"

jobs:
build:
Expand All @@ -31,10 +31,16 @@ jobs:
with:
go-version-file: go.mod

- name: fmt
run: |
make fmt
git diff --exit-code || (echo "::error::Code is not formatted. Run 'make fmt' and commit the changes." && exit 1)

- name: Build
run: make build-all

gate:
if: always()
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Check results
run: |
if [ "${{ needs.build.result }}" = "failure" ] || [ "${{ needs.build.result }}" = "cancelled" ]; then
exit 1
fi
36 changes: 36 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ jobs:
make fmt
git diff --exit-code || (echo "::error::Code is not formatted. Run 'make fmt' and commit the changes." && exit 1)

lint:
runs-on: ubuntu-latest
needs: fmt-check
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Run go generate
run: go generate ./...

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.10

vet:
runs-on: ubuntu-latest
needs: fmt-check
Expand Down Expand Up @@ -56,3 +76,19 @@ jobs:
- name: Run go test
run: go test ./...

gate:
if: always()
needs: [lint, vet, test]
runs-on: ubuntu-latest
steps:
- name: Check results
run: |
for result in \
"${{ needs.lint.result }}" \
"${{ needs.vet.result }}" \
"${{ needs.test.result }}"; do
if [ "$result" = "failure" ] || [ "$result" = "cancelled" ]; then
exit 1
fi
done

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ build/
*.dylib
*.test
*.out
clawdroid
clawdroid-test
/clawdroid
/clawdroid-test
cmd/clawdroid/workspace

# ClawDroid specific
Expand Down
7 changes: 7 additions & 0 deletions android/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
root = true

[*.{kt,kts}]
indent_size = 4
indent_style = space
max_line_length = 120
insert_final_newline = true
33 changes: 26 additions & 7 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.serialization)
alias(libs.plugins.kover)
}

val keystorePropertiesFile = rootProject.file("keystore.properties")
val keystoreProperties = Properties().apply {
if (keystorePropertiesFile.exists()) {
keystorePropertiesFile.inputStream().use { load(it) }
val keystoreProperties =
Properties().apply {
if (keystorePropertiesFile.exists()) {
keystorePropertiesFile.inputStream().use { load(it) }
}
}
}

val versionFile = rootProject.file("../VERSION")
val appVersionName = if (versionFile.exists()) versionFile.readText().trim() else "0.1.0"
Expand All @@ -30,8 +32,9 @@ android {

signingConfigs {
create("release") {
storeFile = keystoreProperties.getProperty("storeFile", "")
.takeIf { it.isNotEmpty() }?.let { rootProject.file(it) }
storeFile =
keystoreProperties.getProperty("storeFile", "")
.takeIf { it.isNotEmpty() }?.let { rootProject.file(it) }
storePassword = keystoreProperties.getProperty("storePassword", "")
keyAlias = keystoreProperties.getProperty("keyAlias", "")
keyPassword = keystoreProperties.getProperty("keyPassword", "")
Expand All @@ -47,7 +50,7 @@ android {
signingConfig = signingConfigs.getByName("release")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
"proguard-rules.pro",
)
}
}
Expand Down Expand Up @@ -81,10 +84,20 @@ android {
getByName("embedded") { java.srcDirs("src/embedded/java") }
}

lint {
abortOnError = true
checkDependencies = true
lintConfig = file("lint.xml")
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

testOptions {
unitTests.isReturnDefaultValues = true
}
}

dependencies {
Expand Down Expand Up @@ -124,5 +137,11 @@ dependencies {

implementation(libs.icons.lucide)

testImplementation(libs.junit5.api)
testRuntimeOnly(libs.junit5.engine)
testImplementation(libs.mockk)
testImplementation(libs.coroutines.test)
testImplementation(libs.turbine)

debugImplementation(libs.compose.ui.tooling)
}
6 changes: 6 additions & 0 deletions android/app/lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="IconDuplicates" severity="ignore" />
<issue id="GradleDependency" severity="ignore" />
<issue id="NewerVersionAvailable" severity="ignore" />
</lint>
12 changes: 9 additions & 3 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.microphone" android:required="false" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />

<queries>
<intent>
Expand Down Expand Up @@ -48,7 +53,8 @@

<receiver
android:name=".receiver.AgentMessageReceiver"
android:exported="true">
android:exported="true"
tools:ignore="ExportedReceiver">
<intent-filter>
<action android:name="io.clawdroid.AGENT_MESSAGE" />
</intent-filter>
Expand Down
Loading