Files
OpenShell/tasks/scripts/check-cargo-lockfiles.ps1
T
Prekshi VyasandShailendra Singh d95bab5436 fix(ci): upstream Windows SDK validation support (#3327)
* fix(ci): upstream Windows SDK validation support

Port remaining Windows validation tooling from GitLab independently of the combined MXC runtime port. Preserve locked SDK dependencies and guard temporary launcher cleanup.

Co-authored-by: Shailendra Singh <shailendras@nvidia.com>
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>

* fix(ci): install native TypeScript dependencies before validation

Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>

---------

Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
Co-authored-by: Shailendra Singh <shailendras@nvidia.com>
2026-09-15 22:34:36 +00:00

45 lines
1.4 KiB
PowerShell

# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
$ErrorActionPreference = "Stop"
$repoRoot = (& git rev-parse --show-toplevel).Trim()
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($repoRoot)) {
throw "Unable to resolve the repository root"
}
Set-Location -LiteralPath $repoRoot
$lockfiles = @(& git ls-files -- ':(glob)**/Cargo.lock')
if ($LASTEXITCODE -ne 0) {
throw "Unable to enumerate tracked Cargo.lock files"
}
if ($lockfiles.Count -eq 0) {
throw "No tracked Cargo.lock files found"
}
$failed = $false
foreach ($lockfile in $lockfiles) {
$lockfileDirectory = Split-Path -Parent $lockfile
$manifest = if ([string]::IsNullOrEmpty($lockfileDirectory)) {
"Cargo.toml"
} else {
Join-Path $lockfileDirectory "Cargo.toml"
}
if (-not (Test-Path -LiteralPath $manifest -PathType Leaf)) {
Write-Error "Tracked lockfile $lockfile has no adjacent Cargo.toml"
$failed = $true
continue
}
Write-Output "Checking $lockfile"
& cargo metadata --locked --format-version 1 --manifest-path $manifest | Out-Null
if ($LASTEXITCODE -ne 0) {
Write-Error "Validation failed for $lockfile"
$failed = $true
}
}
if ($failed) {
throw "Resolve the reported errors. If a lockfile needs updating, refresh it with Cargo and commit the result."
}