Add new task to cake build for publishing projects, creating dist packages and creating GitHub releases#72
Merged
Merged
Conversation
…ing in `CakeHostBuilder`.
- Introduced `PublishTask` template with `DotNetPublish` implementation. - Added `IPublishTaskSettings` and `PublishingItem` for configuring publish directory and runtime options. - Enhanced `PackTask` to remove unnecessary newline for code clarity.
…mplate improvements - Updated `FrostingTaskBase` to support type-specific settings with enhanced modularity. - Refactored existing tasks (`PackTask`, `CleanTask`, `NuGetPushTask`, etc.) to replace redundant context-based setting retrieval with direct usage of task settings. - Introduced new `FrostingTaskBase<TBuildContext, TSettings>` for simplifying task development. - Added `PublishTask` default implementation and new `CreateDistPackagesTask` template for future enhancements. - Annotated relevant classes and settings with `[PublicAPI]` for improved IDE support and clarity.
…g in TAR.GZ and ZIP formats - Introduced `DistPackage` and `DistPackageFormat` for representing package configurations. - Added `ICreateDistPackagesTaskSettings` interface for task settings. - Updated `CreateDistPackagesTask` to handle packaging logic based on configurable formats. - Included necessary project references to `CreativeCoders.IO`.
…to separate projects with refactored architecture - Removed `CreativeCoders.IO` project and reorganized its contents. - Introduced new `CreativeCoders.IO.Archives` project with abstractions for TAR/ZIP archive handling. - Added `CreativeCoders.IO.Ports` project for serial port functionalities. - Updated package references and dependencies to align with the new modular structure. - Enhanced service registration with dependency injection extensions for archives.
- Updated constructors in `ZipArchiveWriter`, `ZipArchiveReader`, `TarArchiveWriter`, `TarArchiveReader`, and `TarGzArchiveReader` to use `Ensure.NotNull` for null validation. - Improved code clarity and standardized null handling across archive operations.
…gs via the new `SkipIfNoSettings` property. - Update `CreateDistPackagesTask` to use `IArchiveWriterFactory` for TAR.GZ and ZIP packaging. - Simplify `DefaultHostSetup` to summarize task and version setup during execution. - Fix incorrect `ProjectReference` paths in `CreativeCoders.CakeBuild.csproj`. - Enhance dependency injection for `IFileSystem` to use `IFileSystemEx`. - Add `PublicAPI` annotations to improve IDE support across tasks and settings.
…copyData` support in `OpenEntryStreamAsync`
…rage - Added placeholder unit test classes and test files for `TarArchiveWriter`. - Excluded `ArchiveWriterFactory` from code coverage analysis with `[ExcludeFromCodeCoverage]`.
- Mark `TestSource01.html` and `TestText01.txt` as content items instead of none.
… cleanup utilities - Added tests for various TAR archive creation operations, including files, streams, directories, and metadata configuration. - Updated `TarArchiveWriter` to support `leaveOpen` behavior through its constructor. - Introduced `FileCleanUp` and `DirectoryCleanUp` utilities for temporary resource cleanup in tests.
…tiveCoders.IO.UnitTests`
…Open` support - Introduced unit tests covering file, stream, directory operations, and compression level handling in `ZipArchiveWriter`. - Updated `ZipArchiveWriter`, `IZipArchiveWriterFactory`, `ZipArchiveWriterFactory`, and related methods to support `leaveOpen` behavior. - Added `TarEntryInfo` class and minor updates to existing file handling logic to improve consistency. - Updated `.gitignore` to exclude `.ai-plans`.
…` from code coverage analysis
…extraction handling - Introduced tests covering archive entry listing, stream opening, single file extraction, and full archive extraction in `TarArchiveReader`. - Updated `ExtractFileCoreAsync` to reset entry streams before reading and improve support for `IFileSystem`. - Modified `OpenEntryStreamAsync` to ensure memory stream positioning before returning.
…Factory` - Refactored both classes to support dependency injection with `IFileSystem`. - Updated file handling methods to use `IFileSystem` abstractions, improving testability and flexibility. - Adjusted relevant `Create` and `CreateAsync` methods to include optional `IFileSystem` parameters.
- Introduced comprehensive tests for `ZipArchiveReader`, covering entry listing, stream handling, and file extraction scenarios. - Updated `FileCleanUp` and `DirectoryCleanUp` to include existence checks before deletion to prevent unnecessary exceptions.
…` from code coverage
…` for cross-platform compatibility
…ne` for cross-platform consistency
- Introduced `CreateGitHubReleaseTask` for automated GitHub release creation with draft support. - Added `GitHubReleaseAsset` and `GitHubReleaseFileAsset` to manage release assets and file streams. - Integrated `MimeMapping` and `Octokit` for MIME type handling and GitHub API interactions. - Updated project file to include necessary package references for `MimeMapping` and `Octokit`.
…ed token handling and flexibility
… extend Cake tasks - Added `IFileSystem` dependency to `ZipArchiveWriterFactory` and `TarArchiveWriterFactory` to improve testability and directory handling. - Enhanced Cake build system with `ICreateDistPackagesTaskSettings` and integrated `PublishTask`, `CreateDistPackagesTask`, and `CreateGitHubReleaseTask`. - Updated `CakeHostExtensions` to include default services and new task configurations.
…ty in path construction.
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive build automation capabilities including project publishing, distribution package creation, and GitHub release management. It also refactors the IO.Archives implementation to use .NET's built-in archive APIs instead of third-party dependencies.
Changes:
- New archive implementation using System.IO.Compression and System.Formats.Tar with support for ZIP, TAR, and TAR.GZ formats
- New Cake build tasks for publishing projects, creating distribution packages, and managing GitHub releases
- Refactored IO.Ports code with primary constructor syntax
- Enhanced Core.IO utilities with DirectoryCleanUp and improved FileCleanUp
- Updated GitHub Actions workflows to use actions/checkout@v5
Reviewed changes
Copilot reviewed 82 out of 85 changed files in this pull request and generated 20 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/CreativeCoders.IO.UnitTests/CreativeCoders.IO.UnitTests.csproj | Updated project references to new archive and ports projects |
| tests/CreativeCoders.IO.UnitTests/Archives/Zip/ZipArchiveWriterTests.cs | Comprehensive tests for ZIP archive writing functionality |
| tests/CreativeCoders.IO.UnitTests/Archives/Zip/ZipArchiveReaderTests.cs | Comprehensive tests for ZIP archive reading functionality |
| tests/CreativeCoders.IO.UnitTests/Archives/Tar/TarArchiveWriterTests.cs | Comprehensive tests for TAR archive writing functionality |
| tests/CreativeCoders.IO.UnitTests/Archives/Tar/TarArchiveReaderTests.cs | Comprehensive tests for TAR archive reading functionality |
| source/IO/CreativeCoders.IO/Archives/* | Removed old archive implementation using third-party libraries |
| source/IO/CreativeCoders.IO.Ports/* | Refactored to use primary constructors and added SerialPortExtensions |
| source/IO/CreativeCoders.IO.Archives/* | New archive implementation with ZIP and TAR support using native .NET APIs |
| source/Core/CreativeCoders.Core/IO/* | Added DirectoryCleanUp, improved FileCleanUp, updated service registration |
| source/CakeBuild/CreativeCoders.CakeBuild/Tasks/Templates/* | Refactored existing tasks and added new publish, dist package, and GitHub release tasks |
| source/CakeBuild/CreativeCoders.CakeBuild/Tasks/Defaults/* | Added default task implementations for new functionality |
| source/CakeBuild/CreativeCoders.CakeBuild/GitHub/* | Added GitHub client factory for release management |
| source/CakeBuild/CreativeCoders.CakeBuild/CakeHostExtensions.cs | Updated to register new services and tasks |
| samples/CakeBuildSample/SampleBuildContext.cs | Added example configuration for new tasks |
| Core.sln | Updated solution file to reflect project changes |
| .github/workflows/*.yml | Updated to use actions/checkout@v5 |
| .gitignore | Added .ai-plans to ignore list |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… testability and consistency
… logic - Introduced tests for creating tar, tar.gz, and zip writers with both streams and filenames. - Validated integration of `ITarArchiveWriterFactory` and `IZipArchiveWriterFactory` in writer creation methods.
…up and consistency
- Introduced `TarArchiveReaderFactoryTests` and `TarArchiveWriterFactoryTests` to validate creating readers and writers for `.tar` and `.tar.gz` formats using streams and filenames. - Added `ZipArchiveReaderFactoryTests` and `ZipArchiveWriterFactoryTests` to ensure proper behavior of `.zip` archive reader and writer creation methods.
- Introduced tests for various task templates, including `BuildTask`, `CleanTask`, `CodeCoverageTask`, `CreateDistPackagesTask`, `CreateGitHubReleaseTask`, `NuGetPushTask`, `PackTask`, `PublishTask`, `RestoreTask`, and `TestTask`. - Added `CakeTestHelper` for mock context and filesystem setup. - Updated test project with new dependencies and project references.
- Updated and enhanced existing unit tests for all main Cake build tasks (`BuildTask`, `CleanTask`, `CodeCoverageTask`, `CreateDistPackagesTask`, `CreateGitHubReleaseTask`, `NuGetPushTask`, `PackTask`, `PublishTask`, `RestoreTask`, and `TestTask`) to ensure stricter validation and better assertions. - Replaced test assertions with `AwesomeAssertions` for improved readability and accuracy. - Renamed property `DistFolder` to `SourceFolder` and updated related logic in `DistPackage` class. - Adjusted mock setups across test cases to align with intended execution flows for all tasks. - Fixed and streamlined test invocation logic to better capture process interaction and directory handling.
…a to a memory stream - Refactored `OpenEntryStreamAsync` to allow copying entry data into a `MemoryStream` when `copyData` is set to `true`. - Improved error handling and asynchronous stream operations for better reliability.
…sync` behavior in archive readers - Introduced comprehensive unit tests for `TarGzArchiveReader` to validate archive entry listing, stream opening, and file extraction behavior. - Updated `OpenEntryStreamAsync` in both `TarGzArchiveReader` and `ZipArchiveReader` to reset `MemoryStream` position after data copy for reliable usage. - Refactored `ZipArchiveWriterTests` to simplify stream handling in `AddFileAsync`.
…prove `UploadAsset` usage
…chive readers - Introduced `PathSafety` class to validate paths and prevent path traversal attacks. - Added `PathSafetyTests` for comprehensive unit testing of path validation methods. - Updated archive readers (`ZipArchiveReader`, `TarArchiveReader`, and `TarGzArchiveReader`) to enforce path safety checks during file extraction. - Enhanced `PathExtensions` with `IsSafe` and `EnsureSafe` extension methods for convenient usage.
…ion checks - Corrected parameter order in `EnsureSafe` usage within `ZipArchiveReader`. - Updated `ArchiveEntry` to use `FileSys.Path` for path operations, improving consistency. - Enhanced `TarFileHelper.IsGZipFile` to fix incorrect extension logic and handle `.tar.gz` files.
…ings/ICreateGitHubReleaseTaskSettings.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…teGitHubReleaseTask.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Enabled nullable annotations in `PathSafety`. - Added a test for `CreateGitHubReleaseTask` to validate behavior when no GitHub token is provided.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.