Skip to content
Open
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
32 changes: 26 additions & 6 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ jobs:
distribution: 'temurin'
cache: gradle

- name: Cache Gradle build cache
uses: actions/cache@v4
with:
path: ~/.gradle/build-cache
key: gradle-build-cache-${{ runner.os }}-${{ hashFiles('**/*.gradle.kts', '**/gradle.properties', 'app/src/**', 'humanoperator/src/**') }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 Cache Invalidation Issue: The cache key includes source file patterns (app/src/**, humanoperator/src/**) which will invalidate the build cache on every source code change, defeating its purpose. The Gradle build cache is content-based and doesn't need source files in the cache key. Remove source patterns to maximize cache hits across builds.

Suggested change
key: gradle-build-cache-${{ runner.os }}-${{ hashFiles('**/*.gradle.kts', '**/gradle.properties', 'app/src/**', 'humanoperator/src/**') }}
key: gradle-build-cache-${{ runner.os }}-${{ hashFiles('**/*.gradle.kts', '**/gradle.properties') }}

restore-keys: |
gradle-build-cache-${{ runner.os }}-

- name: Decode google-services.json (app)
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON_APP }}
Expand All @@ -152,8 +160,8 @@ jobs:
- name: Fix gradle.properties for CI
run: |
sed -i '/org.gradle.java.home=/d' gradle.properties
sed -i 's/org.gradle.jvmargs=.*/org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m/' gradle.properties
sed -i 's/kotlin.daemon.jvmargs=.*/kotlin.daemon.jvmargs=-Xmx1536m -XX:MaxMetaspaceSize=512m/' gradle.properties
sed -i '/kotlin.daemon.jvmargs=/d' gradle.properties
sed -i 's/org.gradle.jvmargs=.*/org.gradle.jvmargs=-Xmx3072m -XX:MaxMetaspaceSize=512m/' gradle.properties

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand All @@ -178,10 +186,22 @@ jobs:
with:
name: humanoperator-debug
path: humanoperator/build/outputs/apk/debug/humanoperator-debug.apk

- name: Build app release AAB (unsigned)
if: env.BUILD_APP == 'true'
run: ./gradlew :app:bundleRelease

- name: Upload app release AAB (unsigned)
if: env.BUILD_APP == 'true'
uses: actions/upload-artifact@v4
with:
name: app-release-aab-unsigned
path: app/build/outputs/bundle/release/app-release.aab

- name: Build summary
run: |
echo "### Build Summary" >> $GITHUB_STEP_SUMMARY
echo "| Module | Built |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| app | ${{ env.BUILD_APP }} |" >> $GITHUB_STEP_SUMMARY
echo "| humanoperator | ${{ env.BUILD_HUMANOPERATOR }} |" >> $GITHUB_STEP_SUMMARY
echo "| Module | Built | Artefakte |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-------|-----------|" >> $GITHUB_STEP_SUMMARY
echo "| app | ${{ env.BUILD_APP }} | APK (debug) + AAB (release, unsigned) |" >> $GITHUB_STEP_SUMMARY
echo "| humanoperator | ${{ env.BUILD_HUMANOPERATOR }} | APK (debug) |" >> $GITHUB_STEP_SUMMARY
8 changes: 4 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ val missingReleaseSigningEnv = releaseSigningEnv
.filterValues { it.isNullOrBlank() }
.keys

val isReleaseTaskRequested = gradle.startParameter.taskNames.any { task ->
task.contains("release", ignoreCase = true)
val isAssembleReleaseRequested = gradle.startParameter.taskNames.any { task ->
task.contains("assemble", ignoreCase = true) && task.contains("release", ignoreCase = true)
}

val missingReleaseSigningEnvText = missingReleaseSigningEnv.joinToString(separator = ", ")
Expand Down Expand Up @@ -183,14 +183,14 @@ androidComponents {
}

tasks.configureEach {
if (name == "assemble$variantNameCap") {
if (name == "assemble$variantNameCap" || name == "bundle$variantNameCap") {
dependsOn(verifyTask)
}
}
}
}

if (isReleaseTaskRequested && missingReleaseSigningEnv.isNotEmpty()) {
if (isAssembleReleaseRequested && missingReleaseSigningEnv.isNotEmpty()) {
error(
"Release signing env vars missing for module :app: ${missingReleaseSigningEnvText}. " +
"Set ANDROID_KEYSTORE_PATH, ANDROID_KEY_ALIAS, ANDROID_KEYSTORE_PASSWORD and ANDROID_KEY_PASSWORD."
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ org.gradle.java.home=/root/.local/share/mise/installs/java/17.0.2
org.gradle.parallel=false

# Enable Gradle build cache
org.gradle.caching=false
org.gradle.caching=true

# Enable configuration on demand
org.gradle.configureondemand=true
Expand Down