Skip to content

Commit a6bc201

Browse files
authored
New cli tool for working with CCUs (#9)
* Add new web app frontend and backend for controlling CCUs * First basic in memory storing backend and loading in frontend * Persist backend data in a LiteDb database. Use more rxjs in frontend. * Add Ccu's via a dialog * Use LiteDb bases IDocumentRepository from Core nuget. Add first steps for hmcc login and auth. * Upgrade to latest Cc.Core nuget packages * Some api tests * Update target framework to .NET 8.0 and update package references This commit updates the target framework to .NET 8.0 across multiple .csproj files and also updates several package references. It adds specific configuration for .editorconfig and Directory.Build.props for the samples, tests, and source directories. It also cleans up HomeMatic.sln to include newly added configs and removes net6.0 targets from numerous other files where the targets were not necessary. * Add new build configurations and update GitHub workflows This commit introduces new build configurations and modifies existing GitHub action workflows. Changes include addition of props and targets to prevent unintended imports, revisions to build scripts to accommodate changes, and updates to GitHub action workflow files for better integration and deployment procedures. Also, it includes necessary modifications in tests and inspection rules to align with the new build configurations. * Add ReportGenerator and GitVersion.Tool to build project In this commit, two new package references have been added to the _build.csproj project file. The first added package is "ReportGenerator" with version 5.2.1, which is useful for generating reports on code coverage. The second addition is "GitVersion.Tool" with a version constraint of 5.12.0, used for semantic versioning based on git history. * Refactor classes for direct assignment of properties The code has been refactored to directly assign properties during object construction, removing the need for intermediate variable assignment or explicit setting of properties. This change simplifies the structure and improves the readability of the classes. Additionally, the ConfigureAwait method has been removed from asynchronous calls in the tests for code cleanliness. * Refactor Backend program structure The original Backend program layout has been significantly changed, including the extraction of the initialization logic into a separate Startup class. This makes our code cleaner and more organized, simplifying the structure of Main by moving services configuration and middleware sequence to the Startup class. * Apply continuous indentation rule in code style settings A ReSharper setting for continuous indentation inside braces has been added to the .DotSettings file. This update ensures all developers working on this project follow the same indentation code style for enhanced readability and coherence of the codebase. * Update authentication and authorization Removed HomeMaticTokenAuthHandler and AuthController, and updated package references to better cater for JWT token authentication using CreativeCoders.AspNetCore.TokenAuthApi. Added new HomeMaticApiUserProvider for user authentication. Updated Startup.cs file to accommodate these changes with additional configurations for the JWT security key and adding a 'RestrictedApi' policy. Changes also affect the CcuStoreController, where authorization policy is added. * Refactor auth service adding login and logout The authentication service has been updated with the addition of actual login and logout functionalities. Previously commented-out login and logout methods have been replaced with versions that make calls to '/api/tokenauth/login' and '/api/tokenauth/logout'. These new methods are complete with error handling and value mapping. * Enhance device commands with filtering and display details Added filtering capability to `ListDevices` using patterns and improved the display of parameter sets in `ShowDeviceDetails`. Also marked the `Address` option in `ShowDeviceDetailsOptions` as required. Minor refactorings and additional imports were included to streamline functionality. * Enable custom Kestrel endpoints configuration. Added HTTP and HTTPS endpoint bindings to `appsettings.Development.json` for local development. Refactored `Program.cs` for better readability and removed an outdated comment in `Startup.cs`. * Disable analytics in Angular CLI config Added the "analytics" property and set it to false in angular.json to disable Angular CLI usage tracking. This ensures privacy and prevents telemetry data from being sent. * Update zone.js and TypeScript dependencies Upgraded `zone.js` to version 0.14.10 and `typescript` to version 5.2.2 in both `package.json` and `package-lock.json`. These updates ensure compatibility with the latest features and fixes, improving overall project stability. * First steps for new Angular based HomeMatic ControlCenter frontend * Refactor HomeMatic frontend layout and improve device commands Refactored the `tofu-app-layout.component` to enhance the structure and styling of the frontend layout. Introduced a custom implementation for handling structural changes within the layout components. Additionally, enhanced device commands by adding support for retrieving and displaying parameter set values. Included necessary API extensions to support this functionality. Updated `ListDevicesOptions` with a default filter pattern to ensure consistent behavior. * Add CreativeCoders.HomeMatic project and initial test setup Introduced the `CreativeCoders.HomeMatic` project targeting .NET 8.0 along with its associated test project, `CreativeCoders.HomeMatic.Tests`. Added a basic unit test structure and included dependencies such as `xUnit`, `FakeItEasy`, and `FluentAssertions`. Refactored existing code to streamline null-check logic and updated solution configurations to integrate the new projects. * Replace `Array.Empty<Project>()` with shorthand `[]` in Build.cs * Refactor HomeMatic device system handling for multi-system support Replaced `HomeMaticDeviceSystem` with `HomeMaticDeviceSystems` to enable multi-system handling. Updated all related classes, methods, and enums for compatibility. Expanded project references and introduced new abstractions, including `ICcuDevice`, `ICcuDeviceChannel`, and `CcuDeviceUri`, to streamline device handling. * Refactor HomeMatic client structure for improved abstraction and multi-device support Replaced `HomeMaticDeviceSystems` with `CcuDeviceKind` for enhanced clarity and flexibility in managing multiple device types. Introduced `XmlRpcEndpoint` and updated `ICcuClient` and `CcuClientFactory` implementations. Added `HomeMaticServiceCollectionExtensions` for DI integration and expanded test coverage for `CcuClientFactory`. * Refactor `CcuClient` implementation for enhanced device handling and abstraction Updated `CcuClient` to fetch and process devices from XML-RPC and JSON-RPC sources. Introduced `CcuDevice` and `CcuDeviceChannel` classes to represent devices and channels with extended properties. Created `XmlRpcApiConnection` for managing APIs and endpoints. Adjusted namespaces and migrated interfaces (`ICcuDevice`, `ICcuClient`, etc.) to `Abstractions`. Expanded tests and fixed naming inconsistency in `CcuClientFactoryTests`. * Introduce support for multi-CCU clients and improve device handling Added `IMultiCcuClient` and `IMultiCcuClientFactory` interfaces along with corresponding implementations to enable multi-CCU client handling. Introduced `CcuDeviceBuilder` for modular device creation and updated `CcuClient` to use it. Enhanced `CcuDevice` structure with additional properties. Extended dependency injection and expanded test coverage for multi-client scenarios. * Enable multi-CCU client handling and improve device management Refactored `GetDevicesAsync` to return a `Task<IEnumerable<ICcuDevice>>`, streamlining device aggregation. Added `BuildMultiCcuClientAsync` to `ICliHomeMaticClientBuilder` for managing multiple CCUs and extended dependency injection. Updated `ListDevicesCommand` for multi-CCU support and replaced `CcuSystem` references with `Uri` properties. Expanded project dependencies to include `CreativeCoders.HomeMatic`. * Add multi-CCU naming and improve device handling structures Introduced `CcuName` to enable clearer multi-CCU identification and updated associated structures such as `CcuDeviceUri` and `XmlRpcApiConnection`. Refactored `GetDeviceAsync` in `MultiCcuClient` for single-device retrieval and adjusted CLI commands (`ListDevicesCommand`, `ShowDeviceDetailsCommand`) to support enhanced device representation. Streamlined factory methods and extended test coverage to validate changes. * Refactor device and channel abstractions; streamline property handling in `CcuDevice` and `CcuDeviceChannel` * Add support for device channels in `CcuDevice`; update builders and CLI for enhanced channel details display * Abstract common properties into `CcuDeviceBase`; refactor `CcuDevice`, `CcuDeviceChannel`, and CLI commands for extended parameter details display * Simplify parameter set and value display formatting in `ShowDeviceDetailsCommand` * Refactor `ShowDeviceDetailsCommand` to improve modularity and simplify device and channel parameter set display * Add `.editorconfig` and refactor device abstractions for improved modularity and enhanced device/channel handling Introduced `.editorconfig` file for consistent code formatting and enabled `ConfigureAwait` for library configuration. Refactored device interface structures (`ICcuDevice`, `ICcuDeviceChannel`, etc.) and introduced new abstractions (`ICompleteCcuDevice`, `ICcuDeviceChannelData`, etc.) for channel and parameter set handling. Simplified multi-CCU client device management, updated namespaces, and added unimplemented methods for future device processing. * Refactor device and channel abstractions; add `ICompleteCcuDeviceBuilder` and enhance parameter set handling Streamlined interface structures by removing unused abstractions and introducing `ICompleteCcuDeviceBuilder` for complete device construction. Improved parameter set handling with descriptions and added new entities like `CcuParameterDescription`. Updated `CcuClient` and `MultiCcuClient` for enhanced device and channel retrieval. Adjusted CLI commands to support refined data models. * Add complete device handling to `CcuClient` with `ICompleteCcuDeviceBuilder` Integrated `ICompleteCcuDeviceBuilder` into `CcuClient` and `CcuClientFactory` for constructing complete devices. Implemented `GetCompleteDevicesAsync` and `GetCompleteDeviceAsync` in `CcuClient`. Enhanced parameter set handling in `CompleteCcuDeviceBuilder` by associating values with descriptions. Adjusted factory method to support new builder dependency. * Refactor `MultiCcuClient` and `CcuClient` for enhanced device handling and error management Updated `MultiCcuClient` to improve device lookup with error handling across multiple CCUs. Refactored `CcuClient` by introducing `CreateDevice` helper method for cleaner `GetDevicesAsync` implementation. Adjusted factories and tests for `ICompleteCcuDeviceBuilder` dependency injection. Improved CLI output formatting in `ShowDeviceDetailsCommand`. * Add `ParamSetValues` to `ICompleteCcuDevice` and refactor CLI for improved parameter set display Enhanced `ICompleteCcuDevice` and `CompleteCcuDevice` by including `ParamSetValues` to support parameter descriptions. Updated `CompleteCcuDeviceBuilder` to populate `ParamSetValues` asynchronously. Refactored `ShowDeviceDetailsCommand` to improve modularity and streamline device/channel parameter set rendering. * Enhance `ShowDeviceDetailsCommand` to include control and type details for parameter sets * Move `CreativeCoders.HomeMatic` project and associated files and classes Move the `CreativeCoders.HomeMatic` project along with all related files, including `CcuClient`, `CcuDevice`, `ICompleteCcuDevice`, and their dependencies. * Add `ExportDevicesCommand` to export complete device data as JSON Introduced `ExportDevicesCommand` and associated options to enable exporting complete device data, including device, channel, and parameter set information, to a JSON file. Updated `DevicesController` to include the new "export" CLI action. * Enhance `ExportDevicesCommand` to validate output file and include detailed channel info Added validation for `OutputFileName` in options. Refactored to include detailed channel data with parameter set information in exported JSON. Switched to asynchronous file writing with `ConfigureAwait` for improved performance. * Remove unused using directives across multiple files, streamline namespaces, and refactor CLI code for improved readability * Refactor `JsonDataExporterBase` and introduce `JsonExportCommandBase` for reusable JSON export logic Enhanced `ExportDevicesCommand` by inheriting from the new `JsonExportCommandBase`, promoting reusability. Updated `JsonDataExporterBase` to support customizable console output and refactored interfaces for streamlined data export implementation. Simplified code structure and improved validation for export options. * Refactor `ExportDevicesCommand` and `JsonExportCommandBase` for improved extensibility and option handling Updated `ExportDevicesCommand` to override `TransformData` and `LoadDataAsync` for better customization. Simplified `ExportDevicesOptions` by ensuring non-null defaults for properties. Made `JsonExportCommandBase` more flexible by removing dependency on external delegates for transformation and data loading. * Refactor `MultiCcuClient` to process all clients in loop and simplify `ListDevicesCommand` constructor using property initializers * Add sorting support in `ListDevicesCommand` with new `SortField` option Updated `ListDevicesCommand` to allow sorting devices based on specified fields such as `name`, `address`, `ccu`, and `type`. Added `SortField` parameter to `ListDevicesOptions` and implemented sorting logic in the `PrintDevices` method. Included default fallback to `name` if an invalid sort field is provided. * Update dependencies and workflows across the project Bumped critical package versions (e.g., `Spectre.Console`, `FakeItEasy`, `AutoMapper`) and updated actions (`checkout`, `cache`, `upload-artifact`) in GitHub workflows. Adjusted schema and `Build.cs` settings for compatibility improvements. * Update tests to handle new `Devices` requirement in `CcuDeviceBuilder` and improve `CcuClientFactory` setup Refined test cases in `CcuDeviceBuilderTests` to include validation for `Devices` and adjusted `CcuClientFactoryTests` to mock `ICompleteCcuDeviceBuilder` via `IServiceProvider` for better test coverage. * Update `CcuDeviceBuilderTests` to include validation for `Devices` requirement * refactor(core): enhance data handling with default values and builder improvements Refactored multiple classes to initialize properties with non-null default values (`string.Empty` and empty collections). Simplified `CcuDeviceBuilder` using a new `ObjectBuilderBase` for field handling. Adjusted `Password` input in sample app to ensure non-null values. Updated `CcuDeviceInfo` annotations for broader API visibility. * refactor(cli): streamline HomeMatic client and CLI structure Removed obsolete references and redundant methods in `CliHomeMaticClientBuilder`. Simplified HomeMatic client initialization by adopting a record-like class structure with enforced non-null defaults. Cleaned up solution file by removing unused project references. Disabled unused field warnings and eliminated unnecessary `using` directives for improved code clarity. * refactor(cli): simplify `ShowDeviceDetailsCommand` constructor Replaced class initialization with primary constructor features to reduce boilerplate code. Ensured non-null validations remain intact for dependencies (`console`, `cliHomeMaticClientBuilder`). * refactor(api): remove obsolete HomeMatic API and client implementations Eliminated outdated HomeMatic API classes (`CcuConnection`, `CcuDevice`, `CcuDeviceChannel`, etc.) and client-related code (`HomeMaticClient`, `HomeMaticCcuConnection`). Removed associated project files and dependencies. Improved codebase maintainability by removing unused components and simplifying overall structure. * refactor(core): move `Abstractions` namespace to `Core` namespace Updated namespaces from `CreativeCoders.HomeMatic.Abstractions` to `CreativeCoders.HomeMatic.Core` across all related files. Adjusted all `using` directives and file paths to reflect the change for better structure and consistency in the codebase. * refactor(cli): introduce `CliCommandOptionsBase` for shared CLI option handling Created a new `CliCommandOptionsBase` class to centralize common CLI options like `Verbosity`. Updated `ShowDeviceDetailsOptions` to inherit from this base class for improved consistency and reduced code duplication. Added `CliCommandVerbosity` enum to manage verbosity levels. * migrate(build): switch from Nuke to Cake for build process Replaced Nuke build system with Cake for better flexibility and maintainability. Added `Build.csproj`, `BuildContext.cs`, and supporting files while removing Nuke-related configurations, workflows, and scripts. Updated dependencies and workflows to align with the new setup. * chore(workflows): update artifact names and simplify build steps Renamed CLI artifact from `GitTool.Cli` to `HomeMatic.Cli`. Removed unused steps for publishing setup artifacts in GitHub workflows and streamlined build targets by focusing on `CreateGitHubRelease`. * chore(build): rename CLI artifact to `HomeMatic.Cli` and remove unused setup steps Updated `DistPackageName` and `ReleaseBody` to use `HomeMatic.Cli`. Removed unused setup artifact generation and uploading from the workflow. Streamlined build target by eliminating `CreateWin64Setup`. * chore(workflows): streamline build targets and unify GitHub release steps Simplified build workflows by consolidating `CreateGitHubRelease` and `NuGetPush` steps. Updated `main.yml`, `release.yml`, and `pull-request.yml` to ensure consistent target execution. Removed redundant platform-specific setup steps. * refactor(cli): remove `ListDevicesCommand` and related options, add new CLI project Deleted `ListDevicesCommand` and its associated options to streamline the tool's command structure. Introduced a new CLI project (`CreativeCoders.HomeMatic.Tools.Cli.Hmc`) for improved modularity and maintainability. Upgraded multiple dependencies to version `6.7.0`. * refactor(cli): remove obsolete CLI project and reorganize connection commands Deleted the `CreativeCoders.HomeMatic.Tools.Cli` project to streamline the CLI structure. Renamed and reorganized connection commands under a cohesive `Connection` namespace, introducing `ConnectionCommandGroup` for better modularity. Updated build configurations and solution file accordingly. * refactor(cli): remove deprecated `Basic` commands and restructure namespaces Deleted the obsolete `CreativeCoders.HomeMatic.Tools.Cli.Commands.Basic` project and reorganized commands under the `Device` and `Connection` namespaces. Introduced `DeviceCommandGroup` for modularity and updated build configurations and references accordingly. * refactor(cli): add project reference for command module and update command registration * refactor(cli): simplify `ListDevicesCommand` table rendering with `PrintTable` utility * refactor(cli): replace `ICliHomeMaticClientBuilder` usage with `IMultiCcuClient` and update service registrations Revised `ListDevicesCommand` to use `IMultiCcuClient` directly, deprecating the asynchronous builder method. Enhanced `CcuConnectionsStore` APIs and added synchronous connection retrieval. Updated dependency injection to register `IMultiCcuClient` for improved initialization and usability. * refactor(cli): migrate `ShowDeviceDetailsCommand` and `ExportDevicesCommand` to use `IMultiCcuClient` * refactor(cli): update `ExportDevicesCommand` and JSON export logic, improve camel case serialization Updated `ExportDevicesCommand` to streamline option handling and removed redundant validation. Adjusted `JsonExportCommandBase` to simplify execution flow and return `CommandResult`. Enhanced JSON serialization with camel case property naming. Added `CreativeCoders.Cli.Core` dependency. * feat(cli): add `CliOutputCommandBase` for unified JSON and console output handling Introduced `CliOutputCommandBase` to standardize output logic across commands. Added `IJsonOutputOptions` interface for configurable JSON output. Updated base functionality to simplify execution flow and provide consistent output options. * feat(export): add device and channel export functionality with JSON serialization Introduced `DeviceExporter` to export devices and channels into JSON format. Added classes `DeviceExportOptions`, `DeviceExportData`, `ChannelExportData`, `ParamSetExportData`, and `ParamValueExportData` to support detailed export data structuring. Included camel case JSON serialization for consistency. Updated project references. * chore: add `sync-ai-config.yml` to solution * test(export): add unit tests for `DeviceExporter` and `DeviceExportOptions` - Introduced comprehensive test coverage for `DeviceExporter`, verifying device and channel export functionality, JSON serialization, and camel case property naming. - Added `DeviceExportOptionsTests` to validate param set whitelisting logic, casing insensitivity, and default behavior. - Ensured coverage for both single and multiple device export scenarios. * docs: add detailed HomeMatic XML-RPC API specification - Introduced `HomeMatic-XmlRpc.md` to document the full API specification. - Covered interface access points, data types, methods, and error codes. * refactor: improve logging and task handling in `CcuXmlRpcEventServer` - Replaced string interpolation with structured logging for consistency and readability. - Applied `ConfigureAwait(false)` to asynchronous calls for better task handling. * refactor: streamline `HomeMaticJsonRpcClient` constructor and task handling - Converted constructor to use parameterized base value assignment for improved readability. - Removed redundant field initialization. - Applied `ConfigureAwait(false)` to asynchronous calls for better task management.
1 parent 7439bf8 commit a6bc201

290 files changed

Lines changed: 38027 additions & 2747 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[*]
2+
insert_final_newline = true
3+
trim_trailing_whitespace = true
4+
5+
[*.md]
6+
insert_final_newline = true
7+
trim_trailing_whitespace = false
8+
9+
[*.{cs,vb}]
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
# IDE0060: Remove unused parameter
13+
dotnet_diagnostic.IDE0060.severity = warning
14+
configure_await_analysis_mode = library

.github/workflows/integration.yml

Lines changed: 58 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,77 @@
1-
# ------------------------------------------------------------------------------
2-
# <auto-generated>
3-
#
4-
# This code was generated.
5-
#
6-
# - To turn off auto-generation set:
7-
#
8-
# [GitHubActions (AutoGenerate = false)]
9-
#
10-
# - To trigger manual generation invoke:
11-
#
12-
# nuke --generate-configuration GitHubActions_integration --host GitHubActions
13-
#
14-
# </auto-generated>
15-
# ------------------------------------------------------------------------------
16-
171
name: integration
182

193
on:
204
push:
215
branches:
226
- 'feature/**'
23-
pull_request:
24-
branches:
25-
- main
267

278
jobs:
9+
ubuntu-latest:
10+
name: ubuntu-latest
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v5
14+
with:
15+
fetch-depth: 0
16+
- name: 'Cache: ~/.nuget/packages'
17+
uses: actions/cache@v4
18+
with:
19+
path: |
20+
~/.nuget/packages
21+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
22+
- name: 'Build with target: NuGetPush'
23+
run: ./build.cmd -t nugetpush -t publish -t createdistpackages
24+
env:
25+
NUGET_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
- name: 'Publish: coverage_report'
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: coverage-report-linux
30+
path: .tests/coverage-report
31+
- name: 'Publish: cli dist package'
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: HomeMatic.Cli
35+
path: .artifacts/dist/HomeMatic.Cli.tar.gz
2836
windows-latest:
2937
name: windows-latest
3038
runs-on: windows-latest
3139
steps:
32-
- uses: actions/checkout@v3
40+
- uses: actions/checkout@v5
3341
with:
3442
fetch-depth: 0
35-
- name: Cache .nuke/temp, ~/.nuget/packages
36-
uses: actions/cache@v3
43+
- name: 'Cache: ~/.nuget/packages'
44+
uses: actions/cache@v4
3745
with:
3846
path: |
39-
.nuke/temp
4047
~/.nuget/packages
41-
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
42-
- name: Run './build.cmd clean restore compile test pack pushnuget'
43-
run: ./build.cmd clean restore compile test pack pushnuget
48+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
49+
- name: 'Build with target: Pack'
4450
env:
4551
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
run: ./build.cmd -t pack
53+
- name: 'Publish: coverage_report'
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: coverage-report-windows
57+
path: .tests/coverage-report
58+
macos-latest:
59+
name: macos-latest
60+
runs-on: macos-latest
61+
steps:
62+
- uses: actions/checkout@v5
63+
with:
64+
fetch-depth: 0
65+
- name: 'Cache: ~/.nuget/packages'
66+
uses: actions/cache@v4
67+
with:
68+
path: |
69+
~/.nuget/packages
70+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
71+
- name: 'Build with target: Pack'
72+
run: ./build.cmd -t pack
73+
- name: 'Publish: coverage_report'
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: coverage-report-macos
77+
path: .tests/coverage-report

.github/workflows/main.yml

Lines changed: 58 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
# ------------------------------------------------------------------------------
2-
# <auto-generated>
3-
#
4-
# This code was generated.
5-
#
6-
# - To turn off auto-generation set:
7-
#
8-
# [GitHubActions (AutoGenerate = false)]
9-
#
10-
# - To trigger manual generation invoke:
11-
#
12-
# nuke --generate-configuration GitHubActions_main --host GitHubActions
13-
#
14-
# </auto-generated>
15-
# ------------------------------------------------------------------------------
16-
171
name: main
182

193
on:
@@ -22,21 +6,72 @@ on:
226
- main
237

248
jobs:
9+
ubuntu-latest:
10+
name: ubuntu-latest
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v5
14+
with:
15+
fetch-depth: 0
16+
- name: 'Cache: ~/.nuget/packages'
17+
uses: actions/cache@v4
18+
with:
19+
path: |
20+
~/.nuget/packages
21+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
22+
- name: 'Build with target: NuGetPush'
23+
run: ./build.cmd -t nugetpush -t publish -t createdistpackages -t creategithubrelease
24+
env:
25+
NUGET_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
- name: 'Publish: coverage_report'
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: coverage-report-linux
30+
path: .tests/coverage-report
31+
- name: 'Publish: cli dist package'
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: HomeMatic.Cli
35+
path: .artifacts/dist/GitTool.Cli.tar.gz
2536
windows-latest:
2637
name: windows-latest
2738
runs-on: windows-latest
2839
steps:
29-
- uses: actions/checkout@v3
40+
- uses: actions/checkout@v5
3041
with:
3142
fetch-depth: 0
32-
- name: Cache .nuke/temp, ~/.nuget/packages
33-
uses: actions/cache@v3
43+
- name: 'Cache: ~/.nuget/packages'
44+
uses: actions/cache@v4
3445
with:
3546
path: |
36-
.nuke/temp
3747
~/.nuget/packages
38-
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
39-
- name: Run './build.cmd clean restore compile test pack pushnuget'
40-
run: ./build.cmd clean restore compile test pack pushnuget
48+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
49+
- name: 'Build with target: Pack'
50+
run: ./build.cmd -t pack
4151
env:
4252
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
- name: 'Publish: coverage_report'
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: coverage-report-windows
57+
path: .tests/coverage-report
58+
macos-latest:
59+
name: macos-latest
60+
runs-on: macos-latest
61+
steps:
62+
- uses: actions/checkout@v5
63+
with:
64+
fetch-depth: 0
65+
- name: 'Cache: ~/.nuget/packages'
66+
uses: actions/cache@v4
67+
with:
68+
path: |
69+
~/.nuget/packages
70+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
71+
- name: 'Build with target: Pack'
72+
run: ./build.cmd -t pack
73+
- name: 'Publish: coverage_report'
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: coverage-report-macos
77+
path: .tests/coverage-report

.github/workflows/pull-request.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: pull-request
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
ubuntu-latest:
10+
name: ubuntu-latest
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v5
14+
with:
15+
fetch-depth: 0
16+
- name: 'Cache: ~/.nuget/packages'
17+
uses: actions/cache@v4
18+
with:
19+
path: |
20+
~/.nuget/packages
21+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
22+
- name: 'Build with target: Pack'
23+
run: ./build.cmd -t pack
24+
- name: 'Publish: coverage_report'
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: coverage-report-linux
28+
path: .tests/coverage-report
29+
windows-latest:
30+
name: windows-latest
31+
runs-on: windows-latest
32+
steps:
33+
- uses: actions/checkout@v5
34+
with:
35+
fetch-depth: 0
36+
- name: 'Cache: ~/.nuget/packages'
37+
uses: actions/cache@v4
38+
with:
39+
path: |
40+
~/.nuget/packages
41+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
42+
- name: 'Build with target: Pack'
43+
run: ./build.cmd -t pack
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
- name: 'Publish: coverage_report'
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: coverage-report-windows
50+
path: .tests/coverage-report
51+
macos-latest:
52+
name: macos-latest
53+
runs-on: macos-latest
54+
steps:
55+
- uses: actions/checkout@v5
56+
with:
57+
fetch-depth: 0
58+
- name: 'Cache: ~/.nuget/packages'
59+
uses: actions/cache@v4
60+
with:
61+
path: |
62+
~/.nuget/packages
63+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
64+
- name: 'Build with target: Pack'
65+
run: ./build.cmd -t pack
66+
- name: 'Publish: coverage_report'
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: coverage-report-macos
70+
path: .tests/coverage-report

.github/workflows/release.yml

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,39 @@
1-
# ------------------------------------------------------------------------------
2-
# <auto-generated>
3-
#
4-
# This code was generated.
5-
#
6-
# - To turn off auto-generation set:
7-
#
8-
# [GitHubActions (AutoGenerate = false)]
9-
#
10-
# - To trigger manual generation invoke:
11-
#
12-
# nuke --generate-configuration GitHubActions_release --host GitHubActions
13-
#
14-
# </auto-generated>
15-
# ------------------------------------------------------------------------------
16-
171
name: release
182

3+
concurrency:
4+
group: release-${{ github.ref }}
5+
cancel-in-progress: false
6+
197
on:
208
push:
219
tags:
2210
- 'v**'
2311

2412
jobs:
25-
windows-latest:
26-
name: windows-latest
27-
runs-on: windows-latest
13+
ubuntu-latest:
14+
name: ubuntu-latest
15+
runs-on: ubuntu-latest
2816
steps:
29-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v5
3018
with:
3119
fetch-depth: 0
32-
- name: Cache .nuke/temp, ~/.nuget/packages
33-
uses: actions/cache@v3
20+
- name: 'Cache: ~/.nuget/packages'
21+
uses: actions/cache@v4
3422
with:
3523
path: |
36-
.nuke/temp
3724
~/.nuget/packages
38-
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
39-
- name: Run './build.cmd clean restore compile test pack pushnuget'
40-
run: ./build.cmd clean restore compile test pack pushnuget
25+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
26+
- name: 'Build with target: NuGetPush'
27+
run: ./build.cmd -t pack -t nugetpush -t publish -t createdistpackages -t creategithubrelease
4128
env:
42-
NUGET_ORG_TOKEN: ${{ secrets.NUGET_ORG_TOKEN }}
43-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
NUGET_TOKEN: ${{ secrets.NUGET_ORG_TOKEN }}
30+
- name: 'Publish: coverage_report'
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: coverage-report-linux
34+
path: .tests/coverage-report
35+
- name: 'Publish: cli dist package'
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: HomeMatic.Cli
39+
path: .artifacts/dist/HomeMatic.Cli.tar.gz

0 commit comments

Comments
 (0)