Skip to content

[ci] Run android on MAUI-Dnceng#33997

Merged
rmarinho merged 3 commits intomainfrom
fix-android-run-linux
Feb 23, 2026
Merged

[ci] Run android on MAUI-Dnceng#33997
rmarinho merged 3 commits intomainfrom
fix-android-run-linux

Conversation

@rmarinho
Copy link
Copy Markdown
Member

Description of Change

This pull request updates the CI pipeline configuration to introduce and use a new Linux-based pool for running Android tests, replacing the previous macOS-based pools. The main changes are the addition of the AndroidPoolLinux parameter and updating the relevant test stage to use this new pool.

Pipeline configuration updates:

  • Added a new AndroidPoolLinux parameter to parameters: in eng/pipelines/ci.yml for specifying a Linux pool (MAUI-DNCENG) with the 1ESPT-Ubuntu22.04 image for Android test runs.
  • Updated the mac_runandroid_tests stage to use the new AndroidPoolLinux pool instead of the previous macOS-based pools, ensuring Android tests run on Linux infrastructure.

Copilot AI review requested due to automatic review settings February 11, 2026 18:56
@rmarinho rmarinho added the area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions label Feb 11, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the CI pipeline to run Android tests on a Linux-based pool (MAUI-DNCENG with 1ESPT-Ubuntu22.04) instead of macOS pools.

Changes:

  • Added a new AndroidPoolLinux pipeline parameter describing the Linux pool + demands.
  • Updated the mac_runandroid_tests stage to use AndroidPoolLinux for both PR and non-PR runs.

@@ -277,12 +284,9 @@ stages:
# TODO: macOSTemplates and AOT template categories
- name: mac_runandroid_tests
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

The stage name mac_runandroid_tests is now misleading since it runs on a Linux pool. Consider renaming it to something platform-neutral (e.g., runandroid_tests) or explicitly Linux-based (e.g., linux_runandroid_tests) to avoid confusion when diagnosing CI failures.

Suggested change
- name: mac_runandroid_tests
- name: linux_runandroid_tests

Copilot uses AI. Check for mistakes.
@rmarinho
Copy link
Copy Markdown
Member Author

@rmarinho
Copy link
Copy Markdown
Member Author

@copilot can you figure how we can install maui-android instead of maui when running mac_runandroid_tests since this a linux ? i think uitests do this , can you saw how it is done on those pipelines?

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 13, 2026

@rmarinho I've opened a new pull request, #34046, to work on those changes. Once the pull request is ready, I'll request review from you.

@rmarinho
Copy link
Copy Markdown
Member Author

rmarinho commented Feb 18, 2026

🤖 AI Summary

📊 Expand Full Review
🔍 Pre-Flight — Context & Validation
📝 Review Session[ci] Run android on MAUI-Dnceng · 0439209

Issue: No linked issue - CI infrastructure change
PR: #33997 - [ci] Run android on MAUI-Dnceng
Author: rmarinho (Rui Marinho)
Platforms Affected: CI Infrastructure only (Android integration tests pipeline)
Files Changed: 1 file - eng/pipelines/ci.yml (+9, -5)

Summary

This PR updates the CI pipeline configuration to run Android integration tests on a Linux-based pool (MAUI-DNCENG with 1ESPT-Ubuntu22.04) instead of the previous macOS-based pools. The change targets the mac_runandroid_tests stage.

Key Changes

  1. Added new AndroidPoolLinux parameter referencing MAUI-DNCENG with 1ESPT-Ubuntu22.04 image
  2. Updated mac_runandroid_tests stage to use AndroidPoolLinux for both PR and non-PR runs
  3. The if/else conditional became redundant (both branches now use the same pool)

Known Issues

Code Review Comments

File:Line Reviewer Says Author Says Status
ci.yml:285 Stage name mac_runandroid_tests is misleading for Linux; suggest linux_runandroid_tests N/ VALID CONCERN A
ci.yml:289 if/else conditional is redundant (both branches same pool) "We have the same pool shared between internal and public so this should NEEDS SIMPLIFICATION work"

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #33997 Move RunOnAndroid to Linux pool, add AndroidPoolLinux PENDING (Gate) eng/pipelines/ci.yml (+9, -5) Known failing state; follow-up PR #34046 fixes workload issue parameter

Context from Discussion


🚦 Gate — Test Verification
📝 Review Session[ci] Run android on MAUI-Dnceng · 0439209

** SKIPPED (CI-Only PR)Result:**
Platform: N/A
Mode: N/A

Reason for Skip

This PR is a CI pipeline infrastructure change only (eng/pipelines/ci.yml). There are no unit tests or UI tests that can validate CI YAML configurations.

The RunOnAndroid integration tests exist (AndroidTemplateTests.RunOnAndroid) but:

  • They require a full CI pipeline environment with Android emulator
  • They cannot be run locally with BuildAndRunHostApp.ps1 or verify-tests-fail-without-fix
  • They don't test the correctness of the CI YAML itself

Known CI Status

The PR author explicitly acknowledged the build is failing:

Assessment

Gate is not applicable for CI-only pipeline changes. The correctness of this PR must be assessed through code review of the YAML changes and the known CI failure evidence.


🔧 Fix — Analysis & Comparison
📝 Review Session[ci] Run android on MAUI-Dnceng · 0439209

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #33997 Move RunOnAndroid to Linux pool ( FAILING (Known) eng/pipelines/ci.yml (+9, -5) CI-only change; known failing due to workload install issue AndroidPoolLinux)

Notes on Try-Fix Phase

try-fix was SKIPPED for this PR because:

  1. No testable fix exists - This is a CI pipeline YAML change, not a code fix. The try-fix skill requires a test command (e.g., BuildAndRunHostApp.ps1) that validates the fix, which doesn't apply to CI YAML changes.

  2. Gate was not applicable - Without Gate passing, try-fix cannot run (Gate is a prerequisite).

  3. CI-only changes require CI environment to validate - The RunOnAndroid integration tests require a full CI pipeline with Android emulator; they cannot be run locally.

Exhausted: N/A (skipped - CI-only PR)
Selected Fix: PR's fix (with companion PR #34046 required to complete the work)


📋 Report — Final Recommendation
📝 Review Session[ci] Run android on MAUI-Dnceng · 0439209

Final Recommendation: REQUEST CHANGES##

Summary

PR #33997 moves the mac_runandroid_tests integration test stage from macOS pools to a Linux pool (MAUI-DNCENG with 1ESPT-Ubuntu22.04). The motivation is Android tests don't need macOS but the PR is currently failing in CI due to two issues that must be addressed before merging.infrastructure valid

Root Cause of CI Failures

The PR's change requires two additional fixes to work correctly on Linux:

  1. Workload installation failure: setup-test-env.yml installs the full maui workload (via DotNet.csproj -t:Install), which on Linux attempts to install iOS/macOS/tvos workloads. These are unavailable on Linux and cause installation failures. The fix is to use maui-android workload on Linux instead.

  2. KVM not enabled: Android emulators require KVM (Kernel Virtual Machine) on Linux. The setup-test-env.yml doesn't enable KVM on Linux, causing emulator failures. The fix is to add a udev rules step conditioned on Linux.

Fix Quality Assessment

The PR's core approach (using Linux for Android tests) is architecturally sound and aligned with the existing pattern used in UI tests (eng/pipelines/common/ui-tests.yml already uses androidLinuxPool for Android UI tests). However, the PR is incomplete without the companion fixes in PR #34046.

PR #34046 provides the necessary companion fixes:

  • src/DotNet/DotNet.csproj: Install maui-android on Linux, maui elsewhere
  • eng/pipelines/arcade/setup-test-env.yml: Enable KVM on Linux agents

Code Quality Issues Found

  1. Redundant conditional (confirmed by author): The if/else block in ci.yml lines 287-290 has the same pool for both branches. This should be simplified:

    # Current (redundant)
    ${{ if eq(variables['Build.DefinitionName'], 'maui-pr') }}:
      pool: ${{ parameters.AndroidPoolLinux }}
    ${{ else }}:  
      pool: ${{ parameters.AndroidPoolLinux }}
    
    # Simplified
    pool: ${{ parameters.AndroidPoolLinux }}
  2. Misleading stage name: mac_runandroid_tests still says "mac" but now runs on Linux. While this could be renamed (to linux_runandroid_tests), the author didn't engage with this suggestion, and renaming could cause issues with existing pipeline references. This is a minor concern.

Recommendations

  1. Merge PR [ci] Enable Linux Android integration tests with workload and KVM support #34046 first (or incorporate its changes into this the workload install and KVM fixes are required for this change to functionPR)
  2. Simplify the redundant if/else both branches set the same poolconditional
  3. Consider addressing the stage name to avoid operational confusion

Status Summary

Phase Status
Pre-Flight COMPLETE
SKIPPED (CI-only PR, no unit/UI tests applicable) Gate
Fix (try- SKIPPED (CI-only PR) fix)
Report COMPLETE

📋 Expand PR Finalization Review
Title: ✅ Good

Current: [ci] Run android on MAUI-Dnceng

Description: ⚠️ Needs Update

Description needs updates. See details below.

✨ Suggested PR Description

[!NOTE]
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

Moves the mac_runandroid_tests stage (RunOnAndroid integration tests) from macOS-based pools to a Linux-based pool (MAUI-DNCENG with 1ESPT-Ubuntu22.04).

Motivation: Android tests do not require macOS infrastructure. Using Linux agents is faster, more cost-effective, and consistent with the existing pattern already used for Android UI tests in eng/pipelines/common/ui-tests.yml (which uses androidLinuxPool).

Pipeline configuration updates:

  • Added a new AndroidPoolLinux parameter specifying the MAUI-DNCENG pool with 1ESPT-Ubuntu22.04 image.
  • Updated the mac_runandroid_tests stage to use AndroidPoolLinux for both PR (maui-pr) and non-PR CI runs, replacing:
    • PR runs: was AcesShared / ACES_arm64_Sequoia_Xcode
    • Non-PR runs: was MacOSPool.internal

⚠️ Note: This PR requires companion PR #34046 to work correctly on Linux. That PR fixes:

  • Workload installation: uses maui-android instead of maui on Linux (avoids iOS/macOS/tvOS dependency failures)
  • KVM enablement: adds udev rules for Android emulator hardware acceleration on Linux agents

Issues Fixed

N/A (CI infrastructure improvement)

Code Review: ⚠️ Issues Found

Code Review — PR #33997

File: eng/pipelines/ci.yml (+9/-5)


🔴 Critical Issues

PR Is Currently Failing in CI

Problem: The PR author confirmed that the CI build fails with this change because the setup-test-env.yml installs the full maui workload (DotNet.csproj -t:Install), which on Linux attempts to install iOS/macOS/tvOS workloads. These are unavailable on Linux and cause installation failures.

Evidence: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1290026

Required companion fixes (PR #34046):

  1. src/DotNet/DotNet.csproj — Install maui-android workload on Linux, maui elsewhere
  2. eng/pipelines/arcade/setup-test-env.yml — Enable KVM (Kernel Virtual Machine) for Android emulator hardware acceleration on Linux agents

Recommendation: Merge PR #34046 first (or incorporate its changes into this PR) before this PR can be merged.


🟡 Suggestions

1. Redundant if/else Conditional

File: eng/pipelines/ci.yml, lines 287–292

Problem: The if/else block that was previously needed to distinguish between maui-pr pipeline (macOS arm64 pool) and non-PR CI (MacOSPool.internal) now sets the same pool (${{ parameters.AndroidPoolLinux }}) in both branches. This is redundant and adds unnecessary noise.

# Current (redundant — both branches identical)
${{ if eq(variables['Build.DefinitionName'], 'maui-pr') }}:
  pool: ${{ parameters.AndroidPoolLinux }}
${{ else }}:  
  pool: ${{ parameters.AndroidPoolLinux }}

Author's response: "We have the same pool shared between internal and public so this should work."
Assessment: The author's comment explains why both pools are the same (intentional), but the redundant conditional still adds unnecessary noise and should be simplified.

Recommendation:

# Simplified
pool: ${{ parameters.AndroidPoolLinux }}

Note: A reviewer from Copilot raised this and the thread was marked resolved, but the code was not changed. The simplification is still worth applying.


2. Misleading Stage Name

File: eng/pipelines/ci.yml, line 285

Problem: The stage is named mac_runandroid_tests but now runs on a Linux pool. This will cause confusion when:

  • Diagnosing CI failures (developers will look for macOS-related issues)
  • Reading pipeline logs and reports
  • Future maintenance of this file

Reviewer suggestion (unresolved thread):

# Suggested (from Copilot reviewer)
- name: linux_runandroid_tests

Alternative: runandroid_tests (platform-neutral) to avoid future churn if pool changes again.

Note: Renaming could affect any external pipeline references or dashboards that filter by stage name. The author did not respond to this suggestion, so the risk tradeoff should be evaluated by the team.


✅ Looks Good

  • AndroidPoolLinux parameter structure matches the existing pattern used by MacOSPool, AndroidPool, etc. in the same file — well-formed YAML with proper name/demands structure.
  • Architectural direction is sound — moving Android tests to Linux is consistent with the existing androidLinuxPool already used in eng/pipelines/common/ui-tests.yml for Android UI tests. This is the right long-term direction.
  • Both PR and non-PR paths updated — the change correctly handles both maui-pr and non-PR CI runs.

@rmarinho rmarinho added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-lose Author adopted the agent's fix and it turned out to be bad s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Feb 18, 2026
@rmarinho
Copy link
Copy Markdown
Member Author

@copilot when installing "Install dotnet preview workloads from PackageArtifacts" we should check if we are on linux if so we just install maui-android can you work on that ?

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 19, 2026

@rmarinho I've opened a new pull request, #34127, to work on those changes. Once the pull request is ready, I'll request review from you.

@PureWeen PureWeen removed s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-lose Author adopted the agent's fix and it turned out to be bad labels Feb 19, 2026
…port (#34046)

The `mac_runandroid_tests` stage was moved to Linux pools but failed due
to two issues: workload installation attempted to install the full
`maui` workload (which includes iOS/macOS dependencies unavailable on
Linux), and KVM was not enabled for Android emulator support.

**Changes:**
- Modified `src/DotNet/DotNet.csproj` `Install` target to conditionally
install `maui-android` on Linux, `maui` on other platforms
- Aligns with existing pattern in `_InstallWorkloadPacks` target where
iOS/macOS workloads are excluded on Linux
- Added KVM enablement step to `eng/pipelines/arcade/setup-test-env.yml`
for Android integration tests on Linux
  - Creates udev rules to allow KVM access for Android emulators
- Matches pattern used in `device-tests-steps.yml` and
`ui-tests-steps.yml`

```xml
<ItemGroup>
  <!-- On Linux, install maui-android instead of maui to avoid iOS/macOS dependencies -->
  <_LocalWorkloadIds Include="maui-android" Condition="$([MSBuild]::IsOSPlatform('linux'))" />
  <_LocalWorkloadIds Include="maui" Condition="!$([MSBuild]::IsOSPlatform('linux'))" />
</ItemGroup>
```

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rmarinho <1235097+rmarinho@users.noreply.github.com>
Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@PureWeen
Copy link
Copy Markdown
Member

PureWeen commented Feb 20, 2026

This adds a 3rd identical copy of the KVM enablement block (the same 3 lines already exist in ui-tests-steps.yml and device-tests-steps.yml). Worth extracting to a shared template like eng/pipelines/common/enable-kvm.yml to reduce maintenance surface — if the setup ever changes, it'd need updating in 3 places otherwise.

Move the duplicated KVM enablement block into
eng/pipelines/common/enable-kvm.yml and reference it from
setup-test-env.yml, ui-tests-steps.yml, and device-tests-steps.yml.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rmarinho
Copy link
Copy Markdown
Member Author

/azp run maui-pr-devicetests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rmarinho
Copy link
Copy Markdown
Member Author

/azp run maui-pr-uitests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rmarinho rmarinho merged commit 0d4220b into main Feb 23, 2026
155 of 159 checks passed
@rmarinho rmarinho deleted the fix-android-run-linux branch February 23, 2026 15:15
@PureWeen
Copy link
Copy Markdown
Member

/backport to release/11.0.1xx-preview2

@github-actions
Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx-preview2 (link to workflow run)

TamilarasanSF4853 pushed a commit to TamilarasanSF4853/maui that referenced this pull request Mar 2, 2026
### Description of Change

This pull request updates the CI pipeline configuration to introduce and
use a new Linux-based pool for running Android tests, replacing the
previous macOS-based pools. The main changes are the addition of the
`AndroidPoolLinux` parameter and updating the relevant test stage to use
this new pool.

**Pipeline configuration updates:**

* Added a new `AndroidPoolLinux` parameter to `parameters:` in
`eng/pipelines/ci.yml` for specifying a Linux pool (`MAUI-DNCENG`) with
the `1ESPT-Ubuntu22.04` image for Android test runs.
* Updated the `mac_runandroid_tests` stage to use the new
`AndroidPoolLinux` pool instead of the previous macOS-based pools,
ensuring Android tests run on Linux infrastructure.

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rmarinho <1235097+rmarinho@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Mar 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants