[Proposal] Keep the device tests on the newest OS releases automatically

Aperta
#3,438 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@TheCodeTraveler ci sta già lavorando.

Dal 21/11/2026.

  • #3452 di @TheCodeTraveler — aperta

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
android, csharp, github-actions, ios, macos
Ambito
ci-cd, devops, mobile

Direzione di ricerca

Start by reading the proposed .github/workflows/bump-os-versions.yml design alongside .github/workflows/device-tests.yml, .github/workflows/dotnet-build.yml, shared.env, and dependabot-automation.yml. The proposal also depends on #3433 and #3435, so check their resulting workflow layouts before implementation. Done means a nightly and manually runnable workflow updates safe version pins in one PR, flags changes needing a person, and only auto-approves and merges when the stated checks and safeguards pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

approved champion proposal
Feature name

Automatic bumps of the device tests' newest OS versions

Link to discussion

None: proposed by a maintainer (TheCodeTraveler) as a follow-up to #3433 and #3435.

Progress tracker
  • Android Implementation
  • iOS Implementation
  • MacCatalyst Implementation
  • Windows Implementation
  • Unit Tests
  • Samples
  • Documentation
Summary

Today a person bumps the device tests' Android API levels and Xcode version by hand. This proposal adds a nightly workflow, Ensure CI Always Tests Latest Operating Systems, that finds newer releases, edits the pinned versions and opens one bump PR. GitHub Actions turns on auto-merge and approves it, so it merges itself once CI passes, like Dependabot's PRs. Anything that needs a person, such as moving to a new xcode-NN runner label, goes to one issue with a ready patch and steps.

Motivation
  • The newest-OS legs go stale without any failure. When Google ships a new API level or a workload needs a new Xcode, the tests keep passing on the old versions, so users on the newest OS hit the bugs before CI does.
  • Xcode is the biggest pain point. Keeping Xcode current has been the most painful manual chore of this repo, so the bot makes every change it safely can instead of only reporting it.
  • Xcode can break CI overnight. CI installs the newest .NET workload set on every run (device-tests.yml L589, L614, dotnet-build.yml L84-85). When a new set needs a newer Xcode, every Apple build fails with E0191 until someone edits shared.env.
  • Today, people have to notice. #3435 added a checklist of these pins for reviewers and agents. It only helps when someone is already changing the workflows.
Detailed Design
What the bot keeps current
Pin Where (main) Bot
Android API levels, 4 KB pages device_tests_android_runtime (device-tests.yml L385-417): the newest release of every major from API 27; '37.0' is the newest Android 17 with 4 KB pages Bumps each major's leg; adds a leg for a new major
Android API level, 16 KB pages The google_apis_ps16k leg, '37.2' (L415-417). From 37.1 on, Android minor releases ship only with 16 KB pages Bumps it; adds a 16 KB leg for a major whose newest release ships only that way
Trimmed Android legs Take the highest google_apis level (L186-188, newest-android-api-level.py) Follow on their own
Coverage legs API 36 and 25 in device_tests_android (L84, since #3437) Not touched
Xcode shared.env (L18, L21); must equal the workload's Xcode major.minor (E0191) Bumps it once the current xcode-NN image has that Xcode as a GA release, fully rolled out
Apple runner label xcode-27 in device-tests.yml (L551, L673, L905) and dotnet-build.yml (L57, L101) Puts a ready patch in the issue: two required checks are named after the label
Older iOS legs device_tests_ios_runtime (L776-797) Lists what to check in the issue; the label patch adds the previous major's leg
iOS simulator runtime Nothing to pin: ios.ps1 picks the image's newest runtime (L21) Follows the image
Windows, Ubuntu labels windows-2025 (L1054), ubuntu-24.04 for the Android jobs (L73) Lists newer labels in the issue: a new OS image is a bigger change than one word

Out of scope: the .NET SDK (global.json, TOOLKIT_NET_VERSION), which the repo pins on purpose.

The bot: the Ensure CI Always Tests Latest Operating Systems workflow (ensure-ci-always-tests-latest-operating-systems.yml)
  • Triggers: nightly at 02:17 UTC, after new workload sets usually publish and before Dependabot's daily PRs move main; plus workflow_dispatch with dry-run and reopen-rejected inputs. Scheduled runs only on CommunityToolkit/Maui.
  • Jobs: unit tests → read the sources (Linux) → list the Xcode versions on each macOS label → plan → open or update the PR → update the issue. Stdlib Python under .github/scripts/, unit-tested in the default, C and Turkish locales.
  • The PR (fixed branch automation/ensure-ci-always-tests-latest-operating-systems, create-pull-request v8.1.3) holds only changes that CI can judge. When main no longer needs them, the bot closes it.
  • The issue ("Ensure CI always tests the latest operating systems: a person needs to act", opened by GitHub Actions) lists changes a person must make (each with a patch and steps), things to check, problems reading sources and jobs that failed. Its items never hold up the PR. Closing it dismisses the items it lists.
  • Removes the interim checklist that #3435 added (.github/instructions/trimming-aot.instructions.md, and its pointers in AGENTS.md and .github/copilot-instructions.md), and makes version-specific comments and docs version-neutral, so merged bumps don't leave them stale.
Approval and auto-merge
  • Right after opening or updating the PR, GitHub Actions checks it. All of these must hold:
    • the PR's author is the token's owner, and its head is the bot's branch in this repo;
    • the head is one bot commit with the bot's trailer (the one this run pushed, or kept when nothing changed), on the main commit the run planned from;
    • the diff is exactly the planned changes, passes a line-by-line allow-list, only raises Android levels, and touches only shared.env, device-tests.yml and dotnet-build.yml;
    • no review thread is open, and nobody turned auto-merge off.
  • Then it turns on squash auto-merge, pinned to that commit, and approves the PR. GitHub merges it once the required checks pass. Device Tests / Device Tests fails when any leg fails (L1191-1210), so every leg gates the merge. No branch protection change is needed.
  • GitHub Actions is not a ruleset bypass actor, so GitHub enforces every rule. The maintainer's token never merges.
  • A later push needs a person. The ruleset requires approval of the most recent push, so after any push the bot's approval no longer counts.
  • A person's action wins. A commit the bot didn't make stops it from updating that PR. Closing a bump PR rejects its changes until someone runs the workflow with reopen-rejected. Turning auto-merge off holds the PR.
  • Problems stay contained. A source that can't be read stops only its family (Android or Xcode) for that night, and the open PR keeps that family's changes. If main moves during a run, the bot publishes nothing and tries again the next night.

1. Android

  • Read sys-img/google_apis/sys-img2-4.xml, the index that the emulator action's cmdline-tools 20.0 read. It lists both google_apis and google_apis_ps16k images.
  • A level counts when its path is exactly system-images;android-<level>;<tag>;x86_64, it has no codename (previews such as android-CANARY and android-37.2-beta1 are also on the stable channel), and its platforms;android-<level> package exists.
  • For every major in the matrix: move its 4 KB leg to the newest 4 KB level of that major, and its 16 KB leg to the newest 16 KB level. Add a 16 KB leg when a major's newest release ships only with 16 KB pages, a 4 KB leg when a major that had only a 16 KB leg gets a 4 KB image, and legs for a new major.
  • It never plans two legs with the same level and never removes a leg; a clash goes to the issue.

2. Xcode

  • For the SDKs that the workflows use (TOOLKIT_NET_VERSION, and the newest SDK of LATEST_NET_VERSION), read the newest GA workload set from nuget.org, then xcode.recommendedVersion from its iOS and Mac Catalyst manifests (WorkloadDependencies.json, in a 33 KB package). No Mac and no workload install is needed for that.
  • A job on each macOS label lists the Xcode folders. Only a real folder named like Xcode_27.2.app with a non-beta license is GA: betas and RCs (Xcode_27.3_beta.app) also answer as Xcode_27.3.app through symlinks.
  • The bot changes Xcode only when the label's fully rolled-out build has it. GitHub's image rollouts take 1-6 days with mixed builds.
  • Same label: edit shared.env in the PR.
  • New major: the issue gets a patch that moves to xcode-NN and adds a leg for the previous iOS major, with the steps: a repo admin renames the required checks Build Library (xcode-27) and Build Sample App using Latest .NET SDK (xcode-27) right before the merge, and another maintainer approves.
  • Not GA on any image yet: listed in the issue.

3. Runner labels

  • Read the label column of the runner-images README table. Its -latest labels and badges lag reality, so the bot ignores them: ubuntu-latest already runs Ubuntu 26.04, and the xcode-27 row still says preview although the image is GA.
  • List in the issue a newer ubuntu-NN.04 or windows-NNNN label, and a pinned label that disappears or is marked deprecated.
Token
  • GITHUB_TOKEN can't open the PR. It can't push files under .github/workflows/ (where every pin lives), and PRs it opens start no CI.
  • Decided: a maintainer's classic personal access token (scopes public_repo and workflow) in the secret ENSURE_CI_ALWAYS_TESTS_LATEST_OPERATING_SYSTEMS_TOKEN, stored in the environment ensure-ci-always-tests-latest-operating-systems, which only main can use. A fine-grained token scoped to this repo would be narrower, but CommunityToolkit requires an org owner's approval for it.
  • It's used only to check itself (owner, scopes, push access, expiry) and to push the branch and open the PR. GitHub Actions (GITHUB_TOKEN) approves and merges.
  • Without a usable token, or when the push fails, the patch goes into the issue. The bot warns 14 days before the token expires.
Usage Syntax

The bump PR:

Title: Update the device tests to the latest operating systems: Android 37.3 (16 KB), Xcode 27.3

The nightly ensure-ci-always-tests-latest-operating-systems.yml found newer OS versions (run link). CI on this PR shows whether they work. GitHub Actions approves it after checking that it holds exactly these changes, and it merges itself when the required checks pass.

| Pin | File | Was | Now | Source |
|---|---|---|---|---|
| Android 17, 16 KB leg | device-tests.yml | '37.2' | '37.3' | sys-img2-4.xml |
| Sample Xcode | shared.env | 27.2 | 27.3 | workload set 11.0.100.2; Xcode 27.3 GA on xcode-27 |

The issue, when something needs a person:

Title: Ensure CI always tests the latest operating systems: a person needs to act

Changes a person must make:
- Move the Apple jobs from xcode-27 to xcode-28. Workload set 11.0.200.1 needs Xcode 28.0, which only xcode-28 has as a GA release.
  1. Apply the patch below on a new branch and open a PR.
  2. Right before merging, a repo admin renames the required checks named after xcode-27.
  3. Another maintainer approves the PR.

Things to check:
- ubuntu-26.04 (GA) is the newest Ubuntu runner label; the Android jobs pin ubuntu-24.04.

Run it by hand from Actions > Ensure CI Always Tests Latest Operating Systems > Run workflow, or:

gh workflow run ensure-ci-always-tests-latest-operating-systems.yml -R CommunityToolkit/Maui -f dry-run=true
Drawbacks
  • One more workflow, and a token tied to a person. It expires, and its owner can bypass the rules, so the token never merges and only main can use it.
  • Auto-merge trusts CI. A bump that passes CI but changes untested behavior would merge unseen; the allow-list keeps it to version pins.
  • Like Dependabot's merges, a bump merged by GitHub Actions starts no Build run on main; the next push builds it.
  • Google's XML, NuGet's JSON and runner-images' Markdown can change. A parse failure stops that family and is listed in the issue.
  • A bump PR can fail CI for reasons outside the toolkit, such as an emulator quirk. Someone has to investigate; that's the point of the bot, but it's still work.
Alternatives
  • The reviewer checklist from #3435 (interim, removed by this proposal): nothing is checked between workflow changes.
  • A GitHub App token (short-lived, not tied to a person): needs an org owner to create and own the App. Not chosen.
  • Dependabot's dotnet-sdk ecosystem: it bumps only the SDK in global.json (changelog), not Xcode, API levels or labels.
  • Renovate regex managers (docs): a second dependency bot beside Dependabot, and it can't tell which Xcode the workload needs.
  • Do nothing: the newest-OS legs drift until someone notices.
Unresolved Questions
  • Pin the workload set version and let the bot bump it too, so a new set can't break CI in the hours before the bump PR merges?
  • Android matrix size: the matrix grows by about one leg a year. Should the oldest leg go when the app's minimum rises, and should the coverage job (API 36) follow the newest level?
Lingua principale
C#
Stelle
2.7k
Fork
502
Merge medio
11h 10m
PR unite (30g)
50

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di CommunityToolkit/Maui

Tutte le issue di CommunityToolkit/Maui

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.