Skip to content

Commit

Permalink
Add BuildEngineInterface version bump check to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ladipro committed May 31, 2021
1 parent 4d65efb commit 6d2daf7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion eng/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,23 @@ function Set-OptProfVariables() {
function Check-EditedFiles() {
# Log VSTS errors for changed lines
git --no-pager diff HEAD --unified=0 --no-color --exit-code | ForEach-Object { "##vso[task.logissue type=error] $_" }
if($LASTEXITCODE -ne 0) {
if ($LASTEXITCODE -ne 0) {
throw "##vso[task.logissue type=error] After building, there are changed files. Please build locally and include these changes in your pull request."
}
}

function Check-RequiredVersionBumps() {
# Log VSTS errors for missing required version bumps
$versionLineChanged = $false
git --no-pager diff --unified --no-color --exit-code -w main HEAD src\Framework\BuildEngineInterface.cs `
| Select-String -Pattern "int Version =" | ForEach-Object -process { $versionLineChanged = $true }
if (($LASTEXITCODE -ne 0) -and (-not $versionLineChanged)) {
throw "##vso[task.logissue type=error] Detected changes in Framework\BuildEngineInterface.cs without a version bump. " +
"If you are making API changes, please bump the version. " +
"If the changes in the file are cosmetic, please add/change a comment on the Version prop to silence the error."
}
}

try {
Process-Arguments

Expand All @@ -165,6 +177,10 @@ try {

$VSSetupDir = Join-Path $ArtifactsDir "VSSetup\$configuration"

if ($ci -and $build) {
Check-RequiredVersionBumps
}

Build-Repo

if ($ci -and $build) {
Expand Down

0 comments on commit 6d2daf7

Please sign in to comment.