Skip to content
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
19 changes: 15 additions & 4 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
name: ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
Expand All @@ -33,10 +33,21 @@ jobs:
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- name: 'Run: Compile, Pack'
run: ./build.cmd Compile Pack
- name: 'Run: Compile, Test, Pack'
run: ./build.cmd Compile Test Pack
- name: 'Upload coverage to Codecov'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: artifacts/coverage/*.xml
fail_ci_if_error: false
- name: 'Publish: coverage'
uses: actions/upload-artifact@v5
with:
name: coverage
path: artifacts/coverage
- name: 'Publish: packages'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: packages
path: artifacts/packages
10 changes: 9 additions & 1 deletion build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.Coverlet;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.GitHub;
using Nuke.Common.Utilities.Collections;
Expand All @@ -22,7 +23,7 @@
FetchDepth = 0,
On = [GitHubActionsTrigger.Push],
PublishArtifacts = true,
InvokedTargets = [nameof(Compile), nameof(Pack)])]
InvokedTargets = [nameof(Compile), nameof(Test), nameof(Pack)])]
[GitHubActions(
"release",
GitHubActionsImage.UbuntuLatest,
Expand Down Expand Up @@ -59,6 +60,7 @@ class Build : NukeBuild
AbsolutePath TestsDirectory => RootDirectory / "tests";
AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
AbsolutePath PackagesDirectory => ArtifactsDirectory / "packages";
AbsolutePath CoverageDirectory => ArtifactsDirectory / "coverage";

Target Clean => _ => _
.Before(Restore)
Expand Down Expand Up @@ -104,16 +106,22 @@ class Build : NukeBuild

Target Test => _ => _
.DependsOn(Compile)
.Produces(CoverageDirectory / "*.xml")
.Executes(() =>
{
var projects = Solution.GetAllProjects("*.Tests");

CoverageDirectory.CreateOrCleanDirectory();

foreach (var project in projects)
{
DotNetTest(_ => _
.SetProjectFile(project.Path)
.SetConfiguration(Configuration)
.EnableNoBuild()
.EnableCollectCoverage()
.SetCoverletOutputFormat(CoverletOutputFormat.cobertura)
.SetCoverletOutput(CoverageDirectory / $"{project.Name}.xml")
);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="6.0.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
Expand Down