Skip to content

Conversation

@danieljurek
Copy link
Member

@danieljurek danieljurek commented Nov 25, 2025

Tested:

Scenario Result
No packages changed
Checks SemVer of changed package in PR Success (expected)
Fails on SemVer violation in PR Fail (expected)
Checks SemVer of packages in service Fail (expected)
Checks SemVer of packages in release (and blocks release) Fail (expected)

Test performance

SemVer checks add a non-trivial amount of time in some OS configurations (Windows, MacOS) because rust-semver-checks is built.

Test Job OS Time
Unit Linux 1m42s
Unit Windows 5m40s
Unit Mac 7m2s
Semver Linux 6m13s
Semver Windows 15m3s
Semver Mac 21m19s

rust-semver-check build times (look at logs for builds of stable in this PR run):

OS Time
Linux 4m50s
Windows 10m15s
Mac 17m12s

Caching considerations

Azure DevOps caches are scoped according to several factors. In the case of a PR where speed is most important, we would need a job that runs against main to populate a cache that PRs could read. We don't currently schedule PR pipelines to run. In fact, vcpkg, uses its own cache mechanism with relevant rules.

If we needed to semver check across OS quickly, we could use a storage account to hold pre-built binaries (similar to vcpkg). The binaries would be built in a Rust pipeline and uploaded to the storage account with a path prefix like carge-semver-checks/ubuntu-24/0.45.0/. Something would need to update the cache and cgmanifes.json file and proper arrangements would need to be made locally so that calling cargo semver-checks would use the correct binary.

Similar work could also be done to cache source analysis binaries

Other considerations

Checking "nightly" and "msrv" versions of Rust is more complicated. Generally, cargo-semver-checks supports "stable" so SemVer checking focuses there.

@danieljurek danieljurek self-assigned this Nov 25, 2025
@danieljurek danieljurek force-pushed the djurek/semver-checks branch 2 times, most recently from c190716 to 726de70 Compare November 26, 2025 18:44
@github-actions
Copy link

github-actions bot commented Nov 26, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

azure_identity

@danieljurek danieljurek moved this from 🤔 Triage to 🔬 Dev in PR in Azure SDK EngSys 🍔🌭 Nov 26, 2025
@danieljurek danieljurek marked this pull request as ready for review November 26, 2025 21:58
Copilot AI review requested due to automatic review settings November 26, 2025 21:58
Copilot finished reviewing on behalf of danieljurek November 26, 2025 22:00
Copy link
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

This PR adds semantic versioning (SemVer) compatibility checks to the Azure SDK for Rust build pipeline using cargo-semver-checks. The changes ensure that package version updates comply with SemVer rules before releases.

Key changes:

  • Introduces a new PowerShell script to check SemVer compatibility of packages
  • Extracts common cargo metadata functions to a shared module for reuse
  • Adds cgmanifest.json to track the cargo-semver-checks tool version used in builds

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
eng/scripts/shared/Cargo.ps1 New shared module containing reusable cargo metadata and package querying functions
eng/scripts/Test-Semver.ps1 New script that installs cargo-semver-checks and validates package changes against SemVer rules
eng/scripts/Pack-Crates.ps1 Refactored to use shared cargo functions from Cargo.ps1, eliminating duplication
eng/pipelines/templates/jobs/pack.yml Adds SemVer check tasks to both auto and manual service directory build scenarios
eng/cgmanifest.json New manifest tracking cargo-semver-checks version 0.45.0 as a development dependency

$versionParams += '--version'
$cgManfiest = Get-Content ([System.IO.Path]::Combine($PSScriptRoot, '..', 'cgmanifest.json')) `
| ConvertFrom-Json
$versionParams += $cgManfiest.
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

Typo: "CgManfiest" should be "CgManifest" (missing 'i').

Copilot uses AI. Check for mistakes.
filePath: $(Build.SourcesDirectory)/eng/scripts/Test-Semver.ps1
arguments: -PackageNames $(PackageNames)


Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

Extra blank line that should be removed for consistency with the rest of the file formatting.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +16 to +44
function Get-OutputPackageNames($workspacePackages) {
$packablePackages = $workspacePackages | Where-Object -Property publish -NE -Value @()
$packablePackageNames = $packablePackages.name

$names = @()
switch ($PsCmdlet.ParameterSetName) {
'Named' {
$names = $PackageNames
}

'PackageInfo' {
$names = Get-PackageNamesFromPackageInfo $PackageInfoDirectory
}

default {
return $packablePackageNames
}
}

foreach ($name in $names) {
if (-not $packablePackageNames.Contains($name)) {
Write-Error "Package '$name' is not in the workspace or does not publish"
exit 1
}
}

return $names
}

Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

The Get-OutputPackageNames function is duplicated between this file and Pack-Crates.ps1 (lines 59-86). This function should be extracted to the shared Cargo.ps1 module to avoid code duplication and maintain consistency.

Suggested change
function Get-OutputPackageNames($workspacePackages) {
$packablePackages = $workspacePackages | Where-Object -Property publish -NE -Value @()
$packablePackageNames = $packablePackages.name
$names = @()
switch ($PsCmdlet.ParameterSetName) {
'Named' {
$names = $PackageNames
}
'PackageInfo' {
$names = Get-PackageNamesFromPackageInfo $PackageInfoDirectory
}
default {
return $packablePackageNames
}
}
foreach ($name in $names) {
if (-not $packablePackageNames.Contains($name)) {
Write-Error "Package '$name' is not in the workspace or does not publish"
exit 1
}
}
return $names
}

Copilot uses AI. Check for mistakes.
[string[]]$PackageNames,
[Parameter(ParameterSetName = 'PackageInfo')]
[string]$PackageInfoDirectory,
[switch]$IgnoreCgManfiestVersion
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

Typo: "CgManfiest" should be "CgManifest" (missing 'i'). This parameter name is inconsistent with the variable name used on line 53.

Copilot uses AI. Check for mistakes.
# Read version from cgmanifest.json. If ignored the currently installed or
# "latest" version is used.
$versionParams = @()
if (!$IgnoreCgManfiestVersion) {
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

Typo: "CgManfiest" should be "CgManifest" (missing 'i'). This references the parameter from line 10 which also has the typo.

Copilot uses AI. Check for mistakes.
$versionParams = @()
if (!$IgnoreCgManfiestVersion) {
$versionParams += '--version'
$cgManfiest = Get-Content ([System.IO.Path]::Combine($PSScriptRoot, '..', 'cgmanifest.json')) `
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

Typo: "CgManfiest" should be "CgManifest" (missing 'i').

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔬 Dev in PR

Development

Successfully merging this pull request may close these issues.

Use cargo-semver-checks to help verify semver compatibility between releases

2 participants