* 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: push:
branches: branches:
- master - master
pull_request:
branches:
- master
jobs: jobs:
ubuntu-latest: ubuntu-latest:

View File

@ -15,29 +15,23 @@ using static Nuke.Common.Tools.DotNet.DotNetTasks;
[ShutdownDotNetAfterServerBuild] [ShutdownDotNetAfterServerBuild]
[GitHubActions("ci", GitHubActionsImage.UbuntuLatest, [GitHubActions("ci", GitHubActionsImage.UbuntuLatest,
OnPushBranches = new[] {"master"}, OnPushBranches = new[] {"master"},
OnPullRequestBranches = new[] {"master"},
AutoGenerate = true, AutoGenerate = true,
InvokedTargets = new[] {nameof(Ci)}, InvokedTargets = new[] {nameof(Ci)},
CacheKeyFiles = new string[0])] CacheKeyFiles = new string[0])]
class Build : NukeBuild 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)")] [Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release; 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; [GitRepository] readonly GitRepository GitRepository;
[GitVersion(Framework = "netcoreapp3.1")] readonly GitVersion GitVersion; [GitVersion(Framework = "netcoreapp3.1")] readonly GitVersion GitVersion;
[Solution] readonly Solution Solution;
Project SieveProject => Solution.AllProjects.First(p => p.Name == "Sieve");
AbsolutePath OutputDirectory => RootDirectory / "output"; AbsolutePath OutputDirectory => RootDirectory / "output";
Target Clean => _ => _ Target Clean => _ => _
@ -73,9 +67,7 @@ class Build : NukeBuild
.Executes(() => .Executes(() =>
{ {
DotNetTest(s => s DotNetTest(s => s
.SetProjectFile(Solution) .SetProjectFile(Solution));
.EnableNoRestore()
.EnableNoBuild());
}); });
Target Package => _ => _ Target Package => _ => _
@ -93,4 +85,11 @@ class Build : NukeBuild
Target Ci => _ => _ Target Ci => _ => _
.DependsOn(Package); .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);
} }