Skip to content

Commit 208c52a

Browse files
committed
Merge branch 'develop' into copilot/fix-376
2 parents 1c6d418 + c658390 commit 208c52a

File tree

12 files changed

+341
-82
lines changed

12 files changed

+341
-82
lines changed

.github/copilot-instructions.md

Lines changed: 129 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,137 @@
1-
This is a .NET based repository containing recipes for the Cake Build Automation System bundling individual Cake Issues addins.
2-
The individual recipes are published as NuGet packages.
1+
# Cake.Issues.Recipe
32

4-
See https://cakeissues.net/ for documentation and more information about Cake Issues.
3+
Cake.Issues.Recipe is a .NET repository containing recipes for the Cake Build Automation System bundling individual Cake Issues addins. The individual recipes are published as NuGet packages. The repository provides recipes for both Cake Scripting and Cake Frosting.
54

6-
Follow these guidelines when contributing:
5+
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
76

8-
## Before committing code
9-
- Ensure no warning or error messages from Roslyn analyzers are present in the code.
10-
- Ensure Unit Tests are passing.
11-
- Ensure Integration Tests are passing.
7+
## Working Effectively
128

13-
## Development Flow
14-
- Only building: `build.sh --target=DotNetCore-Build`
15-
- Publish NuGet Packages: `build.sh --target=Create-NuGet-Packages`
16-
- Run Unit Tests: `build.sh --target=Test`
17-
- Run Integration Tests:
18-
- Run first `build.sh --target=Create-NuGet-Packages` in the root directory to create the NuGet packages.
19-
- Run `build.sh` in the `tests/<RECIPE-NAME>/<TEST>` directory to run the integration tests for the corresponding recipe
20-
- Full CI check: `build.sh` (includes build, publish, test)
9+
### Prerequisites
10+
- Install .NET 8 and .NET 9 SDKs
11+
- For integration tests: Install `markdownlint-cli` globally: `npm install -g markdownlint-cli`
2112

22-
To have verbose output of build.sh the following parameter can be add `--verbosity=diagnostic`
13+
### Bootstrap, build, and test the repository
14+
- Make build script executable: `chmod +x build.sh`
15+
- Full build and test: `./build.sh` -- takes 40 seconds. NEVER CANCEL. Set timeout to 120+ seconds.
16+
- Build only: `./build.sh --target=DotNetCore-Build` -- takes 2.5 minutes. NEVER CANCEL. Set timeout to 300+ seconds.
17+
- Run unit tests: `./build.sh --target=Test` -- takes 30 seconds. NEVER CANCEL. Set timeout to 120+ seconds.
18+
- Create NuGet packages: `./build.sh --target=Create-NuGet-Packages` -- takes 30 seconds. NEVER CANCEL. Set timeout to 120+ seconds.
19+
20+
### Check available build targets
21+
- View all targets: `./build.sh --tree`
22+
- Get help: `./build.sh --help`
23+
- Verbose output: `./build.sh --verbosity=diagnostic`
24+
25+
### Run integration tests
26+
- ALWAYS run `./build.sh --target=Create-NuGet-Packages` first in the root directory to create NuGet packages
27+
- Run specific integration test:
28+
- `cd tests/script-runner/net8.0-git-cli/`
29+
- `chmod +x build.sh && ./build.sh` -- takes 20 seconds. NEVER CANCEL. Set timeout to 120+ seconds.
30+
- Integration tests validate the recipes work correctly with sample projects
31+
32+
## Validation
33+
34+
### Build validation steps
35+
- ALWAYS run the full build after making changes: `./build.sh`
36+
- Run unit tests: `./build.sh --target=Test`
37+
- For recipe changes, ALWAYS run integration tests to ensure recipes work correctly
38+
- Check build artifacts in `BuildArtifacts/Packages/NuGet/` after package creation
39+
40+
### Code quality requirements
41+
- Ensure no warning or error messages from Roslyn analyzers are present
42+
- Unit tests must pass
43+
- Integration tests must pass
44+
- Build artifacts must be created successfully
2345

2446
## Repository Structure
25-
- `Cake.Frosting.Issues.Recipe`: Contains the source code for the recipe for use with Cake Frosting
26-
- `Cake.Issues.Recipe`: Contains the source code for the recipe for use with Cake Scripting
27-
- `nuspec/nuget`: Contains the NuGet specification files for the Cake Scripting addin
28-
- `tests`: Contains integration tests for the recipes
29-
- `.github/workflows`: Contains GitHub Actions workflows for CI/CD which need to be maintained
30-
- `.azuredevops/pipelines/templates`: Contains Azure Pipelines templates which need to be maintained. The main file is `azure-pipelines.yml` in the root directory.
31-
32-
## Key Guidelines
47+
48+
### Key projects
49+
- `Cake.Issues.Recipe/`: Contains the source code for the recipe for use with Cake Scripting
50+
- `Cake.Frosting.Issues.Recipe/`: Contains the source code for the recipe for use with Cake Frosting
51+
- `Cake.Frosting.Issues.Recipe.csproj`: Main Frosting recipe project
52+
- `Cake.Frosting.Issues.Recipe.Tests.csproj`: Unit tests for Frosting recipe
53+
- `nuspec/nuget/`: Contains NuGet specification files for the Cake Scripting addin
54+
- `tests/`: Contains integration tests for both recipes
55+
- `script-runner/`: Integration tests for Cake Scripting recipe
56+
- `frosting/`: Integration tests for Cake Frosting recipe
57+
- `.github/workflows/`: GitHub Actions workflows for CI/CD
58+
- `.azuredevops/pipelines/`: Azure Pipelines templates
59+
- `azure-pipelines.yml`: Main Azure DevOps pipeline configuration
60+
61+
### Build system
62+
- Uses Cake.Recipe (meta-build system for Cake addins)
63+
- Main build configuration: `recipe.cake`
64+
- Build scripts: `build.sh` (Linux/macOS), `build.ps1` (Windows)
65+
- Uses GitVersion for semantic versioning
66+
67+
### Common commands reference
68+
69+
#### Repository root contents
70+
```
71+
.appveyor.yml
72+
.azuredevops/
73+
.config/
74+
.github/
75+
.gitignore
76+
.vscode/
77+
CONTRIBUTING.md
78+
Cake.Frosting.Issues.Recipe/
79+
Cake.Issues.Recipe/
80+
GitReleaseManager.yaml
81+
LICENSE
82+
README.md
83+
azure-pipelines.yml
84+
build.ps1
85+
build.sh
86+
nuspec/
87+
recipe.cake
88+
tests/
89+
```
90+
91+
#### Available build targets (most commonly used)
92+
- `Build`: Build all projects
93+
- `Test`: Run unit tests
94+
- `Package`: Create NuGet packages and run full validation
95+
- `Create-NuGet-Packages`: Create NuGet packages only
96+
- `DotNetCore-Build`: Build without tests or packaging
97+
- `DotNetCore-Restore`: Restore NuGet packages only
98+
99+
#### Integration test structure
100+
- Each test has variants for .NET 8/9 and different repository providers (git-cli, cake-git)
101+
- Tests contain sample projects that demonstrate recipe functionality
102+
- Tests validate issues are detected and reported correctly
103+
104+
## Development Guidelines
105+
106+
### Key principles
33107
1. Maintain existing code structure and organization
34-
2. Write unit tests for new functionality.
35-
3. Write integration tests for new functionality which can't be tested with unit tests.
36-
4. Ensure Cake.Issues.Recipe and Cake.Frosting.Issues.Recipe are kept in sync regarding the features they provide.
108+
2. Write unit tests for new functionality
109+
3. Write integration tests for functionality that can't be tested with unit tests
110+
4. Ensure Cake.Issues.Recipe and Cake.Frosting.Issues.Recipe are kept in sync regarding features
111+
112+
### Making changes
113+
- ALWAYS test both unit tests and integration tests after changes
114+
- Both Cake Scripting and Cake Frosting recipes should provide equivalent functionality
115+
- Recipe changes often require updates to both variants
116+
- Integration tests must pass to ensure recipes work in real scenarios
117+
118+
### CI/CD compatibility
119+
- The build runs on Windows, macOS, and Ubuntu across multiple .NET versions
120+
- GitHub Actions and Azure DevOps are both used for CI
121+
- AppVeyor is also used for some builds
122+
123+
### Common tasks timing reference
124+
- Tool restoration: ~5 seconds
125+
- .NET restore: ~30 seconds
126+
- Build (first time): ~2.5 minutes
127+
- Build (incremental): ~10 seconds
128+
- Unit tests: ~30 seconds
129+
- NuGet package creation: ~30 seconds
130+
- Integration test: ~20 seconds per test
131+
- Full build: ~40 seconds
132+
133+
### Troubleshooting
134+
- If markdownlint fails in integration tests: Install `markdownlint-cli` with `npm install -g markdownlint-cli`
135+
- Build warnings about deprecated packages are expected and can be ignored
136+
- Some assembly load warnings during build are expected and can be ignored
137+
- Integration tests create sample code with intentional issues for validation

.github/workflows/build.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ jobs:
77
runs-on: windows-2025
88
steps:
99
- name: Get the sources
10-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
10+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1111
- name: Fetch all tags and branches
1212
run: git fetch --prune --unshallow
1313
- name: Install .NET
14-
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
14+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
1515
with:
1616
# .NET 5 required for GitVersion
1717
dotnet-version: |
@@ -22,7 +22,7 @@ jobs:
2222
run: .\build.ps1
2323
shell: powershell
2424
- name: Publish NuGet package as build artifact
25-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
25+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2626
with:
2727
name: NuGet Package
2828
path: ./BuildArtifacts/Packages/NuGet/
@@ -33,17 +33,17 @@ jobs:
3333
runs-on: windows-2025
3434
steps:
3535
- name: Get the sources
36-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
36+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3737
- name: Install required tools
3838
run: npm install -g markdownlint-cli
3939
shell: powershell
4040
- name: Download build artifact
41-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
41+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
4242
with:
4343
name: NuGet Package
4444
path: ./BuildArtifacts/Packages/NuGet
4545
- name: Install .NET
46-
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
46+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
4747
with:
4848
dotnet-version: |
4949
8.x
@@ -52,7 +52,7 @@ jobs:
5252
working-directory: ./tests/script-runner/net8.0-git-cli/
5353
shell: powershell
5454
- name: Publish generated reports as build artifact
55-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
55+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
5656
with:
5757
name: Integration Tests Script Runner Windows (.NET tool)
5858
path: ./tests/script-runner/net8.0/BuildArtifacts/output/

.github/workflows/copilot-setup-steps.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ jobs:
2424
# Defined steps will run before the agent starts.
2525
steps:
2626
- name: Checkout code
27-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
27+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2828
- name: Fetch all tags and branches
2929
run: git fetch --prune --unshallow
3030
- name: Install .NET
31-
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
31+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
3232
with:
3333
# .NET 5 required for GitVersion
3434
dotnet-version: |

Cake.Frosting.Issues.Recipe/Cake.Frosting.Issues.Recipe.Tests/Cake.Frosting.Issues.Recipe.Tests.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@
1818

1919
<ItemGroup>
2020
<PackageReference Include="Cake.Frosting" Version="5.0.0" />
21-
<PackageReference Include="Cake.Issues.Testing" Version="5.7.0" />
21+
<PackageReference Include="Cake.Issues.Testing" Version="5.8.0" />
2222
<PackageReference Include="Cake.Testing" Version="5.0.0" />
2323
<PackageReference Include="Cake.Testing.Xunit" Version="5.0.0" />
2424
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0">
2525
<PrivateAssets>all</PrivateAssets>
2626
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2727
</PackageReference>
2828
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
29+
<PackageReference Include="NSubstitute" Version="5.3.0" />
2930
<PackageReference Include="xunit" Version="2.9.3" />
30-
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.3">
31+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
3132
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
3233
<PrivateAssets>all</PrivateAssets>
3334
</PackageReference>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
namespace Cake.Frosting.Issues.Recipe.Tests;
2+
3+
using Cake.Core;
4+
using Cake.Core.Configuration;
5+
using Cake.Core.Diagnostics;
6+
using Cake.Core.IO;
7+
using Cake.Core.Tooling;
8+
using NSubstitute;
9+
10+
internal sealed class CakeContextFixture
11+
{
12+
public IFileSystem FileSystem { get; set; }
13+
public ICakeEnvironment Environment { get; set; }
14+
public IGlobber Globber { get; set; }
15+
public ICakeLog Log { get; set; }
16+
public ICakeArguments Arguments { get; set; }
17+
public IProcessRunner ProcessRunner { get; set; }
18+
public IRegistry Registry { get; set; }
19+
public IToolLocator Tools { get; set; }
20+
public ICakeDataService Data { get; set; }
21+
public ICakeConfiguration Configuration { get; set; }
22+
23+
public CakeContextFixture()
24+
{
25+
this.Environment = new FakeEnvironment(PlatformFamily.Linux)
26+
{
27+
WorkingDirectory = new DirectoryPath(Directory.GetCurrentDirectory())
28+
};
29+
this.FileSystem = new FileSystem();
30+
this.Globber = Substitute.For<IGlobber>();
31+
this.Log = new FakeLog();
32+
this.Arguments = Substitute.For<ICakeArguments>();
33+
this.ProcessRunner = Substitute.For<IProcessRunner>();
34+
this.Registry = Substitute.For<IRegistry>();
35+
this.Tools = Substitute.For<IToolLocator>();
36+
this.Data = Substitute.For<ICakeDataService>();
37+
this.Configuration = new FakeConfiguration();
38+
}
39+
40+
public IssuesContext CreateContext() => new(
41+
new CakeContext(
42+
this.FileSystem,
43+
this.Environment,
44+
this.Globber,
45+
this.Log,
46+
this.Arguments,
47+
this.ProcessRunner,
48+
this.Registry,
49+
this.Tools,
50+
this.Data,
51+
this.Configuration),
52+
RepositoryInfoProviderType.Cli);
53+
}

0 commit comments

Comments
 (0)