Browse Source
Add OutputVersion nuke target (#14890)
* Replace PRNumber with VersionNumber+nuke
* Restore prId file
* Fix env var name
* Change artifact name back for compatibility
pull/14893/head
Max Katz
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
35 additions and
22 deletions
-
.nuke/build.schema.json
-
azure-pipelines.yml
-
nukebuild/Build.cs
-
nukebuild/BuildParameters.cs
|
|
|
@ -85,6 +85,7 @@ |
|
|
|
"CreateNugetPackages", |
|
|
|
"GenerateCppHeaders", |
|
|
|
"OutputApiDiff", |
|
|
|
"OutputVersion", |
|
|
|
"Package", |
|
|
|
"RunCoreLibsTests", |
|
|
|
"RunHtmlPreviewerTests", |
|
|
|
@ -121,6 +122,7 @@ |
|
|
|
"CreateNugetPackages", |
|
|
|
"GenerateCppHeaders", |
|
|
|
"OutputApiDiff", |
|
|
|
"OutputVersion", |
|
|
|
"Package", |
|
|
|
"RunCoreLibsTests", |
|
|
|
"RunHtmlPreviewerTests", |
|
|
|
@ -145,6 +147,9 @@ |
|
|
|
"Quiet", |
|
|
|
"Verbose" |
|
|
|
] |
|
|
|
}, |
|
|
|
"version-output-dir": { |
|
|
|
"type": "string" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -2,31 +2,19 @@ jobs: |
|
|
|
|
|
|
|
- job: GetPRNumber |
|
|
|
pool: |
|
|
|
vmImage: 'windows-2022' |
|
|
|
vmImage: 'ubuntu-20.04' |
|
|
|
variables: |
|
|
|
SolutionDir: '$(Build.SourcesDirectory)' |
|
|
|
steps: |
|
|
|
- task: PowerShell@2 |
|
|
|
displayName: Get PR Number |
|
|
|
- task: UseDotNet@2 |
|
|
|
displayName: 'Use .NET 8.0 SDK' |
|
|
|
inputs: |
|
|
|
targetType: 'inline' |
|
|
|
script: | |
|
|
|
$Namespace = @{ msbuild = "http://schemas.microsoft.com/developer/msbuild/2003" } |
|
|
|
$versionBase = Select-Xml -Path build\SharedVersion.props -XPath /msbuild:Project/msbuild:PropertyGroup/msbuild:Version -Namespace $Namespace |ForEach-Object {$_.Node.Innerxml} |
|
|
|
Write-Host "Base Version Number is:-" $versionBase |
|
|
|
|
|
|
|
$prId = $env:System_PullRequest_PullRequestNumber |
|
|
|
Write-Host "PR Number is:-" $env:System_PullRequest_PullRequestNumber |
|
|
|
|
|
|
|
if (!([string]::IsNullOrWhiteSpace($prId))) |
|
|
|
{ |
|
|
|
Set-Content -Path $env:Build_ArtifactStagingDirectory\prId.txt -Value $prId |
|
|
|
} |
|
|
|
if (!([string]::IsNullOrWhiteSpace($versionBase))) |
|
|
|
{ |
|
|
|
Set-Content -Path $env:Build_ArtifactStagingDirectory\versionBase.txt -Value $versionBase |
|
|
|
} |
|
|
|
|
|
|
|
packageType: sdk |
|
|
|
useGlobalJson: true |
|
|
|
- task: CmdLine@2 |
|
|
|
displayName: 'Run Build' |
|
|
|
inputs: |
|
|
|
script: ./build.sh --target OutputVersion --version-output-dir $(Build.ArtifactStagingDirectory) |
|
|
|
- task: PublishBuildArtifacts@1 |
|
|
|
inputs: |
|
|
|
PathtoPublish: '$(Build.ArtifactStagingDirectory)' |
|
|
|
|
|
|
|
@ -150,6 +150,21 @@ partial class Build : NukeBuild |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
Target OutputVersion => _ => _ |
|
|
|
.Requires(() => VersionOutputDir) |
|
|
|
.Executes(() => |
|
|
|
{ |
|
|
|
var versionFile = Path.Combine(Parameters.VersionOutputDir, "version.txt"); |
|
|
|
var currentBuildVersion = Parameters.Version; |
|
|
|
Console.WriteLine("Version is: " + currentBuildVersion); |
|
|
|
File.WriteAllText(versionFile, currentBuildVersion); |
|
|
|
|
|
|
|
var prIdFile = Path.Combine(Parameters.VersionOutputDir, "prId.txt"); |
|
|
|
var prId = Environment.GetEnvironmentVariable("SYSTEM_PULLREQUEST_PULLREQUESTNUMBER"); |
|
|
|
Console.WriteLine("PR Number is: " + prId); |
|
|
|
File.WriteAllText(prIdFile, prId); |
|
|
|
}); |
|
|
|
|
|
|
|
void RunCoreTest(string projectName) |
|
|
|
{ |
|
|
|
Information($"Running tests from {projectName}"); |
|
|
|
|
|
|
|
@ -25,10 +25,13 @@ public partial class Build |
|
|
|
|
|
|
|
[Parameter(Name = "api-baseline")] |
|
|
|
public string ApiValidationBaseline { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
[Parameter(Name = "update-api-suppression")] |
|
|
|
public bool? UpdateApiValidationSuppression { get; set; } |
|
|
|
|
|
|
|
[Parameter(Name = "version-output-dir")] |
|
|
|
public AbsolutePath VersionOutputDir { get; set; } |
|
|
|
|
|
|
|
public class BuildParameters |
|
|
|
{ |
|
|
|
public string Configuration { get; } |
|
|
|
@ -70,6 +73,7 @@ public partial class Build |
|
|
|
public string ApiValidationBaseline { get; } |
|
|
|
public bool UpdateApiValidationSuppression { get; } |
|
|
|
public AbsolutePath ApiValidationSuppressionFiles { get; } |
|
|
|
public AbsolutePath VersionOutputDir { get; } |
|
|
|
|
|
|
|
public BuildParameters(Build b, bool isPackingToLocalCache) |
|
|
|
{ |
|
|
|
@ -146,6 +150,7 @@ public partial class Build |
|
|
|
ZipCoreArtifacts = ZipRoot / ("Avalonia-" + FileZipSuffix); |
|
|
|
ZipNuGetArtifacts = ZipRoot / ("Avalonia-NuGet-" + FileZipSuffix); |
|
|
|
ApiValidationSuppressionFiles = RootDirectory / "api"; |
|
|
|
VersionOutputDir = b.VersionOutputDir; |
|
|
|
} |
|
|
|
|
|
|
|
string GetVersion() |
|
|
|
|