Skip to content

ci: add namespace gradle cache trial Android E2E APK#30054

Merged
alucardzom merged 6 commits into
mainfrom
infra/INFRA-3626-namespace-gradle-cache-trial
May 14, 2026
Merged

ci: add namespace gradle cache trial Android E2E APK#30054
alucardzom merged 6 commits into
mainfrom
infra/INFRA-3626-namespace-gradle-cache-trial

Conversation

@Qbandev

@Qbandev Qbandev commented May 12, 2026

Copy link
Copy Markdown
Contributor

Description

This adds a scoped trial for Namespace Gradle remote build cache on the Android E2E APK build path.

The workflow configures Namespace Gradle cache only when runner_provider=namespace and the native Android build path is active. The generated Namespace init script is passed through GRADLE_INIT_SCRIPT to scripts/build.sh, where it is added to the Android E2E APK Gradle invocation as --init-script.

Current runner behavior stays unchanged: the Namespace setup step is skipped, GRADLE_INIT_SCRIPT is empty, and the existing Gradle command shape is preserved. The non-E2E AAB release build path is intentionally unchanged.

Validation summary

This validation uses Android E2E APK builds from commit 5a8b29d6895875799466b489abe957f7bdf914ee:

Important caveat: this is a validation comparison, not a production benchmark. The primary metric for this ticket is Android E2E APK job wall time because it measures the CI job as executed, including setup, cache restore/configuration, Gradle execution, and artifact handling. The data proves the scoped Namespace Gradle cache path works for the Android E2E APK build. It does not prove Namespace is faster than the existing current-runner path.

The current-runner comparison was run through a PR-event native Gradle path so the existing current-runner behavior could be checked without enabling the Namespace setup.

Results and evidence

Question Evidence Conclusion
Did the Namespace run build the Android E2E APK successfully? Namespace APK job: https://github.com/MetaMask/metamask-mobile/actions/runs/25792837744/job/75762901387. Log summary: BUILD SUCCESSFUL in 12m 13s; 3647 actionable tasks: 2146 executed, 1501 from cache. Yes. Namespace built the APK and restored many Gradle tasks from cache.
Did the current-runner path still build the Android E2E APK successfully? Current APK job: https://github.com/MetaMask/metamask-mobile/actions/runs/25786062492/job/75802755963. Log summary: BUILD SUCCESSFUL in 4m 16s; 3647 actionable tasks: 2155 executed, 1492 from cache. Yes. The existing current-runner native Gradle path still works without the Namespace setup.
Was cache behavior comparable between the two valid jobs? Namespace restored 1501 from cache; current runner restored 1492 from cache. Yes. Both native Gradle builds restored a similar number of tasks from cache.
Does this prove Namespace is faster? Primary metric: APK job wall time was 14m 13s on Namespace and 12m 44s on current runner. Diagnostic metric: Gradle's own build timer was 12m 13s on Namespace and 4m 16s on current runner. Both jobs ran native Gradle on the same commit, but they used different cache plumbing: Namespace cache setup plus Gradle init script vs the existing current-runner Gradle cache restore path. No. Current runner was faster in this sample. The APK job wall-time difference was about 1m 29s; the Gradle command timer is useful diagnostic evidence but not the primary CI metric. This PR should remain a scoped compatibility/cache-path trial.

To claim performance gains, use a dedicated benchmark design. The current PR should stay scoped to validating that the official Namespace Gradle setup can be wired into the Android E2E APK path without changing current-runner behavior.

Changelog

CHANGELOG entry: null

Related issues

Refs: INFRA-3626

Manual testing steps

Feature: Namespace Gradle cache trial for Android E2E APK builds

  Scenario: Current runner Android E2E build path remains unchanged
    Given CI is manually dispatched from this branch with runner_provider=current
    And the Android E2E APK job requires a fresh native build

    When the Build Android E2E APKs job runs
    Then the Namespace Gradle remote cache setup step should be skipped
    And the Gradle command should not include --init-script
    And the existing current-runner Gradle cache behavior should remain unchanged

  Scenario: Namespace Android E2E build path configures Gradle remote cache
    Given CI is manually dispatched from this branch with runner_provider=namespace
    And the Android E2E APK job requires a fresh native build

    When the Build Android E2E APKs job runs
    Then the Namespace Gradle remote cache setup step should create a Gradle init script under RUNNER_TEMP
    And the Gradle APK invocation should include --init-script for that generated file
    And Gradle logs should show build-cache task reuse

  Scenario: Namespace warm-cache behavior is measurable
    Given CI is manually dispatched twice from the same branch and SHA with runner_provider=namespace

    When the second Android E2E APK job runs
    Then the Gradle task cache count should be comparable or better than the first Namespace run
    And Android smoke tests should be able to consume the generated APK artifacts

Screenshots/Recordings

Before

N/A

After

N/A

Pre-merge author checklist

Performance checks (if applicable)

CI-only change. No app runtime behavior is changed, so device runtime performance instrumentation is not applicable.

  • Android CI validation was run through manually dispatched Android E2E APK and smoke workflows.
  • No app runtime code path was modified.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Medium risk because it changes the Android E2E CI build invocation and introduces a conditional Gradle --init-script path that could affect build determinism or fail if the init script is missing/misconfigured on Namespace runners.

Overview
Adds a scoped Namespace Gradle remote build cache setup step to the Android E2E APK GitHub Actions workflow when runner_provider=namespace and a full native build is required.

Plumbs the generated init script through GRADLE_INIT_SCRIPT and updates scripts/build.sh to optionally pass --init-script to the Android ./gradlew invocation, leaving non-Namespace runners and the non-E2E AAB release path unchanged.

Reviewed by Cursor Bugbot for commit 527653f. Bugbot is set up for automated code reviews on this repo. Configure here.

@Qbandev Qbandev self-assigned this May 12, 2026
@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbotv2 metamaskbotv2 Bot added the team-dev-ops DevOps team label May 12, 2026
@Qbandev Qbandev changed the title ci: add namespace gradle cache trial ci: add namespace gradle cache trial Android E2E APK May 13, 2026
@Qbandev Qbandev added no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed and removed pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. labels May 13, 2026
@Qbandev Qbandev marked this pull request as ready for review May 13, 2026 07:22
@Qbandev Qbandev requested a review from a team as a code owner May 13, 2026 07:22
@Qbandev Qbandev force-pushed the infra/INFRA-3626-namespace-gradle-cache-trial branch from c9f8e16 to 6b642de Compare May 13, 2026 07:53
@Qbandev Qbandev added no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed and removed no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed labels May 13, 2026
@Qbandev Qbandev requested a review from Copilot May 13, 2026 13:11

Copilot AI left a comment

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.

Pull request overview

Adds a scoped CI trial of Namespace’s Gradle remote build cache for the Android E2E APK build path, without changing the default “current” runner behavior or the non‑E2E AAB release path.

Changes:

  • Adds optional support in scripts/build.sh to pass a Gradle --init-script when GRADLE_INIT_SCRIPT is provided.
  • Updates the Android E2E workflow to generate a Namespace Gradle init script only on runner_provider=namespace + native-build path and pass it into the build step.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
scripts/build.sh Adds an optional init-script arg array and injects it into the ./gradlew invocation for Android APK generation.
.github/workflows/build-android-e2e.yml Adds a gated step to configure Namespace Gradle remote cache and wires its generated init script path into the APK build environment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Qbandev Qbandev added force-builds Forces e2e native builds to trigger skip-smart-e2e-selection Skip Smart E2E selection, i.e. select all E2E tests to run and removed skip-smart-e2e-selection Skip Smart E2E selection, i.e. select all E2E tests to run force-builds Forces e2e native builds to trigger labels May 13, 2026
@alucardzom alucardzom added the skip-smart-e2e-selection Skip Smart E2E selection, i.e. select all E2E tests to run label May 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - skip-smart-e2e-selection label found

All E2E tests pre-selected.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@github-project-automation github-project-automation Bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue May 14, 2026
@alucardzom alucardzom added this pull request to the merge queue May 14, 2026
Merged via the queue into main with commit e6caa4c May 14, 2026
205 of 209 checks passed
@alucardzom alucardzom deleted the infra/INFRA-3626-namespace-gradle-cache-trial branch May 14, 2026 14:09
@github-actions github-actions Bot locked and limited conversation to collaborators May 14, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.78.0 Issue or pull request that will be included in release 7.78.0 label May 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.78.0 Issue or pull request that will be included in release 7.78.0 size-S skip-smart-e2e-selection Skip Smart E2E selection, i.e. select all E2E tests to run team-dev-ops DevOps team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants