-
Notifications
You must be signed in to change notification settings - Fork 302
Backport genuinely-missing main commits to rel/4.3 #9692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Evangelink
merged 8 commits into
rel/4.3
from
dev/amauryleve/backport-main-commits-to-rel-4-3
Jul 7, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4009fb2
Document GH_AW_GITHUB_TOKEN removal and enterprise 8-day PAT policy (…
Evangelink 4a0f561
test: add edge case tests for MSTEST0045/0050/0060 analyzers (#9615)
Evangelink 6862d89
Re-enable LocalizationTests and LocalizationFailingTests (#9643)
Evangelink eade90c
perf: skip TCS bridge in ExecuteTestAsync when no ExecutionContext is…
Evangelink a430dde
docs: fix Changelog-Platform links and add #9641 entry (#9667)
Evangelink 866b118
Add scheduled workflow to bump bundled Playwright (fixes #9362) (#9666)
Evangelink 94c922f
test: add edge case tests for MSTEST0020/0021 analyzers (#9669)
Evangelink 4003025
perf: avoid GetParameters() allocation in test-invocation hot path (#…
Evangelink File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| #!/usr/bin/env python3 | ||
| """Bump the MSTest.Sdk-bundled Microsoft.Playwright.MSTest.v4 version. | ||
|
|
||
| Dependabot cannot reliably open this bump on its own: it discovers the package | ||
| via the anchor in Directory.Packages.props and even computes the new version, | ||
| but drops the change at PR-assembly time for this specific package (see | ||
| https://github.com/microsoft/testfx/issues/9362). This script replaces that | ||
| one Dependabot flow. | ||
|
|
||
| It looks up the latest STABLE Microsoft.Playwright.MSTest.v4 on nuget.org and, | ||
| when newer than what the repo bundles, rewrites BOTH coupled values in | ||
| Directory.Packages.props so they stay in sync (the _ValidateBundledSdkFeatureVersions | ||
| target fails the build otherwise): | ||
|
|
||
| * the <MicrosoftPlaywrightVersion> property (consumed by the build / baked into | ||
| the shipped SDK template), and | ||
| * the literal <PackageVersion Include="Microsoft.Playwright.MSTest.v4" ...>. | ||
|
|
||
| Modes: | ||
| update Query nuget.org and rewrite Directory.Packages.props if a newer | ||
| stable version exists. Emits changed/old/new to $GITHUB_OUTPUT. | ||
| check Validate the two coupled values are present and in sync (used by the | ||
| workflow's pull_request self-test; no network, no writes). | ||
| """ | ||
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| import json | ||
| import os | ||
| import re | ||
| import sys | ||
| import urllib.request | ||
| from pathlib import Path | ||
|
|
||
| PACKAGE_ID = "Microsoft.Playwright.MSTest.v4" | ||
| FLAT_CONTAINER = ( | ||
| "https://api.nuget.org/v3-flatcontainer/" | ||
| "microsoft.playwright.mstest.v4/index.json" | ||
| ) | ||
|
|
||
| REPO_ROOT = Path(__file__).resolve().parents[2] | ||
| PROPS_PATH = REPO_ROOT / "Directory.Packages.props" | ||
|
|
||
| PROPERTY_RE = re.compile( | ||
| r"(<MicrosoftPlaywrightVersion>)(?P<version>[^<]+)(</MicrosoftPlaywrightVersion>)" | ||
| ) | ||
| PACKAGE_VERSION_RE = re.compile( | ||
| r'(<PackageVersion\s+Include="Microsoft\.Playwright\.MSTest\.v4"\s+Version=")' | ||
| r"(?P<version>[^\"]+)(\"\s*/>)" | ||
| ) | ||
|
|
||
|
|
||
| def _stable_tuple(version: str) -> tuple[int, ...] | None: | ||
| """Return a comparable tuple for a stable version, or None for prereleases.""" | ||
| if "-" in version or "+" in version: | ||
| return None | ||
| parts = version.split(".") | ||
| if not all(p.isdigit() for p in parts): | ||
| return None | ||
| return tuple(int(p) for p in parts) | ||
|
|
||
|
|
||
| def latest_stable_version() -> str: | ||
| with urllib.request.urlopen(FLAT_CONTAINER, timeout=60) as response: | ||
| payload = json.load(response) | ||
| candidates = [] | ||
| for version in payload.get("versions", []): | ||
| key = _stable_tuple(version) | ||
| if key is not None: | ||
| candidates.append((key, version)) | ||
| if not candidates: | ||
| raise RuntimeError(f"No stable versions found for {PACKAGE_ID}.") | ||
| candidates.sort(key=lambda item: item[0]) | ||
| return candidates[-1][1] | ||
|
|
||
|
|
||
| def read_current_versions(text: str) -> tuple[str, str]: | ||
| prop_match = PROPERTY_RE.search(text) | ||
| pkg_match = PACKAGE_VERSION_RE.search(text) | ||
| if prop_match is None: | ||
| raise RuntimeError("Could not find <MicrosoftPlaywrightVersion> in Directory.Packages.props.") | ||
| if pkg_match is None: | ||
| raise RuntimeError( | ||
| f'Could not find <PackageVersion Include="{PACKAGE_ID}" .../> in Directory.Packages.props.' | ||
| ) | ||
| return prop_match.group("version"), pkg_match.group("version") | ||
|
|
||
|
|
||
| def set_github_output(**pairs: str) -> None: | ||
| output_path = os.environ.get("GITHUB_OUTPUT") | ||
| if not output_path: | ||
| return | ||
| with open(output_path, "a", encoding="utf-8") as handle: | ||
| for key, value in pairs.items(): | ||
| handle.write(f"{key}={value}\n") | ||
|
|
||
|
|
||
| def cmd_check() -> int: | ||
| text = PROPS_PATH.read_text(encoding="utf-8") | ||
| prop_version, pkg_version = read_current_versions(text) | ||
| if prop_version != pkg_version: | ||
| print( | ||
| "::error::MicrosoftPlaywrightVersion " | ||
| f"('{prop_version}') is out of sync with the {PACKAGE_ID} " | ||
| f"PackageVersion ('{pkg_version}')." | ||
| ) | ||
| return 1 | ||
| print(f"OK: bundled Playwright is {prop_version} (property and PackageVersion in sync).") | ||
| return 0 | ||
|
|
||
|
|
||
| def cmd_update() -> int: | ||
| text = PROPS_PATH.read_text(encoding="utf-8") | ||
| current_property, current_package = read_current_versions(text) | ||
| if current_property != current_package: | ||
| print( | ||
| "::error::Refusing to update: MicrosoftPlaywrightVersion " | ||
| f"('{current_property}') and the {PACKAGE_ID} PackageVersion " | ||
| f"('{current_package}') already disagree. Reconcile them first." | ||
| ) | ||
| return 1 | ||
|
|
||
| current = current_property | ||
| latest = latest_stable_version() | ||
| print(f"Current bundled Playwright: {current}") | ||
| print(f"Latest stable on nuget.org: {latest}") | ||
|
|
||
| if _stable_tuple(latest) <= _stable_tuple(current): | ||
| print("Already up to date; nothing to do.") | ||
| set_github_output(changed="false", old_version=current, new_version=current) | ||
| return 0 | ||
|
|
||
| updated = PROPERTY_RE.sub(rf"\g<1>{latest}\g<3>", text, count=1) | ||
| updated = PACKAGE_VERSION_RE.sub(rf"\g<1>{latest}\g<3>", updated, count=1) | ||
| PROPS_PATH.write_text(updated, encoding="utf-8") | ||
|
|
||
| print(f"Updated bundled Playwright {current} -> {latest}.") | ||
| set_github_output(changed="true", old_version=current, new_version=latest) | ||
| return 0 | ||
|
|
||
|
|
||
| def main() -> int: | ||
| parser = argparse.ArgumentParser(description=__doc__) | ||
| parser.add_argument("mode", choices=["update", "check"]) | ||
| args = parser.parse_args() | ||
| if args.mode == "check": | ||
| return cmd_check() | ||
| return cmd_update() | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(main()) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| name: Update bundled Playwright | ||
|
|
||
| # Keeps the MSTest.Sdk-bundled Microsoft.Playwright.MSTest.v4 version current. | ||
| # | ||
| # Dependabot cannot reliably do this: it discovers the package via the anchor in | ||
| # Directory.Packages.props and even computes the new version, but drops the change | ||
| # at PR-assembly time for this specific package. See | ||
| # https://github.com/microsoft/testfx/issues/9362 for the full investigation. | ||
| # | ||
| # This workflow replaces that one Dependabot flow: | ||
| # - Scheduled / manual runs look up the latest STABLE release on nuget.org and, | ||
| # when newer, rewrite BOTH coupled values in Directory.Packages.props | ||
| # (the <MicrosoftPlaywrightVersion> property and the literal PackageVersion, | ||
| # which _ValidateBundledSdkFeatureVersions requires to stay in sync) and open | ||
| # a PR. | ||
| # - Pull-request runs that touch the script or workflow only self-test the | ||
| # script (no network writes, no PR) to catch regressions. | ||
|
|
||
| on: | ||
| schedule: | ||
| # Weekly, Tuesday 07:00 UTC (offset from other scheduled workflow slots). | ||
| - cron: '0 7 * * 2' | ||
| workflow_dispatch: | ||
| pull_request: | ||
| paths: | ||
| - '.github/scripts/update_bundled_playwright.py' | ||
| - '.github/workflows/update-bundled-playwright.yml' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| self-test: | ||
| name: Self-test script | ||
| if: github.event_name == 'pull_request' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | ||
| - name: Setup Python | ||
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | ||
| with: | ||
| python-version: '3.12' | ||
| - name: Validate Directory.Packages.props is in sync | ||
| run: python .github/scripts/update_bundled_playwright.py check | ||
|
|
||
| update: | ||
| name: Bump bundled Playwright | ||
| if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | ||
| runs-on: ubuntu-latest | ||
| # One in-flight update at a time so scheduled + manual runs don't race on the | ||
| # shared update-bundled-playwright/autoupdate branch. Scoped to this job so | ||
| # read-only PR self-tests are never gated behind the update lock. | ||
| concurrency: | ||
| group: update-bundled-playwright | ||
| cancel-in-progress: false | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Compute and apply update | ||
| id: bump | ||
| run: python .github/scripts/update_bundled_playwright.py update | ||
|
|
||
| - name: Create Pull Request | ||
| if: steps.bump.outputs.changed == 'true' | ||
| uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7 | ||
| with: | ||
| commit-message: "Update bundled Playwright for .NET to ${{ steps.bump.outputs.new_version }}" | ||
| title: "Update bundled Playwright for .NET to ${{ steps.bump.outputs.new_version }}" | ||
| body: | | ||
| Bumps the MSTest.Sdk-bundled `Microsoft.Playwright.MSTest.v4` from | ||
| `${{ steps.bump.outputs.old_version }}` to `${{ steps.bump.outputs.new_version }}`. | ||
|
|
||
| Updates both the `MicrosoftPlaywrightVersion` property and the matching | ||
| `Microsoft.Playwright.MSTest.v4` `PackageVersion` in `Directory.Packages.props` | ||
| so `_ValidateBundledSdkFeatureVersions` stays green. | ||
|
|
||
| Opened by the `update-bundled-playwright` workflow because Dependabot | ||
| cannot reliably open this bump (see #9362). | ||
| branch: update-bundled-playwright/autoupdate | ||
| delete-branch: true | ||
| labels: dependencies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.