From 6baf6243425c59f30ac5c5654b5ecd282ce167b7 Mon Sep 17 00:00:00 2001 From: MatteoDelOmbra Date: Wed, 10 Dec 2025 10:36:03 +0100 Subject: [PATCH 1/8] refactor --- .github/workflows/AutoBuild.yml | 8 +- .github/workflows/BuildMaster.yml | 8 +- .gitignore | 2 + .../workflows/Execute_release.yml | 2 + .../workflows/Execute_test_on_main.yml} | 4 +- .../workflows/Execute_test_on_push.yml} | 4 +- .../.template.config/template.json | 162 ++----- Frends.Template/Apache-2.0 | 93 ---- .../Frends.Echo.Execute.Tests.csproj | 27 -- .../GlobalSuppressions.cs | 11 - .../Frends.Echo.Execute/.gitignore | 421 ++++++++++++++++++ .../{ => Frends.Echo.Execute}/CHANGELOG.md | 0 .../ErrorHandlerTest.cs | 0 .../Frends.Echo.Execute.Tests.csproj | 18 + .../GlobalSuppressions.cs | 7 + .../Frends.Echo.Execute.Tests/UnitTests.cs | 0 .../Frends.Echo.Execute.sln | 4 +- .../Definitions/Connection.cs | 0 .../Definitions/Error.cs | 0 .../Definitions/Input.cs | 0 .../Definitions/Options.cs | 2 +- .../Definitions/Result.cs | 2 +- .../Frends.Echo.Execute.cs | 4 +- .../Frends.Echo.Execute.csproj | 36 +- .../FrendsTaskMetadata.json | 0 .../GlobalSuppressions.cs | 11 +- .../Helpers/ErrorHandler.cs | 24 + .../{ => Frends.Echo.Execute}/migration.json | 0 .../Helpers/ErrorHandler.cs | 32 -- .../{ => Frends.Echo.Execute}/LICENSE | 0 .../{ => Frends.Echo.Execute}/README.md | 8 +- Frends.Template/setup.cmd | 17 - Frends.Template/setup.sh | 32 -- FrendsTaskTemplate.csproj | 9 +- README.md | 35 +- 35 files changed, 575 insertions(+), 408 deletions(-) rename Frends.Template/{ => .github}/workflows/Execute_release.yml (90%) rename Frends.Template/{workflows/Execute_build_and_test_on_main.yml => .github/workflows/Execute_test_on_main.yml} (87%) rename Frends.Template/{workflows/Execute_build_and_test_on_push.yml => .github/workflows/Execute_test_on_push.yml} (88%) delete mode 100644 Frends.Template/Apache-2.0 delete mode 100644 Frends.Template/Frends.Echo.Execute.Tests/Frends.Echo.Execute.Tests.csproj delete mode 100644 Frends.Template/Frends.Echo.Execute.Tests/GlobalSuppressions.cs create mode 100644 Frends.Template/Frends.Echo.Execute/.gitignore rename Frends.Template/{ => Frends.Echo.Execute}/CHANGELOG.md (100%) rename Frends.Template/{ => Frends.Echo.Execute}/Frends.Echo.Execute.Tests/ErrorHandlerTest.cs (100%) create mode 100644 Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/Frends.Echo.Execute.Tests.csproj create mode 100644 Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/GlobalSuppressions.cs rename Frends.Template/{ => Frends.Echo.Execute}/Frends.Echo.Execute.Tests/UnitTests.cs (100%) rename Frends.Template/{ => Frends.Echo.Execute}/Frends.Echo.Execute.sln (89%) rename Frends.Template/Frends.Echo.Execute/{ => Frends.Echo.Execute}/Definitions/Connection.cs (100%) rename Frends.Template/Frends.Echo.Execute/{ => Frends.Echo.Execute}/Definitions/Error.cs (100%) rename Frends.Template/Frends.Echo.Execute/{ => Frends.Echo.Execute}/Definitions/Input.cs (100%) rename Frends.Template/Frends.Echo.Execute/{ => Frends.Echo.Execute}/Definitions/Options.cs (96%) rename Frends.Template/Frends.Echo.Execute/{ => Frends.Echo.Execute}/Definitions/Result.cs (99%) rename Frends.Template/Frends.Echo.Execute/{ => Frends.Echo.Execute}/Frends.Echo.Execute.cs (94%) rename Frends.Template/Frends.Echo.Execute/{ => Frends.Echo.Execute}/Frends.Echo.Execute.csproj (52%) rename Frends.Template/Frends.Echo.Execute/{ => Frends.Echo.Execute}/FrendsTaskMetadata.json (100%) rename Frends.Template/Frends.Echo.Execute/{ => Frends.Echo.Execute}/GlobalSuppressions.cs (51%) create mode 100644 Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute/Helpers/ErrorHandler.cs rename Frends.Template/Frends.Echo.Execute/{ => Frends.Echo.Execute}/migration.json (100%) delete mode 100644 Frends.Template/Frends.Echo.Execute/Helpers/ErrorHandler.cs rename Frends.Template/{ => Frends.Echo.Execute}/LICENSE (100%) rename Frends.Template/{ => Frends.Echo.Execute}/README.md (75%) delete mode 100644 Frends.Template/setup.cmd delete mode 100644 Frends.Template/setup.sh diff --git a/.github/workflows/AutoBuild.yml b/.github/workflows/AutoBuild.yml index e4d8960..7936026 100644 --- a/.github/workflows/AutoBuild.yml +++ b/.github/workflows/AutoBuild.yml @@ -1,4 +1,6 @@ name: AutoBuild +permissions: + contents: read on: push: @@ -13,14 +15,14 @@ jobs: name: AutoBuild on ubuntu-latest runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.2.2 + - uses: actions/checkout@v6.0.1 - name: Pack release version run: dotnet pack --configuration Release - - uses: actions/setup-dotnet@v4.3.1 + - uses: actions/setup-dotnet@v5.0.1 with: - dotnet-version: '6.0.x' + dotnet-version: '8.0.x' source-url: ${{ env.azure_artifacts_feed_url }} env: NUGET_AUTH_TOKEN: ${{ secrets.TASKS_TEST_FEED_API_KEY }} diff --git a/.github/workflows/BuildMaster.yml b/.github/workflows/BuildMaster.yml index 7bcaab7..775c1b1 100644 --- a/.github/workflows/BuildMaster.yml +++ b/.github/workflows/BuildMaster.yml @@ -1,4 +1,6 @@ name: BuildMaster +permissions: + contents: read on: push: @@ -13,14 +15,14 @@ jobs: name: Build master on ubuntu-latest runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.2.2 + - uses: actions/checkout@v6.0.1 - name: Pack release version run: dotnet pack --configuration Release - - uses: actions/setup-dotnet@v4.3.1 + - uses: actions/setup-dotnet@v5.0.1 with: - dotnet-version: '6.0.x' + dotnet-version: '8.0.x' source-url: ${{ env.azure_artifacts_feed_url }} env: NUGET_AUTH_TOKEN: ${{ secrets.TASKS_FEED_API_KEY }} diff --git a/.gitignore b/.gitignore index 8114573..3897215 100644 --- a/.gitignore +++ b/.gitignore @@ -467,3 +467,5 @@ Network Trash Folder Temporary Items .apdisk +# Rider idea files +.idea/ diff --git a/Frends.Template/workflows/Execute_release.yml b/Frends.Template/.github/workflows/Execute_release.yml similarity index 90% rename from Frends.Template/workflows/Execute_release.yml rename to Frends.Template/.github/workflows/Execute_release.yml index 70dd6b7..7e14a12 100644 --- a/Frends.Template/workflows/Execute_release.yml +++ b/Frends.Template/.github/workflows/Execute_release.yml @@ -1,4 +1,6 @@ name: Execute_release +permissions: + contents: write on: workflow_dispatch: diff --git a/Frends.Template/workflows/Execute_build_and_test_on_main.yml b/Frends.Template/.github/workflows/Execute_test_on_main.yml similarity index 87% rename from Frends.Template/workflows/Execute_build_and_test_on_main.yml rename to Frends.Template/.github/workflows/Execute_test_on_main.yml index a661c08..1609f17 100644 --- a/Frends.Template/workflows/Execute_build_and_test_on_main.yml +++ b/Frends.Template/.github/workflows/Execute_test_on_main.yml @@ -1,4 +1,6 @@ -name: Execute_build_main +name: Execute_test_on_main +permissions: + contents: read on: push: diff --git a/Frends.Template/workflows/Execute_build_and_test_on_push.yml b/Frends.Template/.github/workflows/Execute_test_on_push.yml similarity index 88% rename from Frends.Template/workflows/Execute_build_and_test_on_push.yml rename to Frends.Template/.github/workflows/Execute_test_on_push.yml index 68ef71b..7315059 100644 --- a/Frends.Template/workflows/Execute_build_and_test_on_push.yml +++ b/Frends.Template/.github/workflows/Execute_test_on_push.yml @@ -1,4 +1,6 @@ -name: Execute_build_test +name: Execute_test_on_push +permissions: + contents: read on: push: diff --git a/Frends.Template/.template.config/template.json b/Frends.Template/.template.config/template.json index 85c11b5..e93bcda 100644 --- a/Frends.Template/.template.config/template.json +++ b/Frends.Template/.template.config/template.json @@ -5,38 +5,59 @@ "Solution" ], "name": "Frends Task", - "identity": "FrendsTaskTemplate", - "shortName": "frendstasktemplate", + "identity": "FrendsTask", + "shortName": "frends-task", "tags": { "language": "C#", "type": "solution" }, "sourceName": "Frends.Echo.Execute", - "preferNameDirectory": true, "symbols": { + "Description": { + "type": "parameter", + "datatype": "string", + "defaultValue": "Description of the Task", + "description": "Description of what the Task will do.", + "replaces": "TaskDescription" + }, "FullTaskName": { + "isRequired": true, "type": "parameter", "datatype": "string", "defaultValue": "Frends.Echo.Execute", - "replaces": "Frends.Echo.Execute", - "description": "Full name in format: Frends.ClassName.MethodName" + "description": "Full name in format: Company.System.Action e.g. Frends.Xml.Write" }, - "className": { + "name": { + "type": "generated", + "generator": "join", + "parameters": { + "symbols": [ + { + "type": "ref", + "value": "FullTaskName" + } + ] + } + }, + "CompanyName": { "type": "derived", "valueSource": "FullTaskName", - "valueTransform": "GetClassName", - "replaces": "Echo" + "valueTransform": "GetCompanyName", + "replaces": "Frends", + "FileRename": "Frends" }, - "taskName": { + "ClassName": { "type": "derived", "valueSource": "FullTaskName", - "valueTransform": "GetMethodName", - "replaces": "Execute" + "valueTransform": "GetSystemName", + "replaces": "Echo", + "FileRename": "Echo" }, - "workflows": { + "TaskName": { "type": "derived", "valueSource": "FullTaskName", - "valueTransform": "GetMethodName", + "valueTransform": "GetActionName", + "replaces": "Execute", "FileRename": "Execute" }, "CurrentDate": { @@ -57,117 +78,20 @@ } }, "forms": { - "GetClassName": { + "GetCompanyName": { + "identifier": "replace", + "pattern": "^([^.]+)\\.[^.]+\\.[^.]+$", + "replacement": "$1" + }, + "GetSystemName": { "identifier": "replace", "pattern": "^.*\\.([^.]+)\\.[^.]+$", "replacement": "$1" }, - "GetMethodName": { + "GetActionName": { "identifier": "replace", "pattern": "^.*\\.([^.]+)$", "replacement": "$1" } - }, - "SpecialCustomOperations": { - "**/*.md": { - "operations": [ - { - "type": "conditional", - "configuration": { - "if": [ - "---#if" - ], - "else": [ - "---#else" - ], - "elseif": [ - "---#elseif", - "---#elif" - ], - "endif": [ - "---#endif" - ], - "trim": "true", - "wholeLine": "true" - } - } - ] - }, - "**/*.csproj": { - "operations": [ - { - "type": "conditional", - "configuration": { - "actionableIf": [ - "