Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
IT-VBFK authored and Dennis Doomen committed Jan 18, 2023
1 parent 573b575 commit cc08d1a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Expand Up @@ -27,9 +27,8 @@ jobs:
- name: Run NUKE
run: ./build.ps1
env:
NuGetApiKey: ${{ secrets.NUGETAPIKEY }}
CoverallsToken: ${{ secrets.COVERALLS }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS }}
ApiKey: ${{ secrets.NUGETAPIKEY }}
CoverallsToken: ${{ secrets.COVERALLS_TOKEN }}

- name: Upload artifacts
uses: actions/upload-artifact@v3
Expand Down
2 changes: 2 additions & 0 deletions .nuke/build.schema.json
Expand Up @@ -78,6 +78,7 @@
"CodeCoverage",
"Compile",
"Coveralls",
"Info",
"Pack",
"Push",
"Restore",
Expand Down Expand Up @@ -105,6 +106,7 @@
"CodeCoverage",
"Compile",
"Coveralls",
"Info",
"Pack",
"Push",
"Restore",
Expand Down
28 changes: 21 additions & 7 deletions Build/Build.cs
Expand Up @@ -78,6 +78,20 @@ class Build : NukeBuild

string SemVer;

Target Info => _ => _
.Executes(() =>
{
if (string.IsNullOrWhiteSpace(CoverallsToken))
{
Warning("Coveralls token is null or empty");
}
if (string.IsNullOrWhiteSpace(NuGetApiKey))
{
Warning("NuGet API key is null or empty");
}
});

Target Clean => _ => _
.OnlyWhenDynamic(() => RunAllTargets || HasSourceChanges)
.Executes(() =>
Expand Down Expand Up @@ -158,7 +172,7 @@ class Build : NukeBuild
{
IEnumerable<string> testAssemblies = Projects
.SelectMany(project => GlobFiles(project.Directory, "bin/Debug/net47/*.Specs.dll"));
Assert.NotEmpty(testAssemblies.ToList());
Xunit2(s => s
Expand Down Expand Up @@ -199,7 +213,7 @@ class Build : NukeBuild
.DependsOn(UnitTestsNetCore);

Target CodeCoverage => _ => _
.DependsOn(TestFrameworks)
.DependsOn(TestFrameworks)
.DependsOn(UnitTests)
.OnlyWhenDynamic(() => RunAllTargets || HasSourceChanges)
.Produces(CoverageResultDirectory / "lcov.info")
Expand All @@ -221,29 +235,29 @@ class Build : NukeBuild
});

Target Coveralls => _ => _
.OnlyWhenDynamic(() => RunAllTargets || HasSourceChanges)
.OnlyWhenDynamic(() => !string.IsNullOrWhiteSpace(CoverallsToken) && (RunAllTargets || HasSourceChanges))
.DependsOn(CodeCoverage)
.Consumes(CodeCoverage)
.Executes(() =>
{
CoverallsNet(s => s
.SetDryRun(IsLocalBuild)
.SetProcessArgumentConfigurator(x => x
.Add("--lcov"))
.Add("--lcov")
.Add($"--jobId {GitHubActions?.RunId}"))
.SetInput(CoverageResultDirectory / "lcov.info")
.SetRepoToken(CoverallsToken)
.When(IsPullRequest,
s => s.SetPullRequest(GitHubActions?.PullRequestNumber)
)
.SetBasePath(RootDirectory.GetRelativePathTo(Solution.Core.FluentAssertions))
.EnableUserRelativePaths()
.SetCommitBranch(GitRepository.Branch)
.SetCommitId(GitRepository.Commit)
.SetCommitAuthor(Repository.Head.Tip.Author.Name)
.SetCommitEmail(Repository.Head.Tip.Author.Email)
.SetCommitMessage(Repository.Head.Tip.MessageShort));
.SetCommitMessage(Repository.Head.Tip.MessageShort));
});

Target TestFrameworks => _ => _
.DependsOn(Compile)
.OnlyWhenDynamic(() => RunAllTargets || HasSourceChanges)
Expand Down

0 comments on commit cc08d1a

Please sign in to comment.