diff --git a/.build/Build.cs b/.build/Build.cs index 86b7c5abc..e35ee98f1 100644 --- a/.build/Build.cs +++ b/.build/Build.cs @@ -17,6 +17,7 @@ namespace Build; [DotNetVerbosityMapping] [MSBuildVerbosityMapping] [NuGetVerbosityMapping] +[LocalBuildConventions] public sealed partial class Solution : NukeBuild, ICanRestoreWithDotNetCore, ICanBuildWithDotNetCore, @@ -28,6 +29,7 @@ public sealed partial class Solution : NukeBuild, IGenerateCodeCoverageReport, IGenerateCodeCoverageSummary, IGenerateCodeCoverageBadges, + IGenerateDocFx, IHaveConfiguration { /// diff --git a/.build/Configuration.cs b/.build/Configuration.cs index 324bc331a..6f2fcceaf 100644 --- a/.build/Configuration.cs +++ b/.build/Configuration.cs @@ -6,8 +6,8 @@ namespace Build; [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 Configuration Debug = new() { Value = nameof(Debug) }; + public static Configuration Release = new() { Value = nameof(Release) }; public static implicit operator string(Configuration configuration) => configuration.Value; } diff --git a/.build/Solution.cs b/.build/Solution.cs index 3a21d42aa..00877d256 100644 --- a/.build/Solution.cs +++ b/.build/Solution.cs @@ -70,18 +70,15 @@ internal class LocalConstants [PrintCIEnvironment] [UploadLogs] [TitleEvents] +[ContinuousIntegrationConventions] public partial class Solution { public static RocketSurgeonGitHubActionsConfiguration CiIgnoreMiddleware( RocketSurgeonGitHubActionsConfiguration configuration ) { - foreach (var item in configuration.DetailedTriggers.OfType()) - { - item.IncludePaths = LocalConstants.PathsIgnore; - } + configuration.IncludeRepositoryConfigurationFiles(); - configuration.Jobs.RemoveAt(1); ( (RocketSurgeonsGithubActionsJob)configuration.Jobs[0] ).Steps = new List { new RunStep("N/A") @@ -97,104 +94,17 @@ public static RocketSurgeonGitHubActionsConfiguration CiMiddleware( RocketSurgeonGitHubActionsConfiguration configuration ) { - foreach (var item in configuration.DetailedTriggers.OfType()) - { - item.ExcludePaths = LocalConstants.PathsIgnore; - } - - var buildJob = configuration.Jobs.OfType().First(z => z.Name == "Build"); - buildJob.FailFast = false; - var checkoutStep = buildJob.Steps.OfType().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[] - { - new RunStep("Fetch all history for all tags and branches") - { - Run = "git fetch --prune" - }, - new UsingStep("NuGet Cache") - { - Uses = "actions/cache@v2", - With = - { - ["path"] = "${{ github.workspace }}/.nuget/packages", - // keep in mind using central package versioning here - ["key"] = - "${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}-${{ hashFiles('**/Directory.Packages.support.props') }}", - ["restore-keys"] = @"| - ${{ runner.os }}-nuget-" - } - }, - new SetupDotNetStep("Use .NET Core 3.1 SDK") - { - DotNetVersion = "3.1.x" - }, - new SetupDotNetStep("Use .NET Core 7.0 SDK") - { - DotNetVersion = "7.0.x" - }, - } - ); - - buildJob.Steps.Add( - new UsingStep("Publish Coverage") - { - Uses = "codecov/codecov-action@v1", - With = new Dictionary - { - ["name"] = "actions-${{ matrix.os }}", - } - } - ); - - buildJob.Steps.Add( - new UploadArtifactStep("Publish logs") - { - Name = "logs", - Path = "artifacts/logs/", - If = "always()" - } - ); - - buildJob.Steps.Add( - new UploadArtifactStep("Publish coverage data") - { - Name = "coverage", - Path = "coverage/", - If = "always()" - } - ); - - buildJob.Steps.Add( - new UploadArtifactStep("Publish test data") - { - Name = "test data", - Path = "artifacts/test/", - If = "always()" - } - ); - - buildJob.Steps.Add( - new UploadArtifactStep("Publish NuGet Packages") - { - Name = "nuget", - Path = "artifacts/nuget/", - If = "always()" - } - ); - - buildJob.Steps.Add( - new UploadArtifactStep("Publish Docs") - { - Name = "docs", - Path = "artifacts/docs/", - If = "always()" - } - ); + configuration + .ExcludeRepositoryConfigurationFiles() + .AddNugetPublish() + .Jobs.OfType() + .First(z => z.Name.Equals("Build", StringComparison.OrdinalIgnoreCase)) + .ConfigureStep(step => step.FetchDepth = 0) + .UseDotNetSdks("3.1", "7.0") + .AddNuGetCache() + .PublishLogs() + .PublishArtifacts() + .FailFast = false; return configuration; } diff --git a/.github/workflows/ci-ignore.yml b/.github/workflows/ci-ignore.yml index a5c03cbb6..9f2bff03f 100644 --- a/.github/workflows/ci-ignore.yml +++ b/.github/workflows/ci-ignore.yml @@ -69,7 +69,7 @@ on: - '.github/renovate.json' jobs: - Build: + build: strategy: matrix: os: [windows-latest, ubuntu-latest] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0a419e91..1041e266b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,13 +69,13 @@ on: - '.github/renovate.json' jobs: - Build: + build: env: NUGET_PACKAGES: '${{ github.workspace }}/.nuget/packages' strategy: fail-fast: false matrix: - os: [macOS-latest, windows-latest, ubuntu-latest] + os: [macos-latest, windows-latest, ubuntu-latest] runs-on: ${{ matrix.os }} steps: - name: Checkout @@ -83,9 +83,6 @@ jobs: with: clean: 'false' fetch-depth: '0' - - name: Fetch all history for all tags and branches - run: | - git fetch --prune - name: NuGet Cache uses: actions/cache@v3 with: @@ -105,18 +102,29 @@ jobs: run: | dotnet tool restore - name: 🎁 Restore + id: restore run: | dotnet nuke Restore --skip - name: ⚙ Build + id: build run: | dotnet nuke Build --skip - name: 🚦 Test + id: test run: | dotnet nuke Test TriggerCodeCoverageReports GenerateCodeCoverageReportCobertura GenerateCodeCoverageBadges GenerateCodeCoverageSummary GenerateCodeCoverageReport --skip - name: 📦 Pack + id: pack run: | dotnet nuke Pack --skip + - name: 🏺 Publish coverage data + if: always() + uses: actions/upload-artifact@v3 + with: + name: 'coverage' + 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 }}' @@ -126,12 +134,6 @@ jobs: with: name: 'logs' path: 'artifacts/logs/' - - name: 🏺 Publish coverage data - if: always() - uses: actions/upload-artifact@v3 - with: - name: 'coverage' - path: 'coverage/' - name: 🏺 Publish test data if: always() uses: actions/upload-artifact@v3 @@ -144,8 +146,7 @@ jobs: with: name: 'nuget' path: 'artifacts/nuget/' - - name: 🏺 Publish Docs - if: always() + - name: 🏺 Publish Documentation uses: actions/upload-artifact@v3 with: name: 'docs' @@ -153,7 +154,7 @@ jobs: Publish: needs: - Build + uses: RocketSurgeonsGuild/actions/.github/workflows/publish-nuget.yml@v0.3.3 secrets: RSG_NUGET_API_KEY: '${{ secrets.RSG_NUGET_API_KEY }}' RSG_AZURE_DEVOPS: '${{ secrets.RSG_AZURE_DEVOPS }}' - uses: RocketSurgeonsGuild/actions/.github/workflows/publish-nuget.yml@v0.3.3 diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 6b089e946..57832ac84 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -74,6 +74,10 @@ "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", @@ -84,6 +88,7 @@ "BuildVersion", "Clean", "CoreBuild", + "CoreDocs", "CorePack", "CoreRestore", "CoreTest", @@ -120,6 +125,7 @@ "BuildVersion", "Clean", "CoreBuild", + "CoreDocs", "CorePack", "CoreRestore", "CoreTest",