3131 WritePermissions = [ GitHubActionsPermissions . Contents , GitHubActionsPermissions . Pages ] ,
3232 EnableGitHubToken = true
3333) ]
34+ [ GitHubActions ( "ci" ,
35+ GitHubActionsImage . UbuntuLatest ,
36+ On = [ GitHubActionsTrigger . PullRequest , GitHubActionsTrigger . Push ] ,
37+ InvokedTargets = [ nameof ( Test ) ] ,
38+ FetchDepth = 10000 ) ]
3439class Build : NukeBuild
3540{
3641 [ Nuke . Common . Parameter ( "Configuration to build - Default is 'Debug' (local) or 'Release' (server)" ) ] readonly Configuration Configuration = IsLocalBuild ? Configuration . Debug : Configuration . Release ;
@@ -53,6 +58,7 @@ class Build : NukeBuild
5358
5459 Project LibProject => Solution . GetProject ( "SimpleBlazorMultiselect" ) ;
5560 Project DemoProject => Solution . GetProject ( "SimpleBlazorMultiselect.Demo" ) ;
61+ Project TestsProject => Solution . GetProject ( "SimpleBlazorMultiselect.Tests" ) ;
5662
5763 Target Clean => _ => _
5864 . Before ( Restore )
@@ -86,7 +92,7 @@ class Build : NukeBuild
8692 . SetProjectFile ( Solution )
8793 . SetConfiguration ( Configuration )
8894 . CombineWith (
89- from project in new [ ] { LibProject , DemoProject }
95+ from project in new [ ] { LibProject , DemoProject , TestsProject }
9096 from framework in project . GetTargetFrameworks ( )
9197 select new { project , framework } , ( cs , v ) => cs
9298 . SetProjectFile ( v . project . Path )
@@ -95,6 +101,17 @@ from framework in project.GetTargetFrameworks()
95101 ) ;
96102 } ) ;
97103
104+ Target Test => _ => _
105+ . DependsOn ( Compile )
106+ . Executes ( ( ) =>
107+ {
108+ DotNetTest ( s => s
109+ . EnableNoRestore ( )
110+ . EnableNoBuild ( )
111+ . SetConfiguration ( Configuration )
112+ . SetProjectFile ( TestsProject ) ) ;
113+ } ) ;
114+
98115 Target BuildDemo => _ => _
99116 . DependsOn ( Restore , Compile )
100117 . Before ( DeployDemo )
@@ -197,7 +214,7 @@ from framework in project.GetTargetFrameworks()
197214
198215 // ReSharper disable once UnusedMember.Local
199216 Target Pack => _ => _
200- . DependsOn ( Clean , Compile )
217+ . DependsOn ( Clean , Compile , Test )
201218 . Before ( Push )
202219 . Requires ( ( ) => Configuration == Configuration . Release )
203220 . Executes ( ( ) =>
0 commit comments