From 144a511defe15cf8078a4cf6a28ae368e9e7b876 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 3 Feb 2025 22:46:11 -0800 Subject: [PATCH] Fix up #1336 - Mimic the style of the RSG/Nuke repo's .build - Regenerated GH actions - Left in the tweak around NuGet caching, the matrix of artifacts, and NuGet publishing --- .build/.build.csproj | 4 +- .build/{Solution.cs => Build.CI.cs} | 83 ++++------ .build/Build.cs | 58 +++---- .build/Configuration.cs | 6 +- .config/dotnet-tools.json | 107 ++++++++----- .github/workflows/ci-ignore.yml | 14 ++ .github/workflows/ci.yml | 99 ++++++++---- .github/workflows/close-milestone.yml | 99 ++++++++---- .github/workflows/draft-release.yml | 102 ++++++++---- .github/workflows/update-milestone.yml | 96 ++++++----- .gitignore | 4 +- .nuke/build.schema.json | 213 ++++++++++++------------- .nuke/parameters.json | 5 +- test/coverlet.runsettings | 128 +++++++++++++-- 14 files changed, 626 insertions(+), 392 deletions(-) rename .build/{Solution.cs => Build.CI.cs} (55%) diff --git a/.build/.build.csproj b/.build/.build.csproj index 859c216f5..343f8f5ec 100644 --- a/.build/.build.csproj +++ b/.build/.build.csproj @@ -4,11 +4,9 @@ Exe net8.0 false - + False CS0649;CS0169 - 1 - true diff --git a/.build/Solution.cs b/.build/Build.CI.cs similarity index 55% rename from .build/Solution.cs rename to .build/Build.CI.cs index 6bcbeab9a..3c53d7228 100644 --- a/.build/Solution.cs +++ b/.build/Build.CI.cs @@ -3,44 +3,21 @@ using Rocket.Surgery.Nuke.ContinuousIntegration; using Rocket.Surgery.Nuke.DotNetCore; using Rocket.Surgery.Nuke.GithubActions; +using Rocket.Surgery.Nuke.Jobs; -namespace Build; - -internal class LocalConstants -{ - public static string[] PathsIgnore => new[] - { - ".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", - }; -} +#pragma warning disable CA1050 [GitHubActionsSteps( "ci-ignore", + GitHubActionsImage.MacOsLatest, GitHubActionsImage.WindowsLatest, GitHubActionsImage.UbuntuLatest, AutoGenerate = false, - On = new[] { RocketSurgeonGitHubActionsTrigger.Push }, - OnPushTags = new[] { "v*" }, - OnPushBranches = new[] { "master", "main", "next" }, - OnPullRequestBranches = new[] { "master", "main", "next" }, - Enhancements = new[] { nameof(CiIgnoreMiddleware) } + On = [RocketSurgeonGitHubActionsTrigger.Push], + OnPushTags = ["v*"], + OnPushBranches = ["master", "main", "next"], + OnPullRequestBranches = ["master", "main", "next"], + Enhancements = [nameof(CiIgnoreMiddleware)] )] [GitHubActionsSteps( "ci", @@ -48,37 +25,36 @@ internal class LocalConstants GitHubActionsImage.WindowsLatest, GitHubActionsImage.UbuntuLatest, AutoGenerate = false, - On = new[] { RocketSurgeonGitHubActionsTrigger.Push }, - OnPushTags = new[] { "v*" }, - OnPushBranches = new[] { "master", "main", "next" }, - OnPullRequestBranches = new[] { "master", "main", "next" }, - InvokedTargets = new[] { nameof(Default) }, - NonEntryTargets = new[] - { + On = [RocketSurgeonGitHubActionsTrigger.Push], + OnPushTags = ["v*"], + OnPushBranches = ["master", "main", "next"], + OnPullRequestBranches = ["master", "main", "next"], + InvokedTargets = [nameof(Default)], + NonEntryTargets = [ nameof(ICIEnvironment.CIEnvironment), - nameof(ITriggerCodeCoverageReports.TriggerCodeCoverageReports), nameof(ITriggerCodeCoverageReports.GenerateCodeCoverageReportCobertura), nameof(IGenerateCodeCoverageBadges.GenerateCodeCoverageBadges), nameof(IGenerateCodeCoverageReport.GenerateCodeCoverageReport), nameof(IGenerateCodeCoverageSummary.GenerateCodeCoverageSummary), - nameof(Default) - }, - ExcludedTargets = new[] { nameof(ICanClean.Clean), nameof(ICanRestoreWithDotNetCore.DotnetToolRestore) }, - Enhancements = new[] { nameof(CiMiddleware) } + nameof(Default), + ], + ExcludedTargets = [nameof(ICanClean.Clean), nameof(ICanRestoreWithDotNetCore.DotnetToolRestore)], + Enhancements = [nameof(CiMiddleware)] )] +[CloseMilestoneJob(AutoGenerate = false)] +[DraftReleaseJob(AutoGenerate = false)] +[UpdateMilestoneJob(AutoGenerate = false)] [PrintBuildVersion] [PrintCIEnvironment] [UploadLogs] [TitleEvents] [ContinuousIntegrationConventions] -public partial class Solution +internal sealed partial class Pipeline { public static RocketSurgeonGitHubActionsConfiguration CiIgnoreMiddleware( RocketSurgeonGitHubActionsConfiguration configuration ) { - configuration.IncludeRepositoryConfigurationFiles(); - ( (RocketSurgeonsGithubActionsJob)configuration.Jobs[0] ).Steps = new List { new RunStep("N/A") @@ -87,7 +63,7 @@ RocketSurgeonGitHubActionsConfiguration configuration } }; - return configuration; + return configuration.IncludeRepositoryConfigurationFiles(); } public static RocketSurgeonGitHubActionsConfiguration CiMiddleware( @@ -96,33 +72,32 @@ RocketSurgeonGitHubActionsConfiguration configuration { configuration .ExcludeRepositoryConfigurationFiles() - .AddNugetPublish() .Jobs.OfType() .First(z => z.Name.Equals("Build", StringComparison.OrdinalIgnoreCase)) .ConfigureStep(step => step.FetchDepth = 0) - .UseDotNetSdks("3.1", "6.0", "8.0", "9.0") + .UseDotNetSdks("6.0", "8.0", "9.0") .AddNuGetCache() .AddVscodeExtensionTests() - .PublishLogs() - .PublishArtifacts() + .PublishLogs() + .PublishArtifacts() .FailFast = false; return configuration; } } -public static class Extensions +public static class JobExtensions { public static RocketSurgeonsGithubActionsJob AddVscodeExtensionTests(this RocketSurgeonsGithubActionsJob job) { return job .AddStep(new RunStep("Npm install") { Run = "npm ci", - WorkingDirectory = Solution.VscodeTestExtensionProjectDirectory + WorkingDirectory = Pipeline.VscodeTestExtensionProjectDirectory }) .AddStep(new HeadlessRunStep("Vscode extension tests") { Run = "npm run test", - WorkingDirectory = Solution.VscodeTestExtensionProjectDirectory + WorkingDirectory = Pipeline.VscodeTestExtensionProjectDirectory }); } } diff --git a/.build/Build.cs b/.build/Build.cs index 8097b5d06..651fd35b7 100644 --- a/.build/Build.cs +++ b/.build/Build.cs @@ -1,8 +1,8 @@ using JetBrains.Annotations; using Nuke.Common; +using Nuke.Common.CI; using Nuke.Common.Execution; using Nuke.Common.Git; -using Nuke.Common.IO; using Nuke.Common.Tooling; using Nuke.Common.Tools.DotNet; using Nuke.Common.Tools.GitVersion; @@ -10,28 +10,26 @@ using Nuke.Common.Tools.Npm; using Rocket.Surgery.Nuke.DotNetCore; -namespace Build; +#pragma warning disable CA1050 [PublicAPI] [UnsetVisualStudioEnvironmentVariables] [PackageIcon("http://www.omnisharp.net/images/logo.png")] -[EnsureReadmeIsUpdated] [DotNetVerbosityMapping] [MSBuildVerbosityMapping] [NuGetVerbosityMapping] +[ShutdownDotNetAfterServerBuild] [LocalBuildConventions] -public sealed partial class Solution : NukeBuild, +internal sealed partial class Pipeline : NukeBuild, ICanRestoreWithDotNetCore, ICanBuildWithDotNetCore, ICanTestWithDotNetCore, ICanPackWithDotNetCore, - IHaveDataCollector, ICanClean, - ICanUpdateReadme, + IHavePublicApis, IGenerateCodeCoverageReport, IGenerateCodeCoverageSummary, IGenerateCodeCoverageBadges, - IGenerateDocFx, IHaveConfiguration { /// @@ -41,29 +39,39 @@ public sealed partial class Solution : NukeBuild, /// - Microsoft VisualStudio https://nuke.build/visualstudio /// - Microsoft VSCode https://nuke.build/vscode /// - public static int Main() => Execute(x => x.Default); + public static int Main() => Execute(x => x.Default); - [OptionalGitRepository] public GitRepository? GitRepository { get; } + public Target Build => _ => _; - private Target Default => _ => _ - .DependsOn(Restore) - .DependsOn(Build) - .DependsOn(Test) - .DependsOn(Pack); + public Target Clean => _ => _; + + [Parameter("Configuration to build")] + public Configuration Configuration { get; } = IsLocalBuild ? Configuration.Debug : Configuration.Release; - public Target Build => _ => _.Inherit(x => x.CoreBuild); + [OptionalGitRepository] + public GitRepository? GitRepository { get; } - public Target Pack => _ => _.Inherit(x => x.CorePack) - .DependsOn(Clean); + [GitVersion(NoFetch = true, NoCache = false)] + public GitVersion GitVersion { get; } = null!; - [ComputedGitVersion] public GitVersion GitVersion { get; } = null!; + public Target Lint => _ => _; - public Target Clean => _ => _.Inherit(x => x.Clean); - public Target Restore => _ => _.Inherit(x => x.CoreRestore); + public Target Pack => _ => _.DependsOn(Clean); - public Target Test => _ => _.Inherit(x => x.CoreTest); + public Target Restore => _ => _; + public Target Test => _ => _; + + [NonEntryTarget] + private Target Default => _ => _ + .DependsOn(Restore) + .DependsOn(Build) + .DependsOn(Test) + .DependsOn(Pack); + +#pragma warning disable CA1822 public Target NpmInstall => _ => _ +#pragma warning restore CA1822 // Member 'NpmInstall' does not access instance data and can be marked as static .Executes(() => NpmTasks.NpmCi(s => s .SetProcessWorkingDirectory(VscodeTestExtensionProjectDirectory))); @@ -75,13 +83,7 @@ public sealed partial class Solution : NukeBuild, .SetProcessWorkingDirectory(VscodeTestExtensionProjectDirectory) .SetCommand("test"))); - public Target BuildVersion => _ => _.Inherit(x => x.BuildVersion) - .Before(Default) - .Before(Clean); - - [Parameter("Configuration to build")] public Configuration Configuration { get; } = IsLocalBuild ? Configuration.Debug : Configuration.Release; - - AbsolutePath ICanUpdateReadme.ReadmeFilePath => RootDirectory / "README.md"; + public Target BuildVersion => _ => _.Before(Default).Before(Clean); internal const string VscodeTestExtensionProjectDirectory = "vscode-testextension"; } diff --git a/.build/Configuration.cs b/.build/Configuration.cs index 6f2fcceaf..39145e725 100644 --- a/.build/Configuration.cs +++ b/.build/Configuration.cs @@ -1,13 +1,13 @@ ο»Ώusing System.ComponentModel; using Nuke.Common.Tooling; -namespace Build; +#pragma warning disable CA1050, CA1724, CA2225 [TypeConverter(typeof(TypeConverter))] public class Configuration : Enumeration { - public static Configuration Debug = new() { Value = nameof(Debug) }; - public static Configuration Release = new() { Value = nameof(Release) }; + public static readonly Configuration Debug = new() { Value = nameof(Debug) }; + public static readonly Configuration Release = new() { Value = nameof(Release) }; public static implicit operator string(Configuration configuration) => configuration.Value; } diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 1f19a0dd5..b89a38c71 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -1,42 +1,69 @@ { - "version": 1, - "isRoot": true, - "tools": { - "dotnet-outdated": { - "version": "2.11.0", - "commands": [ - "dotnet-outdated" - ] - }, - "dotnet-reportgenerator-globaltool": { - "version": "5.4.3", - "commands": [ - "reportgenerator" - ] - }, - "nuke.globaltool": { - "version": "9.0.4", - "commands": [ - "nuke" - ] - }, - "codecov.tool": { - "version": "1.13.0", - "commands": [ - "codecov" - ] - }, - "jetbrains.resharper.globaltools": { - "version": "2024.3.4", - "commands": [ - "jb" - ] - }, - "nukeeper": { - "version": "0.35.0", - "commands": [ - "nukeeper" - ] - } + "version": 1, + "isRoot": true, + "tools": { + "dotnet-outdated": { + "version": "2.11.0", + "commands": [ + "dotnet-outdated" + ], + "rollForward": false + }, + "dotnet-reportgenerator-globaltool": { + "version": "5.4.3", + "commands": [ + "reportgenerator" + ], + "rollForward": false + }, + "nuke.globaltool": { + "version": "9.0.4", + "commands": [ + "nuke" + ], + "rollForward": false + }, + "codecov.tool": { + "version": "1.13.0", + "commands": [ + "codecov" + ], + "rollForward": false + }, + "jetbrains.resharper.globaltools": { + "version": "2024.3.4", + "commands": [ + "jb" + ], + "rollForward": false + }, + "nukeeper": { + "version": "0.35.0", + "commands": [ + "nukeeper" + ], + "rollForward": false + }, + "dotnet-coverage": { + "version": "17.13.1", + "commands": [ + "dotnet-coverage" + ], + "rollForward": false + }, + "gitreleasemanager.tool": { + "version": "0.18.0", + "commands": [ + "dotnet-gitreleasemanager" + ], + "rollForward": false + }, + "gitversion.tool": { + "version": "6.1.0", + "commands": [ + "dotnet-gitversion" + ], + "rollForward": false } -} + } +} \ No newline at end of file diff --git a/.github/workflows/ci-ignore.yml b/.github/workflows/ci-ignore.yml index 1826f2ffc..b48765ee3 100644 --- a/.github/workflows/ci-ignore.yml +++ b/.github/workflows/ci-ignore.yml @@ -67,6 +67,20 @@ on: - '.github/labels.yml' - '.github/release.yml' - '.github/renovate.json' +permissions: + actions: read + checks: read + contents: read + deployments: read + id-token: none + issues: write + discussions: none + packages: none + pages: none + pull-requests: write + repository-projects: none + security-events: none + statuses: write jobs: build: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4e527ddb..414d98bda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,11 +67,39 @@ on: - '.github/labels.yml' - '.github/release.yml' - '.github/renovate.json' +permissions: + actions: read + checks: read + contents: read + deployments: read + id-token: none + issues: write + discussions: none + packages: none + pages: none + pull-requests: write + repository-projects: none + security-events: none + statuses: write jobs: build: env: NUGET_PACKAGES: '${{ github.workspace }}/.nuget/packages' + permissions: + actions: read + checks: write + contents: read + deployments: read + id-token: none + issues: write + discussions: none + packages: none + pages: none + pull-requests: write + repository-projects: none + security-events: none + statuses: write strategy: fail-fast: false matrix: @@ -89,10 +117,6 @@ jobs: with: path: '${{ github.workspace }}/.nuget/packages' key: "${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}-${{ hashFiles('**/dotnet-tools.json') }}" - - name: πŸ”¨ Use .NET Core 3.1 SDK - uses: actions/setup-dotnet@v4.3.0 - with: - dotnet-version: '3.1.x' - name: πŸ”¨ Use .NET Core 6.0 SDK uses: actions/setup-dotnet@v4.3.0 with: @@ -105,74 +129,87 @@ jobs: uses: actions/setup-dotnet@v4.3.0 with: dotnet-version: '9.0.x' - - name: 🎁 dotnet tool restore + - name: πŸš’ dotnet workload restore + continue-on-error: true + run: | + dotnet workload restore + - name: βš’οΈ dotnet tool restore run: | dotnet tool restore - name: 🎁 Restore id: restore run: | - dotnet nuke Restore --skip + dotnet nuke --target DotnetCoreRestore Restore - name: Update NuGet Cache if: always() && steps.restore-nuget-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: key: "${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}-${{ hashFiles('**/dotnet-tools.json') }}" path: '${{ github.workspace }}/.nuget/packages' - - name: βš™ Build + - name: βš™οΈ Build id: build run: | - dotnet nuke Build --skip - - name: 🚦 Test + dotnet .build/bin/Debug/.build.dll --target DotnetCoreBuild Build + - name: πŸ’¨ Test id: test run: | - dotnet nuke Test TriggerCodeCoverageReports GenerateCodeCoverageReportCobertura GenerateCodeCoverageBadges GenerateCodeCoverageSummary GenerateCodeCoverageReport --skip + dotnet .build/bin/Debug/.build.dll --target DotnetCoreTest Test CollectCodeCoverage GenerateCodeCoverageReportCobertura GenerateCodeCoverageBadges GenerateCodeCoverageSummary GenerateCodeCoverageReport - name: πŸ“¦ Pack id: pack run: | - dotnet nuke Pack --skip + dotnet .build/bin/Debug/.build.dll --target DotnetCorePack Pack --skip Build - name: Npm install working-directory: vscode-testextension run: | npm ci - - name: 🚦 Vscode extension tests + - name: πŸ’¨ Vscode extension tests uses: coactions/setup-xvfb@v1 with: run: 'npm run test' working-directory: 'vscode-testextension' - - name: 🏺 Publish coverage data - if: always() - uses: actions/upload-artifact@v4 - with: - name: 'coverage-${{ matrix.os }}' - path: 'coverage/' - - name: 🐿 Publish Coverage - if: (github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || ((github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.user.login != 'renovate[bot]' && github.event.pull_request.user.login != 'dependabot[bot]') - uses: codecov/codecov-action@v4.0.0-beta.2 - with: - name: 'actions-${{ matrix.os }}' - - name: 🏺 Publish logs + - name: 🏺 Publish logs (${{ matrix.os }}) if: always() uses: actions/upload-artifact@v4 with: name: 'logs-${{ matrix.os }}' path: 'artifacts/logs/' - - name: 🏺 Publish test data + - name: 🏺 Publish test data (${{ matrix.os }}) if: always() uses: actions/upload-artifact@v4 with: name: 'test data-${{ matrix.os }}' path: 'artifacts/test/' - - name: 🏺 Publish NuGet Packages + - name: πŸš€ Publish Test Results + if: always() + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + files: 'artifacts/test/**/*.trx' + - name: 🏺 Publish coverage data (${{ matrix.os }}) if: always() uses: actions/upload-artifact@v4 with: - name: 'nuget-${{ matrix.os }}' - path: 'artifacts/nuget/' - - name: 🏺 Publish Documentation + name: 'coverage-${{ matrix.os }}' + path: 'coverage/' + - name: πŸš€ Publish Coverage Comment + if: always() && github.event_name == 'pull_request' + continue-on-error: true + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: 'Coverage' + path: 'coverage/summary/SummaryGithub.md' + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' + - name: πŸš€ Publish Codecov Coverage + if: always() && (github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || ((github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.user.login != 'renovate[bot]' && github.event.pull_request.user.login != 'dependabot[bot]') + continue-on-error: true + uses: codecov/codecov-action@v4.0.0-beta.2 + with: + name: 'actions-${{ matrix.os }}' + - name: 🏺 Publish NuGet Packages (${{ matrix.os }}) + if: always() uses: actions/upload-artifact@v4 with: - name: 'docs-${{ matrix.os }}' - path: 'artifacts/docs/' + name: 'nuget-${{ matrix.os }}' + path: 'artifacts/nuget/' Merge: runs-on: ubuntu-latest needs: build diff --git a/.github/workflows/close-milestone.yml b/.github/workflows/close-milestone.yml index 0cff1b3c8..50a616814 100644 --- a/.github/workflows/close-milestone.yml +++ b/.github/workflows/close-milestone.yml @@ -1,9 +1,39 @@ +# ------------------------------------------------------------------------------ +# +# +# This code was generated. +# +# - To turn off auto-generation set: +# +# [CloseMilestoneJob (AutoGenerate = false)] +# +# - To trigger manual generation invoke: +# +# nuke --generate-configuration GitHubActions_close-milestone --host GitHubActions +# +# +# ------------------------------------------------------------------------------ + name: Close Milestone on: release: types: - released +permissions: + actions: read + checks: read + contents: read + deployments: read + id-token: none + issues: write + discussions: none + packages: none + pages: none + pull-requests: write + repository-projects: none + security-events: none + statuses: write jobs: close_milestone: @@ -12,56 +42,55 @@ jobs: - name: Checkout uses: actions/checkout@v4.2.2 with: - fetch-depth: 0 - - - uses: actions/setup-dotnet@v4 - - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v3.1.11 - with: - versionSpec: '6.0.x' - preferLatestVersion: true - - - name: Install GitReleaseManager - uses: gittools/actions/gitreleasemanager/setup@v3.1.11 - with: - versionSpec: '0.18.x' - - - name: Use GitVersion + clean: 'false' + fetch-depth: '0' + - name: Fetch all history for all tags and branches + run: | + git fetch --prune + - name: πŸ“² Install DotNet + uses: actions/setup-dotnet@v4 + - name: βš’οΈ dotnet tool restore + run: | + dotnet tool restore + - name: πŸ”¨ Use GitVersion id: gitversion - uses: gittools/actions/gitversion/execute@v3.1.11 - - # Ensure the milestone exists + shell: pwsh + run: | + $data = dotnet gitversion | ConvertFrom-Json + foreach ($item in $data.PSObject.Properties) { + $key = $item.Name + $value = $item.Value + echo "$($key.Substring(0,1).ToLower() + $key.Substring(1))=$value" >> $env:GITHUB_OUTPUT + } - name: Create Milestone - uses: WyriHaximus/github-action-create-milestone@v1 - with: - title: v${{ steps.gitversion.outputs.majorMinorPatch }} env: GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' - continue-on-error: true - - # move any issues to that milestone in the event the release is renamed + uses: WyriHaximus/github-action-create-milestone@v1 + with: + title: 'v${{ steps.gitversion.outputs.majorMinorPatch }}' - name: sync milestones uses: RocketSurgeonsGuild/actions/sync-milestone@v0.3.15 with: - default-label: 'mysterious' - github-token: ${{ secrets.OMNISHARP_BOT_TOKEN }} - + default-label: ':sparkles: mysterious' + github-token: '${{ secrets.GITHUB_TOKEN }}' + - name: πŸ“² Install GitReleaseManager + uses: gittools/actions/gitreleasemanager/setup@v3.1.11 + with: + versionSpec: '0.18.0' - name: Get Repo and Owner - shell: pwsh id: repository if: ${{ !github.event.release.prerelease && steps.gitversion.outputs.preReleaseTag == '' }} + shell: pwsh run: | $parts = $ENV:GITHUB_REPOSITORY.Split('/') echo "::set-output name=owner::$($parts[0])" echo "::set-output name=repository::$($parts[1])" - - name: Close Milestone - shell: pwsh if: ${{ !github.event.release.prerelease && steps.gitversion.outputs.preReleaseTag == '' }} + shell: pwsh run: | dotnet gitreleasemanager close ` - -o "${{ steps.repository.outputs.owner }}" ` - -r "${{ steps.repository.outputs.repository }}" ` - --token "${{ secrets.GITHUB_TOKEN }}" ` - -m "v${{ steps.gitversion.outputs.majorMinorPatch }}" + -o "${{ steps.repository.outputs.owner }}" ` + -r "${{ steps.repository.outputs.repository }}" ` + --token "${{ secrets.GITHUB_TOKEN }}" ` + -m "v${{ steps.gitversion.outputs.majorMinorPatch }}" diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index 7f595dca9..84c30e88a 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -1,16 +1,46 @@ -name: Create Milestone and Draft Release +# ------------------------------------------------------------------------------ +# +# +# This code was generated. +# +# - To turn off auto-generation set: +# +# [DraftReleaseJob (AutoGenerate = false)] +# +# - To trigger manual generation invoke: +# +# nuke --generate-configuration GitHubActions_draft-release --host GitHubActions +# +# +# ------------------------------------------------------------------------------ + +name: Draft Release and Create Milestone on: push: branches: - - master + - 'master' paths-ignore: - '**/*.md' schedule: - cron: '0 0 * * 4' +permissions: + actions: read + checks: read + contents: read + deployments: read + id-token: none + issues: write + discussions: none + packages: none + pages: none + pull-requests: write + repository-projects: none + security-events: none + statuses: write jobs: - create_milestone_and_draft_release: + draft_release: permissions: # write permission is required to create a github release contents: write @@ -19,44 +49,48 @@ jobs: - name: Checkout uses: actions/checkout@v4.2.2 with: - fetch-depth: 0 - - - uses: actions/setup-dotnet@v4 - + clean: 'false' + fetch-depth: '0' - name: Fetch all history for all tags and branches - run: git fetch --prune - - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v3.1.11 - with: - versionSpec: '6.0.x' - preferLatestVersion: true - - - name: Use GitVersion + run: | + git fetch --prune + - name: πŸ“² Install DotNet + uses: actions/setup-dotnet@v4 + - name: βš’οΈ dotnet tool restore + run: | + dotnet tool restore + - name: πŸ”¨ Use GitVersion id: gitversion - uses: gittools/actions/gitversion/execute@v3.1.11 - + shell: pwsh + run: | + $data = dotnet gitversion | ConvertFrom-Json + foreach ($item in $data.PSObject.Properties) { + $key = $item.Name + $value = $item.Value + echo "$($key.Substring(0,1).ToLower() + $key.Substring(1))=$value" >> $env:GITHUB_OUTPUT + } - name: Create Milestone - uses: WyriHaximus/github-action-create-milestone@v1 - with: - title: v${{ steps.gitversion.outputs.majorMinorPatch }} env: GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' - continue-on-error: true - - - name: sync milestones + uses: WyriHaximus/github-action-create-milestone@v1 + with: + title: 'v${{ steps.gitversion.outputs.majorMinorPatch }}' + - name: Sync Milestones uses: RocketSurgeonsGuild/actions/sync-milestone@v0.3.15 with: - default-label: 'mysterious' - github-token: ${{ secrets.GITHUB_TOKEN }} - - - uses: ncipollo/release-action@v1 + default-label: ':sparkles: mysterious' + github-token: '${{ secrets.GITHUB_TOKEN }}' + - name: Create Release + uses: ncipollo/release-action@v1 with: - allowUpdates: true - generateReleaseNotes: true - draft: true - omitNameDuringUpdate: true + allowUpdates: 'true' + generateReleaseNotes: 'true' + updateOnlyUnreleased: 'true' + draft: 'true' + omitBodyDuringUpdate: 'true' + omitNameDuringUpdate: 'true' + omitDraftDuringUpdate: 'true' name: 'v${{ steps.gitversion.outputs.majorMinorPatch }}' tag: 'v${{ steps.gitversion.outputs.majorMinorPatch }}' - token: ${{ secrets.GITHUB_TOKEN }} - commit: ${{ github.base_ref }} + token: '${{ secrets.GITHUB_TOKEN }}' + commit: '${{ github.base_ref }}' diff --git a/.github/workflows/update-milestone.yml b/.github/workflows/update-milestone.yml index 8aa210765..4b6205777 100644 --- a/.github/workflows/update-milestone.yml +++ b/.github/workflows/update-milestone.yml @@ -1,12 +1,43 @@ +# ------------------------------------------------------------------------------ +# +# +# This code was generated. +# +# - To turn off auto-generation set: +# +# [UpdateMilestoneJob (AutoGenerate = false)] +# +# - To trigger manual generation invoke: +# +# nuke --generate-configuration GitHubActions_update-milestone --host GitHubActions +# +# +# ------------------------------------------------------------------------------ + name: Update Milestone on: + push: pull_request_target: types: - - closed - - opened - - reopened - - synchronize + - 'closed' + - 'opened' + - 'reopened' + - 'synchronize' +permissions: + actions: read + checks: read + contents: read + deployments: read + id-token: none + issues: write + discussions: none + packages: none + pages: none + pull-requests: write + repository-projects: none + security-events: none + statuses: write jobs: update_milestone: @@ -15,43 +46,34 @@ jobs: - name: Checkout uses: actions/checkout@v4.2.2 with: - ref: ${{ github.sha }} - fetch-depth: 0 - - - uses: actions/setup-dotnet@v4 - + clean: 'false' + fetch-depth: '0' - name: Fetch all history for all tags and branches - run: git fetch --prune - - - name: Install GitVersion - if: ${{ github.event.action == 'opened' }} - uses: gittools/actions/gitversion/setup@v3.1.11 - with: - versionSpec: '6.0.x' - preferLatestVersion: true - - - name: Install GitReleaseManager - if: ${{ github.event.action == 'opened' }} - uses: gittools/actions/gitreleasemanager/setup@v3.1.11 - with: - versionSpec: '0.18.x' - - - name: Use GitVersion - if: ${{ github.event.action == 'opened' }} + run: | + git fetch --prune + - name: πŸ“² Install DotNet + uses: actions/setup-dotnet@v4 + - name: βš’οΈ dotnet tool restore + run: | + dotnet tool restore + - name: πŸ”¨ Use GitVersion id: gitversion - uses: gittools/actions/gitversion/execute@v3.1.11 - + shell: pwsh + run: | + $data = dotnet gitversion | ConvertFrom-Json + foreach ($item in $data.PSObject.Properties) { + $key = $item.Name + $value = $item.Value + echo "$($key.Substring(0,1).ToLower() + $key.Substring(1))=$value" >> $env:GITHUB_OUTPUT + } - name: Create Milestone - if: ${{ github.event.action == 'opened' }} - uses: WyriHaximus/github-action-create-milestone@v1 - with: - title: v${{ steps.gitversion.outputs.majorMinorPatch }} env: GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' - continue-on-error: true - - - name: sync milestones + uses: WyriHaximus/github-action-create-milestone@v1 + with: + title: 'v${{ steps.gitversion.outputs.majorMinorPatch }}' + - name: Sync Milestones uses: RocketSurgeonsGuild/actions/sync-milestone@v0.3.15 with: - default-label: 'mysterious' - github-token: ${{ secrets.GITHUB_TOKEN }} + default-label: ':sparkles: mysterious' + github-token: '${{ secrets.GITHUB_TOKEN }}' diff --git a/.gitignore b/.gitignore index 99a0f4a92..866dd2678 100644 --- a/.gitignore +++ b/.gitignore @@ -41,8 +41,8 @@ tools/*/ .idea/ node_modules/ coverage.*.xml -coverage.json -coverage.info +coverage.*.json +coverage.*.info /codealike.json .tmp/ .nuke/temp/ diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index e18c1f5f0..cc7d21694 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -1,55 +1,82 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "#/definitions/build", - "title": "Build Schema", "definitions": { - "build": { - "type": "object", + "Host": { + "type": "string", + "enum": [ + "AppVeyor", + "AzurePipelines", + "Bamboo", + "Bitbucket", + "Bitrise", + "GitHubActions", + "GitLab", + "Jenkins", + "Rider", + "SpaceAutomation", + "TeamCity", + "Terminal", + "TravisCI", + "VisualStudio", + "VSCode" + ] + }, + "ExecutableTarget": { + "type": "string", + "enum": [ + "Build", + "BuildVersion", + "Clean", + "CleanWellKnownTemporaryFiles", + "CollectCodeCoverage", + "Default", + "DotnetCoreBuild", + "DotnetCorePack", + "DotnetCoreRestore", + "DotnetCoreTest", + "DotnetToolRestore", + "GenerateCodeCoverageBadges", + "GenerateCodeCoverageReport", + "GenerateCodeCoverageReportCobertura", + "GenerateCodeCoverageSummary", + "HuskyLint", + "Lint", + "LintFiles", + "LintGitAdd", + "LintPublicApiAnalyzers", + "MoveUnshippedToShipped", + "NpmInstall", + "Pack", + "PostLint", + "Restore", + "ShipPublicApis", + "Test", + "TestVscodeExtension" + ] + }, + "Verbosity": { + "type": "string", + "description": "", + "enum": [ + "Verbose", + "Normal", + "Minimal", + "Quiet" + ] + }, + "NukeBuild": { "properties": { - "Artifacts": { - "type": "string", - "description": "The directory where artifacts are to be dropped" - }, - "Configuration": { - "type": "string", - "description": "Configuration to build", - "enum": [ - "Debug", - "Release" - ] - }, "Continue": { "type": "boolean", "description": "Indicates to continue a previously failed build attempt" }, - "Coverage": { - "type": "string", - "description": "The directory where coverage artifacts are to be dropped" - }, "Help": { "type": "boolean", "description": "Shows the help text for this build assembly" }, "Host": { - "type": "string", "description": "Host for execution. Default is 'automatic'", - "enum": [ - "AppVeyor", - "AzurePipelines", - "Bamboo", - "Bitbucket", - "Bitrise", - "GitHubActions", - "GitLab", - "Jenkins", - "Rider", - "SpaceAutomation", - "TeamCity", - "Terminal", - "TravisCI", - "VisualStudio", - "VSCode" - ] + "$ref": "#/definitions/Host" }, "NoLogo": { "type": "boolean", @@ -74,95 +101,61 @@ "type": "string", "description": "Root directory during build execution" }, - "Serve": { - "type": "boolean", - "description": "serve the docs" - }, "Skip": { "type": "array", "description": "List of targets to be skipped. Empty list skips all dependencies", "items": { - "type": "string", - "enum": [ - "Build", - "BuildVersion", - "Clean", - "CoreBuild", - "CoreDocs", - "CorePack", - "CoreRestore", - "CoreTest", - "Default", - "DotnetToolRestore", - "Generate_Code_Coverage_Badges", - "Generate_Code_Coverage_Report", - "Generate_Code_Coverage_Report_Cobertura", - "Generate_Code_Coverage_Summary", - "GenerateCodeCoverageBadges", - "GenerateCodeCoverageReport", - "GenerateCodeCoverageReportCobertura", - "GenerateCodeCoverageSummary", - "GenerateReadme", - "NpmInstall", - "Pack", - "Restore", - "Test", - "TestVscodeTestExtension", - "Trigger_Code_Coverage_Reports", - "TriggerCodeCoverageReports" - ] + "$ref": "#/definitions/ExecutableTarget" } }, - "Solution": { - "type": "string", - "description": "Path to a solution file that is automatically loaded" - }, "Target": { "type": "array", "description": "List of targets to be invoked. Default is '{default_target}'", "items": { - "type": "string", - "enum": [ - "Build", - "BuildVersion", - "Clean", - "CoreBuild", - "CoreDocs", - "CorePack", - "CoreRestore", - "CoreTest", - "Default", - "DotnetToolRestore", - "Generate_Code_Coverage_Badges", - "Generate_Code_Coverage_Report", - "Generate_Code_Coverage_Report_Cobertura", - "Generate_Code_Coverage_Summary", - "GenerateCodeCoverageBadges", - "GenerateCodeCoverageReport", - "GenerateCodeCoverageReportCobertura", - "GenerateCodeCoverageSummary", - "GenerateReadme", - "NpmInstall", - "Pack", - "Restore", - "Test", - "TestVscodeTestExtension", - "Trigger_Code_Coverage_Reports", - "TriggerCodeCoverageReports" - ] + "$ref": "#/definitions/ExecutableTarget" } }, "Verbosity": { - "type": "string", "description": "Logging verbosity during build execution. Default is 'Normal'", + "$ref": "#/definitions/Verbosity" + } + } + } + }, + "allOf": [ + { + "properties": { + "Artifacts": { + "type": "string", + "description": "The directory where artifacts are to be dropped" + }, + "Configuration": { + "type": "string", + "description": "Configuration to build", "enum": [ - "Minimal", - "Normal", - "Quiet", - "Verbose" + "Debug", + "Release" ] + }, + "Coverage": { + "type": "string", + "description": "The directory where coverage artifacts are to be dropped" + }, + "lint-files": { + "type": "array", + "description": "The files to lint, if not given lints all files", + "items": { + "type": "string" + } + }, + "Solution": { + "type": "string", + "description": "Path to a solution file that is automatically loaded" } } + }, + { + "$ref": "#/definitions/NukeBuild" } - } + ] } diff --git a/.nuke/parameters.json b/.nuke/parameters.json index 2d4a451b6..2616d8357 100644 --- a/.nuke/parameters.json +++ b/.nuke/parameters.json @@ -1,4 +1,5 @@ { "$schema": "./build.schema.json", - "Solution": "LSP.sln" -} \ No newline at end of file + "Solution": "LSP.sln", + "Host": "GitHubActions" +} diff --git a/test/coverlet.runsettings b/test/coverlet.runsettings index 46a49a78a..19d83ea11 100644 --- a/test/coverlet.runsettings +++ b/test/coverlet.runsettings @@ -1,14 +1,116 @@ +ο»Ώ - - - - - json,lcov,cobertura,opencover - [Bogus*]*,[Autofac*]*,[FakeItEasy*]*,[Moq*]*,[xunit*]*,[Microsoft.*]*,[XunitXml*]*,[coverlet.*]*,[System.*]*,[*]JetBrains.Annotations* - [OmniSharp.*]* - Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute - - - - - + + + + + json,lcov,cobertura,opencover + [Bogus*]*,[Autofac*]*,[FakeItEasy*]*,[Moq*]*,[xunit*]*,[Microsoft.*]*,[XunitXml*]*,[coverlet.*]*,[System.*]*,[*]JetBrains.Annotations* + [OmniSharp.*]* + Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute + + + + ^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$ + ^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$ + ^System\.Diagnostics\.DebuggerHiddenAttribute$ + ^System\.Diagnostics\.DebuggerNonUserCodeAttribute$ + ^System\.Runtime\.CompilerServices\.CompilerGeneratedAttribute$ + + + + + ^Bogus.* + ^DryIoc.* + ^FakeItEasy.* + ^FluentAssertions.* + ^JetBrains\..* + ^Microsoft\..* + ^Moq.* + ^NSubstitute.* + ^Nuke.* + ^Serilog.* + ^System\..* + ^TUnit.* + ^Verify.* + ^XUnit.* + + + + + .*\.build\.dll + .*Client\.dll + .*Client\.Tests\.dll + .*Dap\.Client\.dll + .*Dap\.Protocol\.dll + .*Dap\.Protocol\.Proposals\.dll + .*Dap\.Server\.dll + .*Dap\.Shared\.dll + .*Dap\.Testing\.dll + .*Dap\.Tests\.dll + .*Generation\.Tests\.dll + .*JsonRpc\.dll + .*JsonRpc\.Generators\.dll + .*JsonRpc\.Testing\.dll + .*JsonRpc\.Tests\.dll + .*Lsp\.Integration\.Tests\.dll + .*Lsp\.Tests\.dll + .*Protocol\.dll + .*Protocol\.Proposals\.dll + .*SampleServer\.dll + .*Server\.dll + .*Shared\.dll + .*Testing\.dll + .*TestingUtils\.dll + + + .*Bogus\.dll + .*coverlet\.collector\.dll + .*coverlet\.msbuild\.dll + .*DryIoc\.Internal\.dll + .*FluentAssertions\.dll + .*GitVersion\.Tool\.dll + .*MediatR\.dll + .*Microsoft\.CodeAnalysis\.Analyzers\.dll + .*Microsoft\.CodeAnalysis\.CSharp\.Workspaces\.dll + .*Microsoft\.Extensions\.Configuration\.Binder\.dll + .*Microsoft\.Extensions\.Configuration\.dll + .*Microsoft\.Extensions\.DependencyInjection\.dll + .*Microsoft\.Extensions\.Logging\.Debug\.dll + .*Microsoft\.Extensions\.Logging\.dll + .*Microsoft\.Extensions\.Options\.ConfigurationExtensions\.dll + .*Microsoft\.Extensions\.Options\.dll + .*Microsoft\.NET\.Test\.Sdk\.dll + .*Microsoft\.NETFramework\.ReferenceAssemblies\.dll + .*Microsoft\.Reactive\.Testing\.dll + .*Microsoft\.SourceLink\.GitHub\.dll + .*Nerdbank\.Streams\.dll + .*NETStandard\.Library\.dll + .*Newtonsoft\.Json\.dll + .*NSubstitute\.dll + .*ReportGenerator\.dll + .*Rocket\.Surgery\.MSBuild\.CI\.dll + .*Rocket\.Surgery\.MSBuild\.SourceLink\.dll + .*Rocket\.Surgery\.Nuke\.dll + .*Serilog\.Extensions\.Logging\.dll + .*Serilog\.Sinks\.Debug\.dll + .*Serilog\.Sinks\.File\.dll + .*Serilog\.Sinks\.Observable\.dll + .*Serilog\.Sinks\.XUnit\.dll + .*Snapper\.dll + .*System\.Collections\.Immutable\.dll + .*System\.Reactive\.dll + .*System\.Threading\.Channels\.dll + .*Verify\.SourceGenerators\.dll + .*Verify\.Xunit\.dll + .*xunit\.dll + .*xunit\.runner\.visualstudio\.dll + .*Xunit\.SkippableFact\.dll + + + + + + + + \ No newline at end of file