Skip to content

Commit e75b2f3

Browse files
committed
Upgrade build script to Cake 1.1.0
1 parent 18b6a96 commit e75b2f3

8 files changed

Lines changed: 57 additions & 299 deletions

File tree

.config/dotnet-tools.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"cake.tool": {
6+
"version": "1.1.0",
7+
"commands": [
8+
"dotnet-cake"
9+
]
10+
}
11+
}
12+
}

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ mono_crash.*
2727
[Rr]eleases/
2828
x64/
2929
x86/
30+
[Ww][Ii][Nn]32/
3031
[Aa][Rr][Mm]/
3132
[Aa][Rr][Mm]64/
3233
bld/
@@ -65,6 +66,9 @@ project.lock.json
6566
project.fragment.lock.json
6667
artifacts/
6768

69+
# ASP.NET Scaffolding
70+
ScaffoldingReadMe.txt
71+
6872
# StyleCop
6973
StyleCopReport.xml
7074

@@ -315,7 +319,7 @@ __pycache__/
315319

316320
# Cake
317321
tools/**
318-
!tools/packages.config
322+
BuildArtifacts/
319323

320324
# Tabs Studio
321325
*.tss
@@ -356,6 +360,9 @@ MigrationBackup/
356360
# Ionide (cross platform F# VS Code tools) working folder
357361
.ionide/
358362

363+
# Fody - auto-generated XML schema
364+
FodyWeavers.xsd
365+
359366
# WinMerge
360367
*.bak
361368

GitVersion.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
mode: ContinuousDelivery
22
branches:
3+
master:
4+
regex: (master|main)
5+
mode: ContinuousDelivery
6+
tag:
7+
increment: Patch
8+
prevent-increment-of-merged-branch-version: true
9+
track-merge-target: false
310
feature:
411
regex: feature(s)?[/-]
512
mode: ContinuousDeployment

appveyor.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ init:
44

55
# Build script
66
build_script:
7-
- ps: .\build.ps1 -Target AppVeyor
7+
- dotnet --info
8+
- ps: .\build.ps1 --target=AppVeyor
89

910
# Tests
1011
test: off
@@ -20,7 +21,7 @@ branches:
2021

2122
# Build cache
2223
cache:
23-
- tools -> build.cake, tools\packages.config
24+
- tools -> build.cake
2425

2526
# Environment configuration
2627
image: Visual Studio 2019

build.cake

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Install tools.
2-
#tool nuget:?package=GitVersion.CommandLine&version=5.6.0
2+
#tool nuget:?package=GitVersion.CommandLine&version=5.6.6
33
#tool nuget:?package=GitReleaseManager&version=0.11.0
44
#tool nuget:?package=OpenCover&version=4.7.922
5-
#tool nuget:?package=ReportGenerator&version=4.8.4
5+
#tool nuget:?package=ReportGenerator&version=4.8.7
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=0.10.2
10+
#addin nuget:?package=Cake.Coveralls&version=1.0.0
1111

1212

1313
///////////////////////////////////////////////////////////////////////////////
@@ -52,7 +52,7 @@ var versionInfo = GitVersion(new GitVersionSettings() { OutputType = GitVersionO
5252
var milestone = versionInfo.MajorMinorPatch;
5353
var cakeVersion = typeof(ICakeContext).Assembly.GetName().Version.ToString();
5454
var isLocalBuild = BuildSystem.IsLocalBuild;
55-
var isMainBranch = StringComparer.OrdinalIgnoreCase.Equals("master", BuildSystem.AppVeyor.Environment.Repository.Branch);
55+
var isMainBranch = StringComparer.OrdinalIgnoreCase.Equals("main", BuildSystem.AppVeyor.Environment.Repository.Branch);
5656
var isMainRepo = StringComparer.OrdinalIgnoreCase.Equals($"{gitHubRepoOwner}/{gitHubRepo}", BuildSystem.AppVeyor.Environment.Repository.Name);
5757
var isPullRequest = BuildSystem.AppVeyor.Environment.PullRequest.IsPullRequest;
5858
var isTagged = (
@@ -230,7 +230,7 @@ Task("Generate-Code-Coverage-Report")
230230
.Does(() =>
231231
{
232232
ReportGenerator(
233-
$"{codeCoverageDir}coverage.xml",
233+
new FilePath($"{codeCoverageDir}coverage.xml"),
234234
codeCoverageDir,
235235
new ReportGeneratorSettings() {
236236
ClassFilters = new[] { "*.UnitTests*" }
@@ -332,20 +332,15 @@ Task("Create-Release-Notes")
332332
Name = milestone,
333333
Milestone = milestone,
334334
Prerelease = false,
335-
TargetCommitish = "master"
335+
TargetCommitish = "main"
336336
};
337337

338-
if (!string.IsNullOrEmpty(gitHubToken))
338+
if (string.IsNullOrEmpty(gitHubToken))
339339
{
340-
GitReleaseManagerCreate(gitHubToken, gitHubRepoOwner, gitHubRepo, settings);
340+
throw new InvalidOperationException("GitHub token was not provided.");
341341
}
342-
else
343-
{
344-
if(string.IsNullOrEmpty(gitHubUserName)) throw new InvalidOperationException("Could not resolve GitHub user name.");
345-
if(string.IsNullOrEmpty(gitHubPassword)) throw new InvalidOperationException("Could not resolve GitHub password.");
346342

347-
GitReleaseManagerCreate(gitHubUserName, gitHubPassword, gitHubRepoOwner, gitHubRepo, settings);
348-
}
343+
GitReleaseManagerCreate(gitHubToken, gitHubRepoOwner, gitHubRepo, settings);
349344
});
350345

351346
Task("Publish-GitHub-Release")
@@ -356,17 +351,12 @@ Task("Publish-GitHub-Release")
356351
.WithCriteria(() => isTagged)
357352
.Does(() =>
358353
{
359-
if (!string.IsNullOrEmpty(gitHubToken))
354+
if (string.IsNullOrEmpty(gitHubToken))
360355
{
361-
GitReleaseManagerClose(gitHubToken, gitHubRepoOwner, gitHubRepo, milestone);
356+
throw new InvalidOperationException("GitHub token was not provided.");
362357
}
363-
else
364-
{
365-
if(string.IsNullOrEmpty(gitHubUserName)) throw new InvalidOperationException("Could not resolve GitHub user name.");
366-
if(string.IsNullOrEmpty(gitHubPassword)) throw new InvalidOperationException("Could not resolve GitHub password.");
367358

368-
GitReleaseManagerClose(gitHubUserName, gitHubPassword, gitHubRepoOwner, gitHubRepo, milestone);
369-
}
359+
GitReleaseManagerClose(gitHubToken, gitHubRepoOwner, gitHubRepo, milestone);
370360
});
371361

372362
Task("Generate-Benchmark-Report")

0 commit comments

Comments
 (0)