Skip to content

ci: prebuild modules in parallel with native build and parallelize apk variants - #193

Merged
YumeYuka merged 1 commit into
Moefrom
workflow-parallel-build
Sep 27, 2026
Merged

YumeYuka merged 1 commit into
Moefrom
workflow-parallel-build

Conversation

@YumeLira

@YumeLira YumeLira commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by Sourcery

Parallelize module prebuilds and APK variant assembly across the CI pipelines.

New Features:

  • Prebuild Java/Kotlin sources and module resources in parallel with native builds for PR, pre-release, and stable workflows.
  • Build builtin and external APK variants as independent parallel jobs before aggregating their artifacts.

Enhancements:

  • Reuse Gradle build-cache artifacts across APK variant builds and support both debug and release build types.
  • Centralize APK metadata preparation and make signing conditional on release builds.

CI:

  • Update CI workflows to coordinate module prebuilds, parallel APK variants, and intermediate artifact cleanup.

@sourcery-ai

sourcery-ai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR restructures CI to precompile Java/Kotlin and module resources in parallel with native builds, then reuses the resulting Gradle build cache while assembling builtin and external APK variants concurrently. APK metadata preparation, build-type handling, artifact aggregation, and cleanup are updated across PR, pre-release, and stable workflows.

File-Level Changes

Change Details Files
Adds reusable module prebuild jobs that run alongside native builds and publish a Gradle local build-cache artifact.
  • Adds channel/build-type workflow inputs and prebuild invocations for PR, pre-release, and stable pipelines.
  • Compiles sources and bundles module AARs using the selected debug or release build type.
  • Caches the required Android NDK and uploads intermediate Gradle build-cache data for APK jobs.
.github/workflows/reusable-prebuild-modules.yml
.github/workflows/ci-channel.yml
.github/workflows/pull-request.yml
.github/workflows/release.yml
Refactors APK assembly into parallel builtin and external variant jobs with a final aggregation step.
  • Introduces build-type-aware APK preparation and separates metadata calculation from assembly.
  • Builds builtin and external variants concurrently, optionally restores the prebuild Gradle cache, and uploads one artifact per variant.
  • Downloads both variant artifacts, verifies expected filenames, and publishes the combined raw APK artifact.
.github/workflows/reusable-build-apk-only.yml
Wires build-type selection and prebuild completion into all APK workflows while expanding intermediate-artifact cleanup.
  • Makes APK jobs wait for both native bundling and module prebuild completion.
  • Uses debug builds for PRs and release builds for pre/stable channels.
  • Deletes prebuild Gradle-cache artifacts during successful pipeline cleanup.
.github/workflows/ci-channel.yml
.github/workflows/pull-request.yml
.github/workflows/release.yml
.github/workflows/reusable-cleanup-artifacts.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/reusable-prebuild-modules.yml" line_range="76-79" />
<code_context>
+
+          # Prebuild all module resources, Kotlin, Java, and AAR packages before native build finishes.
+          # The Gradle local build-cache will capture all compiled classes, generated resources, and DEX components.
+          ./gradlew --no-daemon --build-cache \
+            -Pupdate.channel="${{ inputs.channel }}" \
+            compile${cap_type}Sources \
+            :pack:bundle${cap_type}Aar
+
+      - name: Upload Gradle build cache
</code_context>
<issue_to_address>
**issue (bug_risk):** The prebuild job invokes `compileReleaseSources` or `compileDebugSources`, but no such Gradle task is defined by the project or Android plugin; the job fails before uploading the build cache, so every workflow that now requires this job fails before APK assembly can start.

**Triggers:** On every channel, pull-request, or release workflow run.

**Suggested fix:** Invoke the actual module-specific compile tasks, or use a valid aggregate task such as the relevant module's `assemble${cap_type}`/`compile${cap_type}Kotlin` and Java/resource tasks.
</issue_to_address>

### Comment 2
<location path=".github/workflows/reusable-prebuild-modules.yml" line_range="74-79" />
<code_context>
+          build_type="${{ inputs.build_type }}"
+          cap_type="$(tr '[:lower:]' '[:upper:]' <<< "${build_type:0:1}")${build_type:1}"
+
+          # Prebuild all module resources, Kotlin, Java, and AAR packages before native build finishes.
+          # The Gradle local build-cache will capture all compiled classes, generated resources, and DEX components.
+          ./gradlew --no-daemon --build-cache \
+            -Pupdate.channel="${{ inputs.channel }}" \
+            compile${cap_type}Sources \
+            :pack:bundle${cap_type}Aar
+
+      - name: Upload Gradle build cache
</code_context>
<issue_to_address>
**issue (broader_impact):** The step claims to prebuild all module resources, Kotlin, Java, and DEX components, but its command only requests the nonexistent aggregate source task plus `:pack:bundleReleaseAar`; it does not provide a valid task graph for the app and dependent modules, so the intended Gradle cache entries are never produced even if the task name is corrected incompletely.

**Triggers:** When the prebuild job is changed to use a command that happens to succeed without explicitly selecting all dependent modules.

**Suggested fix:** Define and invoke a verified aggregate task or the exact module task graph whose outputs the APK build consumes, including the requested build type.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 2 findings to address first, and a workflow or cache mistake could produce incorrect signed APKs or omit a variant, and those artifacts may already be published before the change is reverted. The affected releases can be replaced or rebuilt, so the impact is bounded and repairable rather than permanent.

Blocking findings: .github/workflows/reusable-prebuild-modules.yml:79, .github/workflows/reusable-prebuild-modules.yml:79


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment on lines +76 to +79
./gradlew --no-daemon --build-cache \
-Pupdate.channel="${{ inputs.channel }}" \
compile${cap_type}Sources \
:pack:bundle${cap_type}Aar

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): The prebuild job invokes compileReleaseSources or compileDebugSources, but no such Gradle task is defined by the project or Android plugin; the job fails before uploading the build cache, so every workflow that now requires this job fails before APK assembly can start.

Triggers: On every channel, pull-request, or release workflow run.

Suggested fix: Invoke the actual module-specific compile tasks, or use a valid aggregate task such as the relevant module's assemble${cap_type}/compile${cap_type}Kotlin and Java/resource tasks.

Comment on lines +74 to +79
# Prebuild all module resources, Kotlin, Java, and AAR packages before native build finishes.
# The Gradle local build-cache will capture all compiled classes, generated resources, and DEX components.
./gradlew --no-daemon --build-cache \
-Pupdate.channel="${{ inputs.channel }}" \
compile${cap_type}Sources \
:pack:bundle${cap_type}Aar

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (broader_impact): The step claims to prebuild all module resources, Kotlin, Java, and DEX components, but its command only requests the nonexistent aggregate source task plus :pack:bundleReleaseAar; it does not provide a valid task graph for the app and dependent modules, so the intended Gradle cache entries are never produced even if the task name is corrected incompletely.

Triggers: When the prebuild job is changed to use a command that happens to succeed without explicitly selecting all dependent modules.

Suggested fix: Define and invoke a verified aggregate task or the exact module task graph whose outputs the APK build consumes, including the requested build type.

@YumeYuka
YumeYuka enabled auto-merge September 27, 2026 12:52
@YumeYuka
YumeYuka added this pull request to the merge queue Sep 27, 2026
Merged via the queue into Moe with commit 682c9c1 Sep 27, 2026
9 checks passed
@YumeYuka
YumeYuka deleted the workflow-parallel-build branch September 27, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants