Track CI baseline change effect (#30756)

* Test ci baseline change effect

* Skip parent hashes when baseline was modified

* Update head baseline variable

* Revert "Test ci baseline change effect"

This reverts commit a5e7a5c404eb400476555b92e51b3f5a87880300.

* Read raw data
This commit is contained in:
Kai Pastor 2023-04-12 08:11:59 +02:00 committed by GitHub
parent 59ac2a6fea
commit 0746c2aab7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}