-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
1,525 additions
and
418 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const string SonarQubeTool = "#tool nuget:?package=MSBuild.SonarQube.Runner.Tool&version=4.6.0"; | ||
const string SonarQubeAddin = "#addin nuget:?package=Cake.Sonar&version=1.1.22"; | ||
|
||
Task("SonarCloud-Begin") | ||
.IsDependentOn("DotNetCore-Restore") | ||
.IsDependeeOf("DotNetCore-Build") | ||
.WithCriteria(() => HasEnvironmentVariable("SONARCLOUD_TOKEN"), "Missing sonar cloud token environment variable") | ||
.WithCriteria(() => HasEnvironmentVariable("SONARCLOUD_ORGANIZATION"), "Missing sonar cloud organization environment variable") | ||
.WithCriteria(() => HasEnvironmentVariable("SONARCLOUD_PROJECT_KEY"), "Missing sonar cloud project key environment variable") | ||
.Does(() => RequireTool(SonarQubeTool, | ||
() => | ||
{ | ||
Information("Starting SonarCloud analysing"); | ||
|
||
RequireAddin(SonarQubeAddin + @" | ||
SonarBegin(new SonarBeginSettings { | ||
Key = EnvironmentVariable(""TEMP_PROJECT_KEY""), | ||
Branch = EnvironmentVariable(""TEMP_BUILD_BRANCH""), | ||
Organization = EnvironmentVariable(""TEMP_ORGANIZATION""), | ||
Url = ""https://sonarcloud.io"", | ||
Exclusions = ""**/*.Tests,**/GlobalSuppressions.cs"", // Global suppresions is added to prevent sonar cloud to report suppressed warnings | ||
OpenCoverReportsPath = EnvironmentVariable(""TEMP_OPENCOVER_FILTER""), | ||
Login = EnvironmentVariable(""TEMP_TOKEN""), | ||
Version = EnvironmentVariable(""TEMP_VERSION""), | ||
XUnitReportsPath = EnvironmentVariable(""TEMP_TEST_RESULTS""), | ||
});", | ||
new Dictionary<string, string> { | ||
{ "TEMP_PROJECT_KEY", EnvironmentVariable("SONARCLOUD_PROJECT_KEY") }, | ||
{ "TEMP_BUILD_BRANCH", BuildParameters.BuildProvider.Repository.Branch }, | ||
{ "TEMP_ORGANIZATION", EnvironmentVariable("SONARCLOUD_ORGANIZATION") }, | ||
{ "TEMP_OPENCOVER_FILTER", BuildParameters.Paths.Files.TestCoverageOutputFilePath.ToString().Replace(".xml", "*.xml") }, | ||
{ "TEMP_TOKEN", EnvironmentVariable("SONARCLOUD_TOKEN") }, | ||
{ "TEMP_VERSION", BuildParameters.Version.SemVersion }, | ||
{ "TEMP_TEST_RESULTS", BuildParameters.Paths.Directories.TestResults.CombineWithFilePath("TestResults.xml").ToString() }, | ||
}); | ||
})); | ||
|
||
Task("SonarCloud-End") | ||
.IsDependentOn("Test") | ||
.IsDependeeOf("Analyze") | ||
.WithCriteria(() => HasEnvironmentVariable("SONARCLOUD_TOKEN"), "Missing sonar cloud token environment variable") | ||
.WithCriteria(() => HasEnvironmentVariable("SONARCLOUD_ORGANIZATION"), "Missing sonar cloud organization environment variable") | ||
.WithCriteria(() => HasEnvironmentVariable("SONARCLOUD_PROJECT_KEY"), "Missing sonar cloud project key environment variable") | ||
.Does(() => RequireTool(SonarQubeTool, () => RequireAddin(SonarQubeAddin + @" | ||
SonarEnd(new SonarEndSettings { | ||
Login = EnvironmentVariable(""TEMP_TOKEN""), | ||
});", | ||
new Dictionary<string, string> { | ||
{ "TEMP_TOKEN", EnvironmentVariable("SONARCLOUD_TOKEN") }, | ||
}) | ||
)); |
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,55 @@ | ||
((CakeTask)BuildParameters.Tasks.DotNetCoreTestTask.Task).Actions.Clear(); | ||
((CakeTask)BuildParameters.Tasks.DotNetCoreTestTask.Task).Criterias.Clear(); | ||
((CakeTask)BuildParameters.Tasks.DotNetCoreTestTask.Task).Dependencies.Clear(); | ||
|
||
BuildParameters.Tasks.DotNetCoreTestTask | ||
.IsDependentOn("Install-ReportGenerator") | ||
.Does(() => { | ||
var projects = GetFiles(BuildParameters.TestDirectoryPath + (BuildParameters.TestFilePattern ?? "/**/*Tests.csproj")); | ||
var testFileName = BuildParameters.Paths.Files.TestCoverageOutputFilePath.GetFilename(); | ||
var testDirectory = BuildParameters.Paths.Files.TestCoverageOutputFilePath.GetDirectory(); | ||
|
||
var settings = new CoverletSettings { | ||
CollectCoverage = true, | ||
CoverletOutputFormat = CoverletOutputFormat.opencover, | ||
CoverletOutputDirectory = testDirectory, | ||
CoverletOutputName = testFileName.ToString(), | ||
MergeWithFile = BuildParameters.Paths.Files.TestCoverageOutputFilePath | ||
}; | ||
foreach (var line in ToolSettings.TestCoverageExcludeByFile.Split(';')) { | ||
foreach (var file in GetFiles("**/" + line)) { | ||
settings = settings.WithFileExclusion(file.FullPath); | ||
} | ||
} | ||
|
||
foreach (var item in ToolSettings.TestCoverageFilter.Split(' ')) { | ||
if (item[0] == '+') { | ||
settings.WithInclusion(item.TrimStart('+')); | ||
} | ||
else if (item[0] == '-') { | ||
settings.WithFilter(item.TrimStart('-')); | ||
} | ||
} | ||
|
||
var testSettings = new DotNetCoreTestSettings { | ||
Configuration = BuildParameters.Configuration, | ||
NoBuild = true, | ||
Logger = "xunit", | ||
ResultsDirectory = BuildParameters.Paths.Directories.TestResults, | ||
ArgumentCustomization = (args) => args.AppendSwitch("--logger", ":", "appveyor") | ||
}; | ||
|
||
foreach (var project in projects) { | ||
DotNetCoreTest(project.FullPath, testSettings, settings); | ||
} | ||
|
||
var coverageFilter = BuildParameters.Paths.Files.TestCoverageOutputFilePath.ToString().Replace(".xml", "*.xml"); | ||
Information($"Finding coverage results with filer: {coverageFilter}"); | ||
|
||
var reportFiles = GetFiles(coverageFilter); | ||
Information($"Found {reportFiles.Count} files"); | ||
|
||
if (reportFiles.Any()) { | ||
ReportGenerator(reportFiles, BuildParameters.Paths.Directories.TestCoverage); | ||
} | ||
}); |
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,8 @@ | ||
version: "1" | ||
rules: | ||
- base: develop | ||
upstream: cake-contrib:develop | ||
mergeMethod: hardreset | ||
- base: master | ||
upstream: cake-contrib:master | ||
mergeMethod: hardreset |
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,4 @@ | ||
[submodule "cake-contrib-graphics"] | ||
path = graphics/cake-contrib | ||
url = https://github.com/cake-contrib/graphics.git | ||
branch = master |
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 |
---|---|---|
|
@@ -22,4 +22,4 @@ branches: | |
- /^dependabot\/.*/ | ||
|
||
script: | ||
- ./build.sh --target=Linux | ||
- ./build.sh --target=Unix |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
branches: {} | ||
ignore: | ||
sha: [ | ||
"64d1d306967d710a76b5e327d00b7c233d64f580", | ||
"ffa419b3524189b4fb4f667e1d7da253620f6348", | ||
"8d09bc60adbc44b3308f18fd8be3cf6f2655fdb0" | ||
"64d1d306967d710a76b5e327d00b7c233d64f580", | ||
"ffa419b3524189b4fb4f667e1d7da253620f6348", | ||
"8d09bc60adbc44b3308f18fd8be3cf6f2655fdb0", | ||
27d3730ea938369e6af7afd1cb5381694e9c99d6 , | ||
] |
Oops, something went wrong.