Skip to content

ci: Auto-Verify API changes in Pull Requests #5157

Description

@Flash0ver

Summary

Changes to the public API surface area often cause ping-pings with the API-Verify/Snapshot tests in CI.

Remarks

In particular, developing on non-Windows, we often run into the problem that the .NET Framework API changes are missing and therefore failing CI tests.

Similar to the Auto-Format workflow,
we want to Auto-Accept all API-Verify changes on all TFMs.

We could expand this to not just API changes, but all Snapshot/Verify tests.

See scripts/accept-verifier-changes.ps1.
See .github/workflows/format-code.yml.

When an API-change is auto-committed, CI could also set the public API label to the PR to indicate a modification.

Alternative

Instead of comparing and verifying the API shape at run-time (test-time),
we could use the Diagnostic Analyzers of Microsoft.CodeAnalysis.PublicApiAnalyzers instead;
see https://github.com/dotnet/roslyn/blob/main/src/RoslynAnalyzers/PublicApiAnalyzers/PublicApiAnalyzers.Help.md
This approach might simplify the process and reviews of changes, because there is one shared file across all TFMs, that does include Conditional API Differences, rather than having a file per TFM. To be precise, there are two files, actually: PublicAPI.Shipped.txt and PublicAPI.Unshipped.txt. So before a Release, PublicAPI.Unshipped.txt is edited, and during a Release, we would need to apply the current PublicAPI.Unshipped.txt to the PublicAPI.Shipped.txt.

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions