Skip to content

Commit 0af832e

Browse files
committed
Migrate build and versioning to Cake and GitVersioning
The same as the main stubble project
1 parent 1377ac5 commit 0af832e

25 files changed

+674
-120
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,7 @@ FakesAssemblies/
197197
*.opt
198198

199199
#DotNetCore
200-
project.lock.json
200+
project.lock.json
201+
tools/*
202+
coverage-results/*
203+
coverage-report/*

.travis.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# See http://docs.travis-ci.com/user/languages/csharp/ for details
2+
3+
language: csharp
4+
sudo: required
5+
dist: trusty
6+
mono: latest
7+
env:
8+
- CLI_VERSION=latest
9+
git:
10+
depth: 9999999
11+
12+
addons:
13+
apt:
14+
packages:
15+
- gettext
16+
- libcurl4-openssl-dev
17+
- libicu-dev
18+
- libssl-dev
19+
- libunwind8
20+
21+
install:
22+
- export DOTNET_INSTALL_DIR="$PWD/.dotnetcli"
23+
- curl -sSL https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.sh | bash /dev/stdin --version "$CLI_VERSION" --install-dir "$DOTNET_INSTALL_DIR"
24+
- export PATH="$DOTNET_INSTALL_DIR:$PATH"
25+
26+
script:
27+
- ./build.sh --target Travis -- -runCoverage=false -framework="netstandard1.3" -testFramework="netcoreapp1.1"
39.5 KB
Binary file not shown.

OpenCover-Experimental/Autofac.dll

199 KB
Binary file not shown.
107 KB
Binary file not shown.
83 KB
Binary file not shown.
Binary file not shown.
45 KB
Binary file not shown.
78.5 KB
Binary file not shown.

OpenCover-Experimental/Mono.Cecil.dll

359 KB
Binary file not shown.
77.5 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<configSections>
4+
<section name="autofac" type="Autofac.Configuration.SectionHandler, Autofac.Configuration"/>
5+
</configSections>
6+
<autofac>
7+
<modules>
8+
<module type="OpenCover.Extensions.RegisterStrategiesModule, OpenCover.Extensions"/>
9+
</modules>
10+
</autofac>
11+
<startup>
12+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
13+
</startup>
14+
<runtime>
15+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
16+
<dependentAssembly>
17+
<assemblyIdentity name="Mono.Cecil" publicKeyToken="0738eb9f132ed756" culture="neutral"/>
18+
<bindingRedirect oldVersion="0.0.0.0-0.9.6.0" newVersion="0.9.6.0"/>
19+
</dependentAssembly>
20+
<dependentAssembly>
21+
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral"/>
22+
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0"/>
23+
</dependentAssembly>
24+
</assemblyBinding>
25+
</runtime>
26+
</configuration>
11.5 KB
Binary file not shown.
146 KB
Binary file not shown.

OpenCover-Experimental/log4net.config

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<configSections>
4+
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
5+
</configSections>
6+
7+
<log4net>
8+
<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
9+
<mapping>
10+
<level value="ERROR" />
11+
<foreColor value="White" />
12+
<backColor value="Red, HighIntensity" />
13+
</mapping>
14+
<mapping>
15+
<level value="DEBUG" />
16+
<backColor value="Green" />
17+
</mapping>
18+
<layout type="log4net.Layout.PatternLayout">
19+
<conversionPattern value="%message%newline" />
20+
</layout>
21+
</appender>
22+
<appender name="OutputDebugStringAppender" type="log4net.Appender.OutputDebugStringAppender">
23+
<layout type="log4net.Layout.PatternLayout">
24+
<conversionPattern value="OpenCover: (Host) %message" />
25+
</layout>
26+
</appender>
27+
28+
<logger name="DebugLogger" additivity="false">
29+
<level value="ALL" />
30+
<appender-ref ref="OutputDebugStringAppender" />
31+
</logger>
32+
33+
<root>
34+
<appender-ref ref="ColoredConsoleAppender" />
35+
</root>
36+
37+
</log4net>
38+
39+
</configuration>

OpenCover-Experimental/log4net.dll

298 KB
Binary file not shown.

appveyor.yml

+6-37
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,19 @@
1-
version: 1.0.{build}
1+
version: 1.0.1000000.{build}
2+
image: Visual Studio 2017
23
configuration: Release
34
platform: Any CPU
45
environment:
56
COVERALLS_REPO_TOKEN:
67
secure: 4GEc9+zwnC3QqpeTKzuVgzODZWveBtiB3j9X1fe+H8IWeRyEtG47BKAV0j6ne69p
78
install:
89
- ps: >-
9-
$project = Get-Content ./src/Stubble.Extensions.Loaders/project.json -Raw | ConvertFrom-Json;
10-
$version = Get-Content ./src/Stubble.Extensions.Loaders/version.json -Raw | ConvertFrom-Json;
11-
$ci_version = $project.version.Split('-')[0] + "." + $env:APPVEYOR_BUILD_NUMBER;
12-
Update-AppveyorBuild -Version $ci_version;
13-
if($version.packagePostfix) {
14-
$env:verion_suffix=$version.packagePostfix;
15-
}
1610
dotnet --info
17-
before_build:
18-
- ps: dotnet restore .\src\Stubble.Extensions.Loaders\
19-
- ps: dotnet restore .\test\Stubble.Extensions.Loaders.Tests\
2011
build_script:
21-
- ps: dotnet --verbose build .\src\Stubble.Extensions.Loaders\ -c Release
22-
after_test:
23-
- ps: >-
24-
if($env:verion_suffix) {
25-
dotnet --verbose pack .\src\Stubble.Extensions.Loaders\ -o .\out --version-suffix $env:verion_suffix
26-
} else {
27-
dotnet --verbose pack .\src\Stubble.Extensions.Loaders\ -o .\out
28-
}
29-
test_script:
30-
- ps: >-
31-
$Package_Locations = $env:USERPROFILE + "\.nuget\packages";
32-
$OpenCover_Location = Get-ChildItem ($Package_Locations + "\OpenCover*\*\tools") | Select-Object -First 1 -ExpandProperty FullName;
33-
$CoverallsNet_Location = Get-ChildItem ($Package_Locations + "\coveralls.net\*\tools") | Select-Object -First 1 -ExpandProperty FullName;
34-
35-
Push-Location .\test\Stubble.Extensions.Loaders.Tests\
36-
37-
$openCoverExe = "$OpenCover_Location\OpenCover.Console.exe -register:user -target:""dotnet.exe"" ""-targetargs:test --framework netcoreapp1.0 -appveyor"" -filter:""+[Stubble.*]*"" -skipautoprops -output:coverage.xml";
38-
$coverallsExe = "$CoverallsNet_Location\csmacnz.Coveralls.exe --opencover -i coverage.xml --repoToken $env:COVERALLS_REPO_TOKEN --commitId $env:APPVEYOR_REPO_COMMIT --commitBranch $env:APPVEYOR_REPO_BRANCH --commitAuthor $env:APPVEYOR_REPO_COMMIT_AUTHOR --commitEmail $env:APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL --commitMessage ""$env:APPVEYOR_REPO_COMMIT_MESSAGE"" --jobId $env:APPVEYOR_JOB_ID";
39-
40-
iex $openCoverExe;
41-
Write-Host "Running Coveralls";
42-
iex $coverallsExe;
43-
44-
Pop-Location;
12+
- ps: .\build.ps1 -Target Appveyor
4513
artifacts:
46-
- path: .\out\*.nupkg
47-
- path: .\test\Stubble.Extensions.Loaders.Tests\coverage.xml
14+
- path: .\artifacts\*.nupkg
15+
- path: .\coverage-results\*
16+
test: off
4817
deploy:
4918
- provider: NuGet
5019
api_key:

build.cake

+166
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
#tool "nuget:?package=coveralls.net"
2+
#tool "nuget:https://nuget.org/api/v2/?package=ReportGenerator"
3+
4+
#addin "nuget:https://nuget.org/api/v2/?package=Cake.Coveralls"
5+
#addin "nuget:https://nuget.org/api/v2/?package=Cake.Incubator"
6+
7+
var target = Argument("target", "Default");
8+
var configuration = Argument("configuration", "Release");
9+
var testFramework = Argument("testFramework", "");
10+
var framework = Argument("framework", "");
11+
var runCoverage = Argument<bool>("runCoverage", true);
12+
13+
var buildDir = Directory("./src/Stubble.Extensions.Loaders/bin") + Directory(configuration);
14+
var testBuildDir = Directory("./test/Stubble.Extensions.Loaders.Tests/bin") + Directory(configuration);
15+
16+
var artifactsDir = Directory("./artifacts/");
17+
18+
Task("Clean")
19+
.Does(() =>
20+
{
21+
CleanDirectory(buildDir);
22+
CleanDirectory(testBuildDir);
23+
CleanDirectory("./artifacts");
24+
CleanDirectory("./coverage-results");
25+
CleanDirectory("./coverage-report");
26+
CleanDirectory("./test/Stubble.Extensions.Loaders.Tests/TestResults");
27+
});
28+
29+
Task("Restore")
30+
.IsDependentOn("Clean")
31+
.Does(() =>
32+
{
33+
if (AppVeyor.IsRunningOnAppVeyor) {
34+
DotNetCoreRestore("./src/Stubble.Extensions.Loaders/Stubble.Extensions.Loaders.csproj");
35+
DotNetCoreRestore("./test/Stubble.Extensions.Loaders.Tests/Stubble.Extensions.Loaders.Tests.csproj");
36+
} else {
37+
DotNetCoreRestore("./Stubble.Extensions.Loaders.sln");
38+
}
39+
});
40+
41+
Task("Build")
42+
.IsDependentOn("Clean")
43+
.IsDependentOn("Restore")
44+
.Does(() =>
45+
{
46+
var setting = new DotNetCoreBuildSettings {
47+
Configuration = configuration
48+
};
49+
50+
if(!string.IsNullOrEmpty(framework))
51+
{
52+
setting.Framework = framework;
53+
}
54+
55+
var testSetting = new DotNetCoreBuildSettings {
56+
Configuration = configuration
57+
};
58+
59+
if(!string.IsNullOrEmpty(testFramework))
60+
{
61+
testSetting.Framework = testFramework;
62+
}
63+
64+
DotNetCoreBuild("./src/Stubble.Extensions.Loaders/", setting);
65+
DotNetCoreBuild("./test/Stubble.Extensions.Loaders.Tests/", testSetting);
66+
});
67+
68+
Task("Test")
69+
.IsDependentOn("Build")
70+
.Does(() =>
71+
{
72+
Action<ICakeContext> testAction = tool => {
73+
tool.DotNetCoreTest("./test/Stubble.Extensions.Loaders.Tests/Stubble.Extensions.Loaders.Tests.csproj", new DotNetCoreTestSettings {
74+
Configuration = configuration,
75+
NoBuild = true,
76+
Verbose = false,
77+
Framework = testFramework,
78+
ArgumentCustomization = args =>
79+
args.Append("--logger:trx")
80+
});
81+
};
82+
83+
if(runCoverage || AppVeyor.IsRunningOnAppVeyor)
84+
{
85+
var path = new FilePath("./OpenCover-Experimental/OpenCover.Console.exe").MakeAbsolute(Context.Environment);
86+
87+
Information(path.ToString());
88+
89+
CreateDirectory("./coverage-results/");
90+
OpenCover(
91+
testAction,
92+
new FilePath(string.Format("./coverage-results/results.xml", DateTime.UtcNow)),
93+
new OpenCoverSettings {
94+
Register = "user",
95+
SkipAutoProps = true,
96+
OldStyle = true,
97+
ToolPath = path,
98+
ReturnTargetCodeOffset = 0
99+
}
100+
.WithFilter("-[Stubble.Extensions.Loaders.Tests]*")
101+
.WithFilter("+[Stubble.*]*")
102+
);
103+
104+
if (AppVeyor.IsRunningOnAppVeyor)
105+
{
106+
foreach(var file in GetFiles("./test/Stubble.Extensions.Loaders.Tests/TestResults/*"))
107+
{
108+
AppVeyor.UploadTestResults(file, AppVeyorTestResultsType.MSTest);
109+
AppVeyor.UploadArtifact(file);
110+
}
111+
}
112+
} else {
113+
testAction(Context);
114+
}
115+
});
116+
117+
Task("Pack")
118+
.IsDependentOn("Test")
119+
.Does(() =>
120+
{
121+
var settings = new DotNetCorePackSettings
122+
{
123+
OutputDirectory = artifactsDir,
124+
NoBuild = true,
125+
Configuration = configuration,
126+
};
127+
128+
DotNetCorePack("./src/Stubble.Extensions.Loaders/Stubble.Extensions.Loaders.csproj", settings);
129+
});
130+
131+
Task("Coveralls")
132+
.IsDependentOn("Pack")
133+
.Does(() =>
134+
{
135+
if (!AppVeyor.IsRunningOnAppVeyor) return;
136+
137+
var token = EnvironmentVariable("COVERALLS_REPO_TOKEN");
138+
139+
CoverallsNet("./coverage-results/results.xml", CoverallsNetReportType.OpenCover, new CoverallsNetSettings()
140+
{
141+
RepoToken = token,
142+
CommitId = EnvironmentVariable("APPVEYOR_REPO_COMMIT"),
143+
CommitBranch = EnvironmentVariable("APPVEYOR_REPO_BRANCH"),
144+
CommitAuthor = EnvironmentVariable("APPVEYOR_REPO_COMMIT_AUTHOR"),
145+
CommitEmail = EnvironmentVariable("APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL"),
146+
CommitMessage = EnvironmentVariable("APPVEYOR_REPO_COMMIT_MESSAGE")
147+
});
148+
});
149+
150+
Task("CoverageReport")
151+
.IsDependentOn("Test")
152+
.Does(() =>
153+
{
154+
ReportGenerator("./coverage-results/*.xml", "./coverage-report/");
155+
});
156+
157+
Task("AppVeyor")
158+
.IsDependentOn("Coveralls");
159+
160+
Task("Travis")
161+
.IsDependentOn("Test");
162+
163+
Task("Default")
164+
.IsDependentOn("Pack");
165+
166+
RunTarget(target);

0 commit comments

Comments
 (0)