Commit 4e4e4a3
Add new task to cake build for publishing projects, creating dist packages and creating GitHub releases (#72)
* Upgrade `actions/checkout` in workflows to version 5 and improve logging in `CakeHostBuilder`.
* Add `PublishTask` and related settings for .NET publish functionality
- 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.
* Refactor task execution to use type-specific settings and add task template 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.
* Add `CreateDistPackagesTask` implementation with support for packaging 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`.
* Migrate `CreativeCoders.IO.Archives` and `CreativeCoders.IO.Ports` into 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.
* Use `Ensure.NotNull` for null validation in archive classes
- 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.
* - Refactor `FrostingTaskBase` to enable skipping tasks without settings 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.
* Enhance TAR/ZIP archive handling with `IFileSystem` integration and `copyData` support in `OpenEntryStreamAsync`
* Remove redundant `ProjectReference` to `CreativeCoders.IO` in unit test project.
* Add unit test files and exclude `ArchiveWriterFactory` from code coverage
- Added placeholder unit test classes and test files for `TarArchiveWriter`.
- Excluded `ArchiveWriterFactory` from code coverage analysis with `[ExcludeFromCodeCoverage]`.
* Update test file inclusion in `CreativeCoders.IO.UnitTests.csproj`
- Mark `TestSource01.html` and `TestText01.txt` as content items instead of none.
* Add comprehensive unit tests for `TarArchiveWriter` and introduce new 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.
* Remove unused test files and update project file accordingly in `CreativeCoders.IO.UnitTests`
* Add comprehensive unit tests for `ZipArchiveWriter` and update `leaveOpen` 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`.
* Exclude `Dispose` methods in `ZipArchiveWriter` and `TarArchiveWriter` from code coverage analysis
* Add comprehensive unit tests for `TarArchiveReader` and improve file 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.
* Integrate `IFileSystem` into `ZipArchiveReader` and `ZipArchiveReaderFactory`
- 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.
* Add unit tests for `ZipArchiveReader` and enhance cleanup utilities
- 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.
* Exclude `Dispose` methods in `ZipArchiveReader` and `TarArchiveReader` from code coverage
* Fix path construction in `ZipArchiveReaderTests` to use `Path.Combine` for cross-platform compatibility
* Improve path handling in `ZipArchiveReaderTests` by using `Path.Combine` for cross-platform consistency
* Add GitHub release creation logic and utilities
- 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`.
* Refactor GitHub release task to use `IGitHubClientFactory` for improved token handling and flexibility
* Integrate `IFileSystem` abstraction into archive writer factories and 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.
* Use constant `CliHostSampleAppProjectName` for improved maintainability in path construction.
* Use `_fileSystem` abstraction in `ZipArchiveWriterFactory` to improve testability and consistency
* Add unit tests for `ArchiveWriterFactory` to validate writer creation 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.
* Add project for `CreativeCoders.CakeBuild.Tests` and integrate it into the solution
* Remove `<TargetFramework>` property from test project files for cleanup and consistency
* Add unit tests for Tar and Zip archive reader and writer factories
- 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.
* Make `ExtendedAttributes` property immutable by changing it to `init` accessor
* Make `ExtendedAttributes` property mutable by changing accessor from `init` to `set`
* Add unit tests for Cake build task templates
- 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.
* Refactor and enhance Cake build tasks and unit tests
- 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.
* Make `OpenEntryStreamAsync` in `ZipArchiveReader` support copying data 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.
* Add unit tests for `TarGzArchiveReader` and enhance `OpenEntryStreamAsync` 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`.
* Refactor `CreateGitHubReleaseTask` to simplify stream handling and improve `UploadAsset` usage
* Add `PathSafety` utility for path validation and integrate it into archive 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.
* Improve path handling in archive readers and enhance GZip file extension 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.
* Update source/CakeBuild/CreativeCoders.CakeBuild/Tasks/Templates/Settings/ICreateGitHubReleaseTaskSettings.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update source/CakeBuild/CreativeCoders.CakeBuild/Tasks/Templates/CreateGitHubReleaseTask.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add nullability annotations and enhance `CreateGitHubReleaseTask` tests
- Enabled nullable annotations in `PathSafety`.
- Added a test for `CreateGitHubReleaseTask` to validate behavior when no GitHub token is provided.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 4c4ea75 commit 4e4e4a3
107 files changed
Lines changed: 3974 additions & 615 deletions
File tree
- .github/workflows
- samples/CakeBuildSample
- source
- CakeBuild/CreativeCoders.CakeBuild
- GitHub
- Tasks
- Defaults
- Templates
- Settings
- Core/CreativeCoders.Core/IO
- IO
- CreativeCoders.IO.Archives
- Tar
- Zip
- CreativeCoders.IO.Ports
- CreativeCoders.IO/Archives
- tests
- CreativeCoders.CakeBuild.Tests
- Tasks/Templates
- CreativeCoders.Cli.Tests
- CreativeCoders.Core.UnitTests/IO
- CreativeCoders.IO.UnitTests
- Archives
- Tar
- Zip
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
| 331 | + | |
| 332 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
151 | | - | |
152 | 150 | | |
153 | 151 | | |
154 | 152 | | |
| |||
258 | 256 | | |
259 | 257 | | |
260 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
261 | 265 | | |
262 | 266 | | |
263 | 267 | | |
| |||
428 | 432 | | |
429 | 433 | | |
430 | 434 | | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | 435 | | |
436 | 436 | | |
437 | 437 | | |
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
579 | 591 | | |
580 | 592 | | |
581 | 593 | | |
| |||
637 | 649 | | |
638 | 650 | | |
639 | 651 | | |
640 | | - | |
641 | 652 | | |
642 | 653 | | |
643 | 654 | | |
| |||
684 | 695 | | |
685 | 696 | | |
686 | 697 | | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
687 | 701 | | |
688 | 702 | | |
689 | 703 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
33 | 60 | | |
Lines changed: 1 addition & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | | - | |
5 | 3 | | |
6 | 4 | | |
7 | | - | |
| 5 | + | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
| |||
93 | 91 | | |
94 | 92 | | |
95 | 93 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
Lines changed: 17 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
68 | 78 | | |
69 | 79 | | |
70 | 80 | | |
| |||
74 | 84 | | |
75 | 85 | | |
76 | 86 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
0 commit comments