1- #tool dotnet : ? package= GitVersion . Tool & version = 6.5 .1
2- #load "build/records.cake"
3- #load "build/helpers.cake"
1+ #: sdk Cake . Sdk@6.0 .0
2+ #: property IncludeAdditionalFiles = . / build /*.cs
43
54/*****************************
65 * Setup
76 *****************************/
87Setup (
98 static context => {
10- var assertedVersions = context . GitVersion ( new GitVersionSettings
9+ InstallTool ( "dotnet:https://api.nuget.org/v3/index.json?package=GitVersion.Tool&version=6.5.1" ) ;
10+ InstallTool ( "dotnet:https://api.nuget.org/v3/index.json?package=DPI&version=2025.12.17.349" ) ;
11+ var assertedVersions = context . GitVersion ( new GitVersionSettings
1112 {
1213 OutputType = GitVersionOutput . Json
1314 } ) ;
1415
1516 var branchName = assertedVersions . BranchName ;
1617 var isMainBranch = StringComparer . OrdinalIgnoreCase . Equals ( "main" , branchName ) ;
1718
18- var gh = context . GitHubActions ( ) ;
1919 var buildDate = DateTime . UtcNow ;
20- var runNumber = gh . IsRunningOnGitHubActions
21- ? gh . Environment . Workflow . RunNumber
20+ var runNumber = GitHubActions . IsRunningOnGitHubActions
21+ ? GitHubActions . Environment . Workflow . RunNumber
2222 : ( short ) ( ( buildDate - buildDate . Date ) . TotalSeconds / 3 ) ;
2323
2424 var version = FormattableString
4141 version ,
4242 isMainBranch ,
4343 ! context . IsRunningOnWindows ( ) ,
44- context . BuildSystem ( ) . IsLocalBuild ,
44+ BuildSystem . IsLocalBuild ,
4545 projectRoot ,
4646 projectPath ,
4747 new DotNetMSBuildSettings ( )
5454 . WithProperty ( "PackageTags" , "tool;bicep;acr;azure" )
5555 . WithProperty ( "PackageDescription" , "Azure Resource Inventory .NET Tool - Inventories and documents Azure Tenant resources" )
5656 . WithProperty ( "RepositoryUrl" , "https://github.com/devlead/ARI.git" )
57- . WithProperty ( "ContinuousIntegrationBuild" , gh . IsRunningOnGitHubActions ? "true" : "false" )
57+ . WithProperty ( "ContinuousIntegrationBuild" , GitHubActions . IsRunningOnGitHubActions ? "true" : "false" )
5858 . WithProperty ( "EmbedUntrackedSources" , "true" ) ,
5959 artifactsPath ,
6060 artifactsPath . Combine ( version )
8080 )
8181. Then ( "DPI" )
8282 . Does < BuildData > (
83- static ( context , data ) => context . DotNetTool (
84- "tool" ,
85- new DotNetToolSettings {
86- ArgumentCustomization = args => args
87- . Append ( "run" )
88- . Append ( "dpi" )
89- . Append ( "nuget" )
90- . Append ( "--silent" )
91- . AppendSwitchQuoted ( "--output" , "table" )
92- . Append (
93- (
94- ! string . IsNullOrWhiteSpace ( context . EnvironmentVariable ( "NuGetReportSettings_SharedKey" ) )
95- &&
96- ! string . IsNullOrWhiteSpace ( context . EnvironmentVariable ( "NuGetReportSettings_WorkspaceId" ) )
97- )
98- ? "report"
99- : "analyze"
100- )
101- . AppendSwitchQuoted ( "--buildversion" , data . Version )
102- }
103- )
83+ static ( context , data ) => {
84+ Command (
85+ [ "dpi" , "dpi.exe" ] ,
86+ new ProcessArgumentBuilder ( )
87+ . Append ( "nuget" )
88+ . Append ( "--silent" )
89+ . AppendSwitchQuoted ( "--output" , "table" )
90+ . Append (
91+ (
92+ ! string . IsNullOrWhiteSpace ( context . EnvironmentVariable ( "NuGetReportSettings_SharedKey" ) )
93+ &&
94+ ! string . IsNullOrWhiteSpace ( context . EnvironmentVariable ( "NuGetReportSettings_WorkspaceId" ) )
95+ )
96+ ? "report"
97+ : "analyze"
98+ )
99+ . AppendSwitchQuoted ( "--buildversion" , data . Version )
100+ ) ;
101+ }
104102 )
105103. Then ( "Build" )
106104 . Does < BuildData > (
138136. Then ( "Upload-Artifacts" )
139137 . WithCriteria ( BuildSystem . IsRunningOnGitHubActions , nameof ( BuildSystem . IsRunningOnGitHubActions ) )
140138 . Does < BuildData > (
141- static ( context , data ) => context
142- . GitHubActions ( ) is var gh && gh != null
143- ? gh . Commands
144- . UploadArtifact ( data . ArtifactsPath , $ "Artifact_{ gh . Environment . Runner . ImageOS ?? gh . Environment . Runner . OS } _{ context . Environment . Runtime . BuiltFramework . Identifier } _{ context . Environment . Runtime . BuiltFramework . Version } ")
145- : throw new Exception ( "GitHubActions not available" )
139+ static ( context , data ) => GitHubActions
140+ . Commands
141+ . UploadArtifact ( data . ArtifactsPath , $ "Artifact_{ GitHubActions . Environment . Runner . ImageOS ?? GitHubActions . Environment . Runner . OS } _{ context . Environment . Runtime . BuiltFramework . Identifier } _{ context . Environment . Runtime . BuiltFramework . Version } ")
146142 )
147143. Then ( "Integration-Tests-Tool-Manifest" )
148144 . Does < BuildData > (
192188 . WithCriteria ( BuildSystem . IsRunningOnGitHubActions , nameof ( BuildSystem . IsRunningOnGitHubActions ) )
193189 . WithCriteria < BuildData > ( ( context , data ) => data . ShouldRunIntegrationTests ( ) , "ShouldRunIntegrationTests" )
194190 . Does < BuildData > (
195- async ( context , data ) => {
191+ static ( context , data ) => {
196192 var resultPath = data . IntegrationTestPath ;
197- await GitHubActions . Commands . UploadArtifact (
193+ GitHubActions . Commands . UploadArtifact (
198194 resultPath ,
199195 $ "{ data . AzureDomain } _{ GitHubActions . Environment . Runner . ImageOS ?? GitHubActions . Environment . Runner . OS } _{ context . Environment . Runtime . BuiltFramework . Identifier } _{ context . Environment . Runtime . BuiltFramework . Version } "
200196 ) ;
@@ -206,7 +202,7 @@ await GitHubActions.Commands.UploadArtifact(
206202 . SelectMany ( line => line )
207203 )
208204 ) ;
209- }
205+ }
210206 )
211207. Then ( "Integration-Tests" )
212208. Then ( "Generate-Statiq-Web" )
0 commit comments