Skip to content

Commit 9b6a152

Browse files
committed
Update resource files such as build script
1 parent fd3d463 commit 9b6a152

4 files changed

Lines changed: 101 additions & 9 deletions

File tree

.gitignore

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ StyleCopReport.xml
9494
*.tmp_proj
9595
*_wpftmp.csproj
9696
*.log
97+
*.tlog
9798
*.vspscc
9899
*.vssscc
99100
.builds
@@ -146,7 +147,9 @@ _TeamCity*
146147
!.axoCover/settings.json
147148

148149
# Coverlet is a free, cross platform Code Coverage Tool
149-
coverage*[.json, .xml, .info]
150+
coverage*.json
151+
coverage*.xml
152+
coverage*.info
150153

151154
# Visual Studio code coverage results
152155
*.coverage
@@ -207,6 +210,9 @@ PublishScripts/
207210
*.nuget.props
208211
*.nuget.targets
209212

213+
# Nuget personal access tokens and Credentials
214+
nuget.config
215+
210216
# Microsoft Azure Build Output
211217
csx/
212218
*.build.csdef
@@ -363,6 +369,31 @@ MigrationBackup/
363369
# Fody - auto-generated XML schema
364370
FodyWeavers.xsd
365371

372+
# VS Code files for those working on multiple tools
373+
.vscode/*
374+
!.vscode/settings.json
375+
!.vscode/tasks.json
376+
!.vscode/launch.json
377+
!.vscode/extensions.json
378+
*.code-workspace
379+
380+
# Local History for Visual Studio Code
381+
.history/
382+
383+
# Windows Installer files from build outputs
384+
*.cab
385+
*.msi
386+
*.msix
387+
*.msm
388+
*.msp
389+
390+
# JetBrains Rider
391+
.idea/
392+
*.sln.iml
393+
394+
### VisualStudio Patch ###
395+
# Additional files built by Visual Studio
396+
366397
# WinMerge
367398
*.bak
368399

build.cake

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
// Install tools.
22
#tool dotnet:?package=GitVersion.Tool&version=5.6.6
33
#tool nuget:?package=GitReleaseManager&version=0.11.0
4-
#tool nuget:?package=OpenCover&version=4.7.922
5-
#tool nuget:?package=ReportGenerator&version=4.8.7
4+
#tool nuget:?package=OpenCover&version=4.7.1221
5+
#tool nuget:?package=ReportGenerator&version=4.8.11
66
#tool nuget:?package=coveralls.io&version=1.4.2
77
#tool nuget:?package=xunit.runner.console&version=2.4.1
88

99
// Install addins.
10-
#addin nuget:?package=Cake.Coveralls&version=1.0.0
10+
#addin nuget:?package=Cake.Coveralls&version=1.1.0
11+
#addin nuget:?package=Cake.Git&version=1.0.1
1112

1213

1314
///////////////////////////////////////////////////////////////////////////////
@@ -17,6 +18,8 @@
1718
var target = Argument<string>("target", "Default");
1819
var configuration = Argument<string>("configuration", "Release");
1920

21+
if (IsRunningOnUnix()) target = "Run-Unit-Tests";
22+
2023

2124
///////////////////////////////////////////////////////////////////////////////
2225
// GLOBAL VARIABLES
@@ -45,6 +48,9 @@ var outputDir = "./artifacts/";
4548
var codeCoverageDir = $"{outputDir}CodeCoverage/";
4649
var benchmarkDir = $"{outputDir}Benchmark/";
4750

51+
var solutionFile = $"{sourceFolder}{libraryName}.sln";
52+
var sourceProject = $"{sourceFolder}{libraryName}/{libraryName}.csproj";
53+
var integrationTestsProject = $"{sourceFolder}{libraryName}.IntegrationTests/{libraryName}.IntegrationTests.csproj";
4854
var unitTestsProject = $"{sourceFolder}{libraryName}.UnitTests/{libraryName}.UnitTests.csproj";
4955
var benchmarkProject = $"{sourceFolder}{libraryName}.Benchmark/{libraryName}.Benchmark.csproj";
5056

@@ -116,10 +122,27 @@ Setup(context =>
116122
string.IsNullOrEmpty(gitHubPassword) ? "[NULL]" : new string('*', gitHubPassword.Length)
117123
);
118124
}
125+
126+
// Integration tests are intended to be used for debugging purposes and not intended to be executed in CI environment.
127+
// Also, the runner for these tests contains windows-specific code (such as resizing window, moving window to center of screen, etc.)
128+
// which can cause problems when attempting to run unit tests on an Ubuntu image on AppVeyor.
129+
if (!isLocalBuild)
130+
{
131+
Information("");
132+
Information("Removing integration tests");
133+
DotNetCoreTool(solutionFile, "sln", $"remove {integrationTestsProject.TrimStart(sourceFolder, StringComparison.OrdinalIgnoreCase)}");
134+
}
119135
});
120136

121137
Teardown(context =>
122138
{
139+
if (!isLocalBuild)
140+
{
141+
Information("Restoring integration tests");
142+
GitCheckout(".", new FilePath[] { solutionFile });
143+
Information("");
144+
}
145+
123146
// Executed AFTER the last task.
124147
Information("Finished running tasks.");
125148
});
@@ -174,7 +197,7 @@ Task("Build")
174197
.IsDependentOn("Restore-NuGet-Packages")
175198
.Does(() =>
176199
{
177-
DotNetCoreBuild($"{sourceFolder}{libraryName}.sln", new DotNetCoreBuildSettings
200+
DotNetCoreBuild(solutionFile, new DotNetCoreBuildSettings
178201
{
179202
Configuration = configuration,
180203
NoRestore = true,
@@ -220,6 +243,7 @@ Task("Run-Code-Coverage")
220243
});
221244

222245
Task("Upload-Coverage-Result")
246+
.IsDependentOn("Run-Code-Coverage")
223247
.Does(() =>
224248
{
225249
CoverallsIo($"{codeCoverageDir}coverage.xml");
@@ -265,7 +289,7 @@ Task("Create-NuGet-Package")
265289
}
266290
};
267291

268-
DotNetCorePack($"{sourceFolder}{libraryName}/{libraryName}.csproj", settings);
292+
DotNetCorePack(sourceProject, settings);
269293
});
270294

271295
Task("Upload-AppVeyor-Artifacts")
@@ -408,8 +432,11 @@ Task("Benchmark")
408432
.WithCriteria(isBenchmarkPresent)
409433
.Does(() =>
410434
{
411-
var htmlReport = GetFiles($"{benchmarkDir}results/*-report.html", new GlobberSettings { IsCaseSensitive = false }).FirstOrDefault();
412-
StartProcess("cmd", $"/c start {htmlReport}");
435+
var htmlReports = GetFiles($"{benchmarkDir}results/*-report.html", new GlobberSettings { IsCaseSensitive = false });
436+
foreach (var htmlReport in htmlReports)
437+
{
438+
StartProcess("cmd", $"/c start {htmlReport}");
439+
}
413440
});
414441

415442
Task("ReleaseNotes")
@@ -435,3 +462,25 @@ Task("Default")
435462
///////////////////////////////////////////////////////////////////////////////
436463

437464
RunTarget(target);
465+
466+
467+
468+
///////////////////////////////////////////////////////////////////////////////
469+
// PRIVATE METHODS
470+
///////////////////////////////////////////////////////////////////////////////
471+
private static string TrimStart(this string source, string value, StringComparison comparisonType)
472+
{
473+
if (source == null)
474+
{
475+
throw new ArgumentNullException(nameof(source));
476+
}
477+
478+
int valueLength = value.Length;
479+
int startIndex = 0;
480+
while (source.IndexOf(value, startIndex, comparisonType) == startIndex)
481+
{
482+
startIndex += valueLength;
483+
}
484+
485+
return source.Substring(startIndex);
486+
}

build.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
set -euox pipefail
3+
4+
cd "$(dirname "${BASH_SOURCE[0]}")"
5+
6+
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
7+
export DOTNET_CLI_TELEMETRY_OPTOUT=1
8+
export DOTNET_NOLOGO=1
9+
10+
dotnet tool restore
11+
12+
dotnet cake "$@"

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "5.0.200",
3+
"version": "5.0.202",
44
"rollForward": "latestFeature"
55
}
66
}

0 commit comments

Comments
 (0)