Skip to content

Commit 4686fca

Browse files
initial commit
1 parent 1981f92 commit 4686fca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+4764
-1
lines changed

.appveyor.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
image: Visual Studio 2019
2+
init:
3+
- git config --global core.autocrlf input
4+
build_script:
5+
- cmd: choco install dotnetcore-sdk --version=3.1.102
6+
- ps: .\build.ps1
7+
test: off
8+
after_build:
9+
- "SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH%"
10+
- pip install codecov
11+
- codecov -f "./coverage/solution.cobertura"
12+
artifacts:
13+
- path: ./artifacts/nuget/*.nupkg
14+
cache:
15+
- tools -> build.cake, tools/packages.config
16+
nuget:
17+
project_feed: true

.build/.build.csproj

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
7+
<RootNamespace></RootNamespace>
8+
<IsPackable>False</IsPackable>
9+
<NoWarn>CS0649;CS0169</NoWarn>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="Nuke.Common" />
14+
<PackageReference Include="JetBrains.ReSharper.CommandLineTools" ExcludeAssets="All" />
15+
<PackageReference Include="GitVersion.Tool" ExcludeAssets="All" />
16+
<PackageReference Include="ReportGenerator" ExcludeAssets="All" />
17+
<PackageReference Include="JetBrains.ReSharper.CommandLineTools" ExcludeAssets="All" />
18+
<PackageReference Include="Rocket.Surgery.Nuke" />
19+
</ItemGroup>
20+
21+
<ItemGroup>
22+
<NukeSpecificationFiles Include="**\*.json" Exclude="bin\**;obj\**" />
23+
<NukeExternalFiles Include="**\*.*.ext" Exclude="bin\**;obj\**" />
24+
<None Remove="*.csproj.DotSettings;*.ref.*.txt" />
25+
</ItemGroup>
26+
27+
</Project>

.build/Build.CI.cs

+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
using Nuke.Common.CI.GitHubActions;
4+
using Rocket.Surgery.Nuke;
5+
using Rocket.Surgery.Nuke.ContinuousIntegration;
6+
using Rocket.Surgery.Nuke.DotNetCore;
7+
using Rocket.Surgery.Nuke.GithubActions;
8+
9+
[AzurePipelinesSteps(
10+
AutoGenerate = false,
11+
InvokeTargets = new[] { nameof(Default) },
12+
NonEntryTargets = new[]
13+
{
14+
nameof(ICIEnvironment.CIEnvironment),
15+
nameof(ITriggerCodeCoverageReports.Trigger_Code_Coverage_Reports),
16+
nameof(ITriggerCodeCoverageReports.Generate_Code_Coverage_Report_Cobertura),
17+
nameof(IGenerateCodeCoverageBadges.Generate_Code_Coverage_Badges),
18+
nameof(IGenerateCodeCoverageReport.Generate_Code_Coverage_Report),
19+
nameof(IGenerateCodeCoverageSummary.Generate_Code_Coverage_Summary),
20+
nameof(Default)
21+
},
22+
ExcludedTargets = new[]
23+
{ nameof(ICanClean.Clean), nameof(ICanRestoreWithDotNetCore.Restore), nameof(ICanRestoreWithDotNetCore.DotnetToolRestore) },
24+
Parameters = new[]
25+
{
26+
nameof(IHaveCodeCoverage.CoverageDirectory), nameof(IHaveOutputArtifacts.ArtifactsDirectory), nameof(Verbosity),
27+
nameof(IHaveConfiguration.Configuration)
28+
}
29+
)]
30+
[GitHubActionsSteps("ci", GitHubActionsImage.MacOsLatest, GitHubActionsImage.WindowsLatest, GitHubActionsImage.UbuntuLatest,
31+
AutoGenerate = false,
32+
On = new[] { GitHubActionsTrigger.Push },
33+
OnPushTags = new[] { "v*" },
34+
OnPushBranches = new[] { "master", "next" },
35+
OnPullRequestBranches = new[] { "master", "next" },
36+
InvokedTargets = new[] { nameof(Default) },
37+
NonEntryTargets = new[]
38+
{
39+
nameof(ICIEnvironment.CIEnvironment),
40+
nameof(ITriggerCodeCoverageReports.Trigger_Code_Coverage_Reports),
41+
nameof(ITriggerCodeCoverageReports.Generate_Code_Coverage_Report_Cobertura),
42+
nameof(IGenerateCodeCoverageBadges.Generate_Code_Coverage_Badges),
43+
nameof(IGenerateCodeCoverageReport.Generate_Code_Coverage_Report),
44+
nameof(IGenerateCodeCoverageSummary.Generate_Code_Coverage_Summary),
45+
nameof(Default)
46+
},
47+
ExcludedTargets = new[] { nameof(ICanClean.Clean), nameof(ICanRestoreWithDotNetCore.DotnetToolRestore) },
48+
Enhancements = new[] { nameof(Middleware) }
49+
)]
50+
[PrintBuildVersion, PrintCIEnvironment, UploadLogs]
51+
public partial class Solution
52+
{
53+
public static RocketSurgeonGitHubActionsConfiguration Middleware(RocketSurgeonGitHubActionsConfiguration configuration)
54+
{
55+
var buildJob = configuration.Jobs.First(z => z.Name == "Build");
56+
var checkoutStep = buildJob.Steps.OfType<CheckoutStep>().Single();
57+
// For fetch all
58+
checkoutStep.FetchDepth = 0;
59+
buildJob.Steps.InsertRange(buildJob.Steps.IndexOf(checkoutStep) + 1, new BaseGitHubActionsStep[] {
60+
new RunStep("Fetch all history for all tags and branches") {
61+
Run = "git fetch --prune"
62+
},
63+
new SetupDotNetStep("Use .NET Core 2.1 SDK") {
64+
DotNetVersion = "2.1.x"
65+
},
66+
new SetupDotNetStep("Use .NET Core 3.1 SDK") {
67+
DotNetVersion = "3.1.x"
68+
},
69+
new RunStep("🪓 **DOTNET HACK** 🪓") {
70+
Shell = GithubActionShell.Pwsh,
71+
Run = @"$version = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Leaf;
72+
$root = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Parent;
73+
$directories = Get-ChildItem $root | Where-Object { $_.Name -ne $version };
74+
foreach ($dir in $directories) {
75+
$from = $dir.FullName;
76+
$to = ""$root/$version"";
77+
Write-Host Copying from $from to $to;
78+
Copy-Item ""$from\*"" $to -Recurse -Force;
79+
}
80+
"
81+
},
82+
});
83+
84+
buildJob.Steps.Add(new UsingStep("Publish Coverage")
85+
{
86+
Uses = "codecov/codecov-action@v1",
87+
With = new Dictionary<string, string>
88+
{
89+
["name"] = "actions-${{ matrix.os }}",
90+
["fail_ci_if_error"] = "true",
91+
}
92+
});
93+
94+
buildJob.Steps.Add(new UploadArtifactStep("Publish logs")
95+
{
96+
Name = "logs",
97+
Path = "artifacts/logs/",
98+
If = "always()"
99+
});
100+
101+
buildJob.Steps.Add(new UploadArtifactStep("Publish coverage data")
102+
{
103+
Name = "coverage",
104+
Path = "coverage/",
105+
If = "always()"
106+
});
107+
108+
buildJob.Steps.Add(new UploadArtifactStep("Publish test data")
109+
{
110+
Name = "test data",
111+
Path = "artifacts/test/",
112+
If = "always()"
113+
});
114+
115+
buildJob.Steps.Add(new UploadArtifactStep("Publish NuGet Packages")
116+
{
117+
Name = "nuget",
118+
Path = "artifacts/nuget/",
119+
If = "always()"
120+
});
121+
122+
123+
/*
124+
125+
- publish: "${{ parameters.Artifacts }}/logs/"
126+
displayName: Publish Logs
127+
artifact: "Logs${{ parameters.Postfix }}"
128+
condition: always()
129+
130+
- publish: ${{ parameters.Coverage }}
131+
displayName: Publish Coverage
132+
artifact: "Coverage${{ parameters.Postfix }}"
133+
condition: always()
134+
135+
- publish: "${{ parameters.Artifacts }}/nuget/"
136+
displayName: Publish NuGet Artifacts
137+
artifact: "NuGet${{ parameters.Postfix }}"
138+
condition: always()
139+
*/
140+
return configuration;
141+
}
142+
}

.build/Build.cs

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
using JetBrains.Annotations;
2+
using Nuke.Common;
3+
using Nuke.Common.Execution;
4+
using Nuke.Common.Git;
5+
using Nuke.Common.Tools.DotNet;
6+
using Nuke.Common.Tools.GitVersion;
7+
using Nuke.Common.Tools.MSBuild;
8+
using Rocket.Surgery.Nuke;
9+
using Rocket.Surgery.Nuke.DotNetCore;
10+
11+
[PublicAPI]
12+
[CheckBuildProjectConfigurations]
13+
[UnsetVisualStudioEnvironmentVariables]
14+
[PackageIcon("https://raw.githubusercontent.com/RocketSurgeonsGuild/graphics/master/png/social-square-thrust-rounded.png")]
15+
[EnsureGitHooks(GitHook.PreCommit)]
16+
[DotNetVerbosityMapping]
17+
[MSBuildVerbosityMapping]
18+
[NuGetVerbosityMapping]
19+
public partial class Solution : NukeBuild,
20+
ICanRestoreWithDotNetCore,
21+
ICanBuildWithDotNetCore,
22+
ICanTestWithDotNetCore,
23+
ICanPackWithDotNetCore,
24+
IHaveDataCollector,
25+
ICanClean,
26+
ICanUpdateReadme,
27+
IGenerateCodeCoverageReport,
28+
IGenerateCodeCoverageSummary,
29+
IGenerateCodeCoverageBadges,
30+
IHaveConfiguration<Configuration>,
31+
ICanLint
32+
{
33+
/// <summary>
34+
/// Support plugins are available for:
35+
/// - JetBrains ReSharper https://nuke.build/resharper
36+
/// - JetBrains Rider https://nuke.build/rider
37+
/// - Microsoft VisualStudio https://nuke.build/visualstudio
38+
/// - Microsoft VSCode https://nuke.build/vscode
39+
/// </summary>
40+
public static int Main() => Execute<Solution>(x => x.Default);
41+
42+
[OptionalGitRepository]
43+
public GitRepository? GitRepository { get; }
44+
45+
private Target Default => _ => _
46+
.DependsOn(Restore)
47+
.DependsOn(Build)
48+
.DependsOn(Test)
49+
.DependsOn(Pack);
50+
51+
public Target Build => _ => _.Inherit<ICanBuildWithDotNetCore>(x => x.CoreBuild);
52+
53+
public Target Pack => _ => _.Inherit<ICanPackWithDotNetCore>(x => x.CorePack)
54+
.DependsOn(Clean);
55+
56+
[ComputedGitVersion]
57+
public GitVersion GitVersion { get; } = null!;
58+
59+
public Target Clean => _ => _.Inherit<ICanClean>(x => x.Clean);
60+
public Target Restore => _ => _.Inherit<ICanRestoreWithDotNetCore>(x => x.CoreRestore);
61+
public Target Test => _ => _.Inherit<ICanTestWithDotNetCore>(x => x.CoreTest);
62+
63+
public Target BuildVersion => _ => _.Inherit<IHaveBuildVersion>(x => x.BuildVersion)
64+
.Before(Default)
65+
.Before(Clean);
66+
67+
[Parameter("Configuration to build")]
68+
public Configuration Configuration { get; } = IsLocalBuild ? Configuration.Debug : Configuration.Release;
69+
}

.build/Configuration.cs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System.ComponentModel;
2+
using Nuke.Common.Tooling;
3+
4+
[TypeConverter(typeof(TypeConverter<Configuration>))]
5+
public class Configuration : Enumeration
6+
{
7+
public static readonly Configuration Debug = new Configuration { Value = nameof(Debug) };
8+
public static readonly Configuration Release = new Configuration { Value = nameof(Release) };
9+
10+
public static implicit operator string(Configuration configuration) => configuration.Value;
11+
}

.codecov.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
codecov:
2+
require_ci_to_pass: no
3+
bot: rsg-bot
4+
strict_yaml_branch: master
5+
6+
coverage:
7+
round: down
8+
precision: 2
9+
10+
status:
11+
project: yes
12+
patch: yes
13+
changes: no
14+
15+
comment:
16+
branch: master

.config/dotnet-tools.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"dotnet-outdated": {
6+
"version": "2.11.0",
7+
"commands": ["dotnet-outdated"]
8+
},
9+
"gitversion.tool": {
10+
"version": "5.3.5",
11+
"commands": ["dotnet-gitversion"]
12+
},
13+
"dotnet-reportgenerator-globaltool": {
14+
"version": "4.6.1",
15+
"commands": ["reportgenerator"]
16+
},
17+
"nuke.globaltool": {
18+
"version": "0.24.11",
19+
"commands": ["nuke"]
20+
},
21+
"codecov.tool": {
22+
"version": "1.11.1",
23+
"commands": ["codecov"]
24+
}
25+
}
26+
}

.dependabot/config.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
version: 1
2+
update_configs:
3+
- package_manager: 'dotnet:nuget'
4+
directory: '/'
5+
update_schedule: 'live'
6+
target_branch: master
7+
default_labels:
8+
- ':package: dependencies'
9+
default_assignees:
10+
- 'david-driscoll'
11+
# default_reviewers:
12+
# - "david-driscoll"
13+
automerged_updates:
14+
- match:
15+
dependency_name: 'Rocket.Surgery.*'
16+
update_type: 'semver:minor'
17+
- match:
18+
dependency_name: 'JetBrains.ReSharper.CommandLineTools'
19+
update_type: 'all'
20+
- match:
21+
dependency_name: 'System.Reactive.*'
22+
update_type: 'semver:minor'
23+
- match:
24+
dependency_name: 'System.Interactive.*'
25+
update_type: 'semver:minor'
26+
- match:
27+
dependency_name: System.Diagnostics.*
28+
update_type: 'semver:minor'
29+
- match:
30+
dependency_name: 'Microsoft.NET.Test.Sdk'
31+
update_type: 'all'
32+
- match:
33+
dependency_name: 'Moq'
34+
update_type: 'all'
35+
- match:
36+
dependency_name: 'Nuke.Common'
37+
update_type: 'all'
38+
- match:
39+
dependency_name: 'Bogus'
40+
update_type: 'all'
41+
- match:
42+
dependency_name: 'FakeItEasy.*'
43+
update_type: 'all'
44+
- match:
45+
dependency_name: 'coverlet.*'
46+
update_type: 'all'
47+
- match:
48+
dependency_name: 'FluentAssertions.*'
49+
update_type: 'all'
50+
- match:
51+
dependency_name: 'GitVersion.Tool'
52+
update_type: 'all'
53+
- match:
54+
dependency_name: 'ReportGenerator'
55+
update_type: 'semver:minor'
56+
ignored_updates:
57+
- match:
58+
dependency_name: Microsoft.Extensions.*
59+
- match:
60+
dependency_name: Microsoft.AspNetCore.*

0 commit comments

Comments
 (0)