Skip to content

Commit

Permalink
Adds an integration test for Cake Frosting
Browse files Browse the repository at this point in the history
  • Loading branch information
ecampidoglio committed Apr 2, 2024
1 parent c9511ab commit d969cff
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,29 @@ jobs:
string-parameter: 'value'
numeric-parameter: 3
boolean-parameter: true
test-with-frosting:
name: Test with Cake Frosting
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
steps:
- name: Get the sources
uses: actions/checkout@v1
- name: Install Node 16
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install the .NET 8 SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: '8.0.x'
- name: Run a specific Cake Frosting project
uses: ./
with:
csproj-path: integrationtests/frosting/Build.csproj
- name: Run a specific Cake Frosting task
uses: ./
with:
csproj-path: integrationtests/frosting/Build.csproj
target: Successful-Task
10 changes: 10 additions & 0 deletions integrationtests/frosting/Build.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Cake.Frosting" Version="4.0.0" />
</ItemGroup>
</Project>
35 changes: 35 additions & 0 deletions integrationtests/frosting/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Threading.Tasks;
using Cake.Core;
using Cake.Core.Diagnostics;
using Cake.Frosting;

public static class Program
{
public static int Main(string[] args)
{
return new CakeHost()
.UseContext<BuildContext>()
.Run(args);
}
}

public class BuildContext : FrostingContext
{
public BuildContext(ICakeContext context)
: base(context)
{
}
}

[TaskName("Successful-Task")]
public sealed class SuccessfulTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
context.Log.Information("✓ Passed");
}
}

[TaskName("Default")]
[IsDependentOn(typeof(SuccessfulTask))]
public class DefaultTask : FrostingTask;

0 comments on commit d969cff

Please sign in to comment.