* Execute pipeline on pull requests

* Restore and build before running the tests
This commit is contained in:
Kevin Sommer 2021-05-14 11:35:39 +02:00
parent d513b108ba
commit bbfdb47de2
2 changed files with 17 additions and 15 deletions

View File

@ -20,6 +20,9 @@ on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
ubuntu-latest:

View File

@ -15,29 +15,23 @@ using static Nuke.Common.Tools.DotNet.DotNetTasks;
[ShutdownDotNetAfterServerBuild]
[GitHubActions("ci", GitHubActionsImage.UbuntuLatest,
OnPushBranches = new[] {"master"},
OnPullRequestBranches = new[] {"master"},
AutoGenerate = true,
InvokedTargets = new[] {nameof(Ci)},
InvokedTargets = new[] {nameof(Ci)},
CacheKeyFiles = new string[0])]
class Build : NukeBuild
{
/// Support plugins are available for:
/// - JetBrains ReSharper https://nuke.build/resharper
/// - JetBrains Rider https://nuke.build/rider
/// - Microsoft VisualStudio https://nuke.build/visualstudio
/// - Microsoft VSCode https://nuke.build/vscode
public static int Main() => Execute<Build>(x => x.Package);
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
[Solution] readonly Solution Solution;
Project SieveProject => Solution.AllProjects.First(p => p.Name == "Sieve");
[GitRepository] readonly GitRepository GitRepository;
[GitVersion(Framework = "netcoreapp3.1")] readonly GitVersion GitVersion;
[Solution] readonly Solution Solution;
Project SieveProject => Solution.AllProjects.First(p => p.Name == "Sieve");
AbsolutePath OutputDirectory => RootDirectory / "output";
Target Clean => _ => _
@ -73,9 +67,7 @@ class Build : NukeBuild
.Executes(() =>
{
DotNetTest(s => s
.SetProjectFile(Solution)
.EnableNoRestore()
.EnableNoBuild());
.SetProjectFile(Solution));
});
Target Package => _ => _
@ -93,4 +85,11 @@ class Build : NukeBuild
Target Ci => _ => _
.DependsOn(Package);
/// Support plugins are available for:
/// - JetBrains ReSharper https://nuke.build/resharper
/// - JetBrains Rider https://nuke.build/rider
/// - Microsoft VisualStudio https://nuke.build/visualstudio
/// - Microsoft VSCode https://nuke.build/vscode
public static int Main() => Execute<Build>(x => x.Package);
}