-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add links to scenario files in the test report
- Loading branch information
1 parent
abe20a8
commit 373c64b
Showing
8 changed files
with
494 additions
and
411 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
namespace NScenario; | ||
|
||
internal static class RepoPathResolver | ||
{ | ||
public static string? FindRepoRootDirectory(string? fileInTheRepo) | ||
{ | ||
if (fileInTheRepo == null) | ||
return null; | ||
|
||
var currentDirectory = new DirectoryInfo(Path.GetDirectoryName(fileInTheRepo) ?? string.Empty); | ||
|
||
while (currentDirectory is { Exists: true }) | ||
{ | ||
if (Directory.Exists(Path.Combine(currentDirectory.FullName, ".git"))) | ||
{ | ||
return currentDirectory.FullName; | ||
} | ||
currentDirectory = currentDirectory.Parent; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
public static SourceControlInfo? GetSourceControlInfo(Assembly assembly) | ||
{ | ||
var repositoryUrl = assembly.GetCustomAttributes<AssemblyMetadataAttribute>().FirstOrDefault(x => x.Key == "RepositoryUrl")?.Value; | ||
var revision = assembly.GetCustomAttributes<AssemblyInformationalVersionAttribute>().FirstOrDefault()?.InformationalVersion?.Split('+').LastOrDefault(); | ||
|
||
if (string.IsNullOrWhiteSpace(repositoryUrl) == false && string.IsNullOrWhiteSpace(revision) == false) | ||
{ | ||
return new SourceControlInfo(repositoryUrl, revision); | ||
} | ||
|
||
return null; | ||
} | ||
} |
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,3 @@ | ||
namespace NScenario; | ||
|
||
internal record SourceControlInfo(string RepositoryUrl, string Revision); |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.