Skip to content

Switched to new central package versioning #817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 80 additions & 5 deletions .build/Solution.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,48 @@
using System.Collections.Generic;
using System.Linq;
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.CI.GitHubActions.Configuration;
using Rocket.Surgery.Nuke.ContinuousIntegration;
using Rocket.Surgery.Nuke.DotNetCore;
using Rocket.Surgery.Nuke.GithubActions;


internal class LocalConstants
{
public static string[] PathsIgnore =
{
".codecov.yml",
".editorconfig",
".gitattributes",
".gitignore",
".gitmodules",
".lintstagedrc.js",
".prettierignore",
".prettierrc",
"LICENSE",
"nukeeper.settings.json",
"omnisharp.json",
"package-lock.json",
"package.json",
"Readme.md",
".github/dependabot.yml",
".github/labels.yml",
".github/release.yml",
".github/renovate.json",
};
}

[GitHubActionsSteps(
"ci-ignore",
GitHubActionsImage.WindowsLatest,
GitHubActionsImage.UbuntuLatest,
AutoGenerate = false,
On = new[] { GitHubActionsTrigger.Push },
OnPushTags = new[] { "v*" },
OnPushBranches = new[] { "master", "main", "next" },
OnPullRequestBranches = new[] { "master", "main", "next" },
Enhancements = new[] { nameof(CiIgnoreMiddleware) }
)]
[GitHubActionsSteps(
"ci",
GitHubActionsImage.MacOsLatest,
Expand All @@ -27,24 +65,53 @@
nameof(Default)
},
ExcludedTargets = new[] { nameof(ICanClean.Clean), nameof(ICanRestoreWithDotNetCore.DotnetToolRestore) },
Enhancements = new[] { nameof(Middleware) }
Enhancements = new[] { nameof(CiMiddleware) }
)]
[PrintBuildVersion]
[PrintCIEnvironment]
[UploadLogs]
[TitleEvents]
public partial class Solution
{
public static RocketSurgeonGitHubActionsConfiguration Middleware(RocketSurgeonGitHubActionsConfiguration configuration)
public static RocketSurgeonGitHubActionsConfiguration CiIgnoreMiddleware(
RocketSurgeonGitHubActionsConfiguration configuration
)
{
foreach (var item in configuration.DetailedTriggers.OfType<RocketSurgeonGitHubActionsVcsTrigger>())
{
item.IncludePaths = LocalConstants.PathsIgnore;
}

configuration.Jobs.RemoveAt(1);
( (RocketSurgeonsGithubActionsJob)configuration.Jobs[0] ).Steps = new List<GitHubActionsStep>
{
new RunStep("N/A")
{
Run = "echo \"No build required\""
}
};

return configuration;
}

public static RocketSurgeonGitHubActionsConfiguration CiMiddleware(
RocketSurgeonGitHubActionsConfiguration configuration
)
{
foreach (var item in configuration.DetailedTriggers.OfType<RocketSurgeonGitHubActionsVcsTrigger>())
{
item.ExcludePaths = LocalConstants.PathsIgnore;
}

var buildJob = configuration.Jobs.OfType<RocketSurgeonsGithubActionsJob>().First(z => z.Name == "Build");
buildJob.FailFast = false;
var checkoutStep = buildJob.Steps.OfType<CheckoutStep>().Single();
// For fetch all
checkoutStep.FetchDepth = 0;
buildJob.Environment["NUGET_PACKAGES"] = "${{ github.workspace }}/.nuget/packages";
buildJob.Steps.InsertRange(
buildJob.Steps.IndexOf(checkoutStep) + 1, new BaseGitHubActionsStep[]
buildJob.Steps.IndexOf(checkoutStep) + 1,
new BaseGitHubActionsStep[]
{
new RunStep("Fetch all history for all tags and branches")
{
Expand All @@ -58,7 +125,7 @@ public static RocketSurgeonGitHubActionsConfiguration Middleware(RocketSurgeonGi
["path"] = "${{ github.workspace }}/.nuget/packages",
// keep in mind using central package versioning here
["key"] =
"${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Build.targets', '**/Directory.Build.props', '**/*.csproj') }}",
"${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}-${{ hashFiles('**/Directory.Packages.support.props') }}",
["restore-keys"] = @"|
${{ runner.os }}-nuget-"
}
Expand All @@ -81,7 +148,6 @@ public static RocketSurgeonGitHubActionsConfiguration Middleware(RocketSurgeonGi
With = new Dictionary<string, string>
{
["name"] = "actions-${{ matrix.os }}",
["fail_ci_if_error"] = "true",
}
}
);
Expand Down Expand Up @@ -122,6 +188,15 @@ public static RocketSurgeonGitHubActionsConfiguration Middleware(RocketSurgeonGi
}
);

buildJob.Steps.Add(
new UploadArtifactStep("Publish Docs")
{
Name = "docs",
Path = "artifacts/docs/",
If = "always()"
}
);

return configuration;
}
}
6 changes: 0 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1009,12 +1009,6 @@ resharper_web_config_type_not_resolved_highlighting = warning
resharper_web_config_wrong_module_highlighting = warning
resharper_partial_type_with_single_part_highlighting = none

# .NET Analzyer settings
# VSTHRD200: Use "Async" suffix for awaitable methods
dotnet_diagnostic.VSTHRD200.severity = none
# CA2007: Do not directly await a Task
dotnet_diagnostic.CA2007.severity = error

ij_xml_align_attributes = true
ij_xml_align_text = false
ij_xml_attribute_wrap = normal
Expand Down
28 changes: 0 additions & 28 deletions .github/dependabot.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .github/label-commenter-dependabot.yml

This file was deleted.

114 changes: 63 additions & 51 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,66 @@
- name: "bug"
color: "d73a4a"
- name: 'bug'
color: 'd73a4a'
description: "Something isn't working"
- name: "documentation"
- name: 'documentation'
color: 0075ca
description: "Improvements or additions to documentation"
- name: "duplicate"
color: "cfd3d7"
description: "This issue or pull request already exists"
- name: "enhancement"
color: "a2eeef"
description: "New feature or request"
- name: "help wanted"
color: "008672"
description: "Extra attention is needed"
- name: "good first issue"
color: "7057ff"
description: "Good for newcomers"
- name: "invalid"
color: "e4e669"
description: 'Improvements or additions to documentation'
- name: 'duplicate'
color: 'cfd3d7'
description: 'This issue or pull request already exists'
- name: 'enhancement'
color: 'a2eeef'
description: 'New feature or request'
- name: 'help wanted'
color: '008672'
description: 'Extra attention is needed'
- name: 'good first issue'
color: '7057ff'
description: 'Good for newcomers'
- name: 'invalid'
color: 'e4e669'
description: "This doesn't seem right"
- name: "question"
color: "d876e3"
description: "Further information is requested"
- name: "wontfix"
color: "ffffff"
description: "This will not be worked on"
- name: "feature"
color: "ccf5ff"
description: "This adds some form of new functionality"
- name: "breaking change"
color: "efa7ae"
description: "This breaks existing behavior"
- name: "mysterious"
color: "cccccc"
description: "We forgot to label this"
- name: "chore"
color: "27127c"
description: "Just keeping things neat and tidy"
- name: "dependencies"
color: "edc397"
description: "Pull requests that update a dependency file"
- name: "merge"
color: "98ed98"
description: "Shipit!"
- name: "deprecated"
color: "dd824d"
description: "Deprecated functionality"
- name: "removed"
color: "fce99f"
description: "Removed functionality"
- name: "security"
color: "cbce1e"
description: "Security related issue"
- name: 'question'
color: 'd876e3'
description: 'Further information is requested'
- name: 'wontfix'
color: 'ffffff'
description: 'This will not be worked on'
- name: 'feature'
color: 'ccf5ff'
description: 'This adds some form of new functionality'
- name: 'breaking change'
color: 'efa7ae'
description: 'This breaks existing behavior'
- name: 'mysterious'
color: 'cccccc'
description: 'We forgot to label this'
- name: 'chore'
color: '27127c'
description: 'Just keeping things neat and tidy'
- name: 'dependencies'
color: 'edc397'
description: 'Pull requests that update a dependency file'
- name: 'merge'
color: '98ed98'
description: 'Shipit!'
- name: 'deprecated'
color: 'dd824d'
description: 'Deprecated functionality'
- name: 'removed'
color: 'fce99f'
description: 'Removed functionality'
- name: 'security'
color: 'cbce1e'
description: 'Security related issue'
- name: 'private-dependencies'
color: 'edc397'
description: 'Private dependency'
- name: 'rebase'
color: 'ffcc66'
description: 'Rebase branch'
- name: 'stop updating'
color: '800000'
description: 'Stop Updating'
- name: 'blocked'
color: 'FF5600'
description: 'Issue is blocked waiting for something or someone'
Loading