-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #894 from adamralph/build-metadata-info-version-only
include build metadata in informational version only
- Loading branch information
Showing
10 changed files
with
81 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime.InteropServices.ComTypes; | ||
using System.Threading.Tasks; | ||
using MinVerTests.Infra; | ||
using Xunit; | ||
|
||
namespace MinVerTests.Packages; | ||
|
||
public static class SourceLink | ||
{ | ||
[Fact] | ||
public static async Task HasCommitSha() | ||
{ | ||
// arrange | ||
var path = MethodBase.GetCurrentMethod().GetTestDirectory(); | ||
await Sdk.CreateProject(path); | ||
|
||
_ = await Sdk.DotNet($"add package Microsoft.SourceLink.GitHub --version 1.1.1 --package-directory packages", path); | ||
_ = await Sdk.DotNet("restore --packages packages", path); | ||
|
||
await Git.Init(path); | ||
await Git.Commit(path); | ||
var sha = (await Git.GetCommitShas(path)).Single(); | ||
|
||
var buildMetadata = "build.123"; | ||
var envVars = ("MinVerBuildMetadata", buildMetadata); | ||
var expected = Package.WithVersion(0, 0, 0, new[] { "alpha", "0", }, 0, $"build.123", $".{sha}"); | ||
|
||
// act | ||
var (actual, _, _) = await Sdk.BuildProject(path, envVars: envVars); | ||
var (cliStandardOutput, _) = await MinVerCli.ReadAsync(path, envVars: envVars); | ||
|
||
// assert | ||
Assert.Equal(expected, actual); | ||
Assert.Equal($"{expected.Version}+{buildMetadata}", cliStandardOutput.Trim()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters