|
1 | | -#tool "dotnet:https://api.nuget.org/v3/index.json?package=GitVersion.Tool&version=6.5.0" |
2 | | -#addin nuget:?package=System.Text.Json&version=10.0.0&loaddependencies=true |
3 | | -#load "build/records.cake" |
4 | | -#load "build/helpers.cake" |
| 1 | +#:sdk Cake.Sdk@6.0.0 |
| 2 | +#:package xunit.v3.assert@3.2.1 |
| 3 | +#:property IncludeAdditionalFiles=./build/*.cs |
| 4 | +using Xunit; |
5 | 5 |
|
6 | 6 | /***************************** |
7 | 7 | * Setup |
8 | 8 | *****************************/ |
9 | 9 | Setup( |
10 | 10 | static context => { |
11 | | - var assertedVersions = context.GitVersion(new GitVersionSettings |
| 11 | + InstallTool("dotnet:https://api.nuget.org/v3/index.json?package=GitVersion.Tool&version=6.5.1"); |
| 12 | + var assertedVersions = context.GitVersion(new GitVersionSettings |
12 | 13 | { |
13 | 14 | OutputType = GitVersionOutput.Json |
14 | 15 | }); |
15 | 16 |
|
16 | 17 | var branchName = assertedVersions.BranchName; |
17 | 18 | var isMainBranch = StringComparer.OrdinalIgnoreCase.Equals("main", branchName); |
18 | 19 |
|
19 | | - var gh = context.GitHubActions(); |
20 | 20 | var buildDate = DateTime.UtcNow; |
21 | | - var runNumber = gh.IsRunningOnGitHubActions |
22 | | - ? gh.Environment.Workflow.RunNumber |
| 21 | + var runNumber = GitHubActions.IsRunningOnGitHubActions |
| 22 | + ? GitHubActions.Environment.Workflow.RunNumber |
23 | 23 | : (short)((buildDate - buildDate.Date).TotalSeconds/3); |
24 | 24 |
|
25 | 25 | var version = FormattableString |
|
51 | 51 | .WithProperty("PackageTags", "tool") |
52 | 52 | .WithProperty("PackageDescription", "Dependency Inventory .NET Tool - Inventories dependencies to Azure Log Analytics") |
53 | 53 | .WithProperty("RepositoryUrl", "https://github.com/devlead/DPI.git") |
54 | | - .WithProperty("ContinuousIntegrationBuild", gh.IsRunningOnGitHubActions ? "true" : "false") |
| 54 | + .WithProperty("ContinuousIntegrationBuild", GitHubActions.IsRunningOnGitHubActions ? "true" : "false") |
55 | 55 | .WithProperty("EmbedUntrackedSources", "true"), |
56 | 56 | artifactsPath, |
57 | 57 | artifactsPath.Combine(version) |
|
100 | 100 | .Then("Upload-Artifacts") |
101 | 101 | .WithCriteria(BuildSystem.IsRunningOnGitHubActions, nameof(BuildSystem.IsRunningOnGitHubActions)) |
102 | 102 | .Does<BuildData>( |
103 | | - static (context, data) => context |
104 | | - .GitHubActions() is var gh && gh != null |
105 | | - ? gh.Commands |
106 | | - .UploadArtifact(data.ArtifactsPath, $"Artifact_{gh.Environment.Runner.ImageOS ?? gh.Environment.Runner.OS}_{context.Environment.Runtime.BuiltFramework.Identifier}_{context.Environment.Runtime.BuiltFramework.Version}") |
107 | | - : throw new Exception("GitHubActions not available") |
| 103 | + static (context, data) => GitHubActions |
| 104 | + .Commands |
| 105 | + .UploadArtifact(data.ArtifactsPath, $"Artifact_{GitHubActions.Environment.Runner.ImageOS ?? GitHubActions.Environment.Runner.OS}_{context.Environment.Runtime.BuiltFramework.Identifier}_{context.Environment.Runtime.BuiltFramework.Version}") |
108 | 106 | ) |
109 | 107 | .Then("Integration-Tests-Restore-MultiTarget") |
110 | 108 | .Does<BuildData>( |
@@ -191,6 +189,8 @@ out json |
191 | 189 | string.Concat(json) |
192 | 190 | ); |
193 | 191 |
|
| 192 | + Assert.NotNull(packageReferences); |
| 193 | + |
194 | 194 | Array.ForEach( |
195 | 195 | packageReferences, |
196 | 196 | packageReference => Assert.Equal( |
|
0 commit comments