diff --git a/scripts/azure-pipelines/test-modified-ports.ps1 b/scripts/azure-pipelines/test-modified-ports.ps1 index 55a05aef32..a34f2f416d 100755 --- a/scripts/azure-pipelines/test-modified-ports.ps1 +++ b/scripts/azure-pipelines/test-modified-ports.ps1 @@ -136,6 +136,8 @@ if ($LASTEXITCODE -ne 0) $parentHashes = @() if (($BuildReason -eq 'PullRequest') -and -not $NoParentHashes) { + $headBaseline = Get-Content "$PSScriptRoot/../ci.baseline.txt" -Raw + # Prefetch tools for better output foreach ($tool in @('cmake', 'ninja', 'git')) { & "./vcpkg$executableExtension" fetch $tool @@ -145,17 +147,25 @@ if (($BuildReason -eq 'PullRequest') -and -not $NoParentHashes) } } - Write-Host "Determining parent hashes using HEAD~1" - $parentHashesFile = Join-Path $ArtifactStagingDirectory 'parent-hashes.json' - $parentHashes = @("--parent-hashes=$parentHashesFile") + Write-Host "Comparing with HEAD~1" & git revert -n -m 1 HEAD | Out-Null - # The vcpkg.cmake toolchain file is not part of ABI hashing, - # but changes must trigger at least some testing. - Copy-Item "scripts/buildsystems/vcpkg.cmake" -Destination "scripts/test_ports/cmake" - Copy-Item "scripts/buildsystems/vcpkg.cmake" -Destination "scripts/test_ports/cmake-user" - & "./vcpkg$executableExtension" ci "--triplet=$Triplet" --dry-run "--ci-baseline=$PSScriptRoot/../ci.baseline.txt" @commonArgs --no-binarycaching "--output-hashes=$parentHashesFile" - - Write-Host "Running CI using parent hashes" + $parentBaseline = Get-Content "$PSScriptRoot/../ci.baseline.txt" -Raw + if ($parentBaseline -eq $headBaseline) + { + Write-Host "CI baseline unchanged, determining parent hashes" + $parentHashesFile = Join-Path $ArtifactStagingDirectory 'parent-hashes.json' + $parentHashes = @("--parent-hashes=$parentHashesFile") + # The vcpkg.cmake toolchain file is not part of ABI hashing, + # but changes must trigger at least some testing. + Copy-Item "scripts/buildsystems/vcpkg.cmake" -Destination "scripts/test_ports/cmake" + Copy-Item "scripts/buildsystems/vcpkg.cmake" -Destination "scripts/test_ports/cmake-user" + & "./vcpkg$executableExtension" ci "--triplet=$Triplet" --dry-run "--ci-baseline=$PSScriptRoot/../ci.baseline.txt" @commonArgs --no-binarycaching "--output-hashes=$parentHashesFile" + } + else + { + Write-Host "CI baseline was modified, not using parent hashes" + } + Write-Host "Running CI for HEAD" & git reset --hard HEAD }