-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved from MSBuild to Collector Made a util which copies the report from some strange folder into the root And now it sends normally this report to codecov
- Loading branch information
1 parent
b31f1cc
commit 11e738f
Showing
6 changed files
with
91 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Utils | ||
{ | ||
public static class CopyCovReport | ||
{ | ||
private static void Log(string msg) | ||
{ | ||
Console.WriteLine("CopyCovReport: " + msg); | ||
} | ||
|
||
public static void Do() | ||
{ | ||
Log("We are in " + Path.GetFullPath("./")); | ||
var sources = Path.GetFullPath(Program.GetPathIntoSources()); | ||
Log("Sources are " + sources); | ||
|
||
var root = Path.Join(sources, "Tests", "UnitTests"); | ||
var testResults = Path.Join(root, "TestResults"); | ||
Log("Path to take results from: " + Path.GetFullPath(testResults)); | ||
|
||
|
||
var dirList = Directory.GetDirectories(testResults); | ||
if (!dirList.Any()) | ||
throw new Exception("No directory found"); | ||
if (dirList.Count() > 1) | ||
throw new Exception($"More than one directory found: {string.Join(", ", dirList)}"); | ||
var dir = dirList.First(); | ||
Log("Found dir: " + Path.GetFullPath(dir)); | ||
|
||
|
||
var fileList = Directory.GetFiles(dir); | ||
if (!fileList.Any()) | ||
throw new Exception("No report found"); | ||
if (fileList.Count() > 1) | ||
throw new Exception($"More than one report found: {string.Join(", ", fileList)}"); | ||
var file = fileList.First(); | ||
Log("Found file: " + Path.GetFullPath(file)); | ||
|
||
var fileName = Path.GetFileName(file); | ||
var destination = Path.Join(root, fileName); | ||
if (File.Exists(destination)) | ||
{ | ||
File.Delete(destination); | ||
Log("The file was deleted: " + Path.GetFullPath(destination)); | ||
} | ||
|
||
|
||
var source = file; | ||
File.Copy(source, destination); | ||
Log($"Copied from {Path.GetFullPath(source)} to {Path.GetFullPath(destination)}"); | ||
} | ||
} | ||
} |