diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..6f7b587 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,145 @@ +name: Build +on: + push: + branches: + - main + pull_request: + types: + - opened + - synchronize + - reopened + - closed + branches: + - main +env: + IS_RELEASE_CANDIDATE: >- + ${{ + ( + github.event_name == 'pull_request' && + startsWith(github.event.pull_request.title, 'RELEASES:') && + contains(github.event.pull_request.labels.*.name, 'RELEASES') + ) + || + ( + github.event_name == 'push' && + startsWith(github.event.head_commit.message, 'RELEASES:') && + startsWith(github.ref_name, 'RELEASE') + ) + }} +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v3 + - name: Setup .Net + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.0.201 + - name: Restore + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal + add_tag: + runs-on: ubuntu-latest + needs: + - build + if: >- + needs.build.result == 'success' && + + github.event.pull_request.merged && + + github.event.pull_request.base.ref == 'main' && + + startsWith(github.event.pull_request.title, 'RELEASES:') && + + contains(github.event.pull_request.labels.*.name, 'RELEASES') + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + token: ${{ secrets.PAT_FOR_TAGGING }} + - name: Configure Git + run: >- + git config user.name "GitHub Action" + + git config user.email "action@github.com" + - name: Extract Version + id: extract_version + run: > + # Running on Linux/Unix + + sudo apt-get install xmlstarlet + + version_number=$(xmlstarlet sel -t -v "//Version" -n STX.REST.RESTFulSense.Servers/STX.REST.RESTFulSense.Servers.csproj) + + echo "$version_number" + + echo "version_number<> $GITHUB_OUTPUT + + echo "$version_number" >> $GITHUB_OUTPUT + + echo "EOF" >> $GITHUB_OUTPUT + shell: bash + - name: Display Version + run: 'echo "Version number: ${{ steps.extract_version.outputs.version_number }}"' + - name: Extract Package Release Notes + id: extract_package_release_notes + run: > + # Running on Linux/Unix + + sudo apt-get install xmlstarlet + + package_release_notes=$(xmlstarlet sel -t -v "//PackageReleaseNotes" -n STX.REST.RESTFulSense.Servers/STX.REST.RESTFulSense.Servers.csproj) + + echo "$package_release_notes" + + echo "package_release_notes<> $GITHUB_OUTPUT + + echo "$package_release_notes" >> $GITHUB_OUTPUT + + echo "EOF" >> $GITHUB_OUTPUT + shell: bash + - name: Display Package Release Notes + run: 'echo "Package Release Notes: ${{ steps.extract_package_release_notes.outputs.package_release_notes }}"' + - name: Create GitHub Tag + run: >- + git tag -a "v${{ steps.extract_version.outputs.version_number }}" -m "Release - v${{ steps.extract_version.outputs.version_number }}" + + git push origin --tags + - name: Create GitHub Release + uses: actions/create-release@v1 + with: + tag_name: v${{ steps.extract_version.outputs.version_number }} + release_name: Release - v${{ steps.extract_version.outputs.version_number }} + body: >- + ## Release - v${{ steps.extract_version.outputs.version_number }} + + + ### Release Notes + + ${{ steps.extract_package_release_notes.outputs.package_release_notes }} + env: + GITHUB_TOKEN: ${{ secrets.PAT_FOR_TAGGING }} + publish: + runs-on: ubuntu-latest + needs: + - add_tag + if: needs.add_tag.result == 'success' + steps: + - name: Check out + uses: actions/checkout@v3 + - name: Setup .Net + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.0.201 + - name: Restore + run: dotnet restore + - name: Build + run: dotnet build --no-restore --configuration Release + - name: Pack NuGet Package + run: dotnet pack --configuration Release --include-symbols + - name: Push NuGet Package + run: dotnet nuget push **/bin/Release/**/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ACCESS }} --skip-duplicate diff --git a/LICENSE b/License.txt similarity index 100% rename from LICENSE rename to License.txt diff --git a/README.md b/README.md index 05c41f8..ed13646 100644 --- a/README.md +++ b/README.md @@ -1 +1,45 @@ -# STX.REST.RESTFulSense.Servers \ No newline at end of file +

+ +

+ +# STX.REST.RESTFulSense.Servers + +[![Build](https://github.com/The-Standard-Organization/STX.REST.RESTFulSense.Servers/actions/workflows/build.yml/badge.svg)](https://github.com/The-Standard-Organization/STX.REST.RESTFulSense.Servers/actions/workflows/build.yml) +[![The Standard](https://img.shields.io/github/v/release/hassanhabib/The-Standard?filter=v2.10.0&style=default&label=Standard%20Version&color=2ea44f)](https://github.com/hassanhabib/The-Standard) +[![The Standard - COMPLIANT](https://img.shields.io/badge/The_Standard-COMPLIANT-2ea44f)](https://github.com/hassanhabib/The-Standard) +[![The Standard Community](https://img.shields.io/discord/934130100008538142?color=%237289da&label=The%20Standard%20Community&logo=Discord)](https://discord.gg/vdPZ7hS52X) + +## Introduction +Is a Standard Compliant Server library that provides various methods for returning various meaningful HTTP response types in a RESTful API... + +## Standard-Compliance +This library was built according to The Standard. The library follows engineering principles, patterns and tooling as recommended by The Standard. + +This library is also a community effort which involved many nights of pair-programming, test-driven development and in-depth exploration research and design discussions. + +## Standard-Promise +The most important fulfillment aspect in a Standard complaint system is aimed towards contributing to people, its evolution, and principles. +An organization that systematically honors an environment of learning, training, and sharing knowledge is an organization that learns from the past, makes calculated risks for the future, +and brings everyone within it up to speed on the current state of things as honestly, rapidly, and efficiently as possible. + +We believe that everyone has the right to privacy, and will never do anything that could violate that right. +We are committed to writing ethical and responsible software, and will always strive to use our skills, coding, and systems for the good. +We believe that these beliefs will help to ensure that our software(s) are safe and secure and that it will never be used to harm or collect personal data for malicious purposes. + +The Standard Community as a promise to you is in upholding these values. + +## Current Outlook of the Project +In the outset of this endeavor we plan to re-write the existing popular library RESTFulSense to enhance and bring current to modern Standard compliancy. + +## Contact + +If you have any suggestions, comments or questions, please feel free to contact me on: + +[Twitter](https://twitter.com/hassanrezkhabib) + +[LinkedIn](https://www.linkedin.com/in/hassanrezkhabib/) + +[E-Mail](mailto:hassanhabib@live.com) + +### Important Notice +A special thanks to Mr. Hassan Habib and Mr. Christo du Toit for their continuing dedicated contributions. \ No newline at end of file diff --git a/Resources/Diagrams/.$stx-rs.drawio.bkp b/Resources/Diagrams/.$stx-rs.drawio.bkp new file mode 100644 index 0000000..eda32f2 --- /dev/null +++ b/Resources/Diagrams/.$stx-rs.drawio.bkp @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Resources/Diagrams/stx-rs.drawio b/Resources/Diagrams/stx-rs.drawio new file mode 100644 index 0000000..caec419 --- /dev/null +++ b/Resources/Diagrams/stx-rs.drawio @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Resources/Diagrams/stx-rs.drawio.png b/Resources/Diagrams/stx-rs.drawio.png new file mode 100644 index 0000000..8abd569 Binary files /dev/null and b/Resources/Diagrams/stx-rs.drawio.png differ diff --git a/Resources/Images/RESTFulSense.png b/Resources/Images/RESTFulSense.png new file mode 100644 index 0000000..c9b9c51 Binary files /dev/null and b/Resources/Images/RESTFulSense.png differ diff --git a/Resources/Images/restfulsense.ico b/Resources/Images/restfulsense.ico new file mode 100644 index 0000000..53efbc6 Binary files /dev/null and b/Resources/Images/restfulsense.ico differ diff --git a/Resources/Images/restfulsense_128.png b/Resources/Images/restfulsense_128.png new file mode 100644 index 0000000..0109495 Binary files /dev/null and b/Resources/Images/restfulsense_128.png differ diff --git a/Resources/Images/restfulsense_256.png b/Resources/Images/restfulsense_256.png new file mode 100644 index 0000000..bcef979 Binary files /dev/null and b/Resources/Images/restfulsense_256.png differ diff --git a/Resources/Images/restfulsense_384.png b/Resources/Images/restfulsense_384.png new file mode 100644 index 0000000..0b2956b Binary files /dev/null and b/Resources/Images/restfulsense_384.png differ diff --git a/Resources/Images/restfulsense_48.png b/Resources/Images/restfulsense_48.png new file mode 100644 index 0000000..3be03e9 Binary files /dev/null and b/Resources/Images/restfulsense_48.png differ diff --git a/Resources/Images/restfulsense_64.png b/Resources/Images/restfulsense_64.png new file mode 100644 index 0000000..26f3b4d Binary files /dev/null and b/Resources/Images/restfulsense_64.png differ diff --git a/Resources/Images/restfulsense_mac.icns b/Resources/Images/restfulsense_mac.icns new file mode 100644 index 0000000..4b30244 Binary files /dev/null and b/Resources/Images/restfulsense_mac.icns differ diff --git a/Resources/Images/rs_git_logo.png b/Resources/Images/rs_git_logo.png new file mode 100644 index 0000000..8831b8b Binary files /dev/null and b/Resources/Images/rs_git_logo.png differ diff --git a/STX.REST.RESTFulSense.Servers.Infrastructure.Build/Program.cs b/STX.REST.RESTFulSense.Servers.Infrastructure.Build/Program.cs new file mode 100644 index 0000000..23d38c9 --- /dev/null +++ b/STX.REST.RESTFulSense.Servers.Infrastructure.Build/Program.cs @@ -0,0 +1,17 @@ +// ---------------------------------------------------------------------------------- +// Copyright (c) The Standard Organization: A coalition of the Good-Hearted Engineers +// ---------------------------------------------------------------------------------- + +using STX.REST.RESTFulSense.Servers.Infrastructure.Build.Services; + +namespace STX.REST.RESTFulSense.Servers.Infrastructure.Build +{ + internal class Program + { + static void Main(string[] args) + { + var scriptGenerationService = new ScriptGenerationService(); + scriptGenerationService.GenerateBuildScript(); + } + } +} diff --git a/STX.REST.RESTFulSense.Servers.Infrastructure.Build/STX.REST.RESTFulSense.Servers.Infrastructure.Build.csproj b/STX.REST.RESTFulSense.Servers.Infrastructure.Build/STX.REST.RESTFulSense.Servers.Infrastructure.Build.csproj new file mode 100644 index 0000000..902c8eb --- /dev/null +++ b/STX.REST.RESTFulSense.Servers.Infrastructure.Build/STX.REST.RESTFulSense.Servers.Infrastructure.Build.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + disable + enable + false + + + + + + + diff --git a/STX.REST.RESTFulSense.Servers.Infrastructure.Build/Services/ScriptGenerationService.cs b/STX.REST.RESTFulSense.Servers.Infrastructure.Build/Services/ScriptGenerationService.cs new file mode 100644 index 0000000..44d1e2e --- /dev/null +++ b/STX.REST.RESTFulSense.Servers.Infrastructure.Build/Services/ScriptGenerationService.cs @@ -0,0 +1,122 @@ +// ---------------------------------------------------------------------------------- +// Copyright (c) The Standard Organization: A coalition of the Good-Hearted Engineers +// ---------------------------------------------------------------------------------- + +using System.Collections.Generic; +using System.IO; +using ADotNet.Clients; +using ADotNet.Models.Pipelines.GithubPipelines.DotNets; +using ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks; +using ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks.SetupDotNetTaskV3s; + +namespace STX.REST.RESTFulSense.Servers.Infrastructure.Build.Services +{ + internal class ScriptGenerationService + { + private readonly ADotNetClient adotNetClient; + + public ScriptGenerationService() => + adotNetClient = new ADotNetClient(); + + public void GenerateBuildScript() + { + string branchName = "main"; + + var githubPipeline = new GithubPipeline + { + Name = "Build", + + OnEvents = new Events + { + Push = new PushEvent + { + Branches = new string[] { branchName } + }, + + PullRequest = new PullRequestEvent + { + Types = new string[] { "opened", "synchronize", "reopened", "closed" }, + Branches = new string[] { branchName } + } + }, + + EnvironmentVariables = new Dictionary + { + { "IS_RELEASE_CANDIDATE", EnvironmentVariables.IsGitHubReleaseCandidate() } + }, + + Jobs = new Dictionary + { + { + "build", + new Job + { + RunsOn = BuildMachines.UbuntuLatest, + + Steps = new List + { + new CheckoutTaskV3 + { + Name = "Check out" + }, + + new SetupDotNetTaskV3 + { + Name = "Setup .Net", + + With = new TargetDotNetVersionV3 + { + DotNetVersion = "7.0.201" + } + }, + + new RestoreTask + { + Name = "Restore" + }, + + new DotNetBuildTask + { + Name = "Build" + }, + + new TestTask + { + Name = "Test" + } + } + } + }, + { + "add_tag", + new TagJob( + runsOn: BuildMachines.UbuntuLatest, + dependsOn: "build", + projectRelativePath: "STX.REST.RESTFulSense.Servers/STX.REST.RESTFulSense.Servers.csproj", + githubToken: "${{ secrets.PAT_FOR_TAGGING }}", + branchName: branchName) + }, + { + "publish", + new PublishJob( + runsOn: BuildMachines.UbuntuLatest, + dependsOn: "add_tag", + nugetApiKey: "${{ secrets.NUGET_ACCESS }}") + } + } + }; + + string buildScriptPath = "../../../../.github/workflows/build.yml"; + string directoryPath = Path.GetDirectoryName(buildScriptPath); + + if (!Directory.Exists(directoryPath)) + { + Directory.CreateDirectory(directoryPath); + } + + adotNetClient.SerializeAndWriteToFile( + adoPipeline: githubPipeline, + path: buildScriptPath); + } + } +} diff --git a/STX.REST.RESTFulSense.Servers.Tests.Acceptance/STX.REST.RESTFulSense.Servers.Tests.Acceptance.csproj b/STX.REST.RESTFulSense.Servers.Tests.Acceptance/STX.REST.RESTFulSense.Servers.Tests.Acceptance.csproj new file mode 100644 index 0000000..4e9064a --- /dev/null +++ b/STX.REST.RESTFulSense.Servers.Tests.Acceptance/STX.REST.RESTFulSense.Servers.Tests.Acceptance.csproj @@ -0,0 +1,24 @@ + + + + net8.0 + disable + enable + false + true + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/STX.REST.RESTFulSense.Servers.Tests.Unit/STX.REST.RESTFulSense.Servers.Tests.Unit.csproj b/STX.REST.RESTFulSense.Servers.Tests.Unit/STX.REST.RESTFulSense.Servers.Tests.Unit.csproj new file mode 100644 index 0000000..4e9064a --- /dev/null +++ b/STX.REST.RESTFulSense.Servers.Tests.Unit/STX.REST.RESTFulSense.Servers.Tests.Unit.csproj @@ -0,0 +1,24 @@ + + + + net8.0 + disable + enable + false + true + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/STX.REST.RESTFulSense.Servers.sln b/STX.REST.RESTFulSense.Servers.sln new file mode 100644 index 0000000..3cba747 --- /dev/null +++ b/STX.REST.RESTFulSense.Servers.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34511.84 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STX.REST.RESTFulSense.Servers.Infrastructure.Build", "STX.REST.RESTFulSense.Servers.Infrastructure.Build\STX.REST.RESTFulSense.Servers.Infrastructure.Build.csproj", "{86F966F3-3687-4039-AF8B-7725A2C37DA1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STX.REST.RESTFulSense.Servers", "STX.REST.RESTFulSense.Servers\STX.REST.RESTFulSense.Servers.csproj", "{CF3DDBED-856C-422B-B301-C3034C738D99}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STX.REST.RESTFulSense.Servers.Tests.Unit", "STX.REST.RESTFulSense.Servers.Tests.Unit\STX.REST.RESTFulSense.Servers.Tests.Unit.csproj", "{88EFB98C-9B35-4AE4-99F3-7ED49EC9885F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STX.REST.RESTFulSense.Servers.Tests.Acceptance", "STX.REST.RESTFulSense.Servers.Tests.Acceptance\STX.REST.RESTFulSense.Servers.Tests.Acceptance.csproj", "{2D9B2FFC-7B41-4DE7-A187-AA58CCD763BA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {86F966F3-3687-4039-AF8B-7725A2C37DA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {86F966F3-3687-4039-AF8B-7725A2C37DA1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {86F966F3-3687-4039-AF8B-7725A2C37DA1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {86F966F3-3687-4039-AF8B-7725A2C37DA1}.Release|Any CPU.Build.0 = Release|Any CPU + {CF3DDBED-856C-422B-B301-C3034C738D99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CF3DDBED-856C-422B-B301-C3034C738D99}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CF3DDBED-856C-422B-B301-C3034C738D99}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CF3DDBED-856C-422B-B301-C3034C738D99}.Release|Any CPU.Build.0 = Release|Any CPU + {88EFB98C-9B35-4AE4-99F3-7ED49EC9885F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88EFB98C-9B35-4AE4-99F3-7ED49EC9885F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88EFB98C-9B35-4AE4-99F3-7ED49EC9885F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88EFB98C-9B35-4AE4-99F3-7ED49EC9885F}.Release|Any CPU.Build.0 = Release|Any CPU + {2D9B2FFC-7B41-4DE7-A187-AA58CCD763BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2D9B2FFC-7B41-4DE7-A187-AA58CCD763BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2D9B2FFC-7B41-4DE7-A187-AA58CCD763BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2D9B2FFC-7B41-4DE7-A187-AA58CCD763BA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {049C7F8A-5E34-4F03-BFA4-0B096DA02D11} + EndGlobalSection +EndGlobal diff --git a/STX.REST.RESTFulSense.Servers/STX.REST.RESTFulSense.Servers.csproj b/STX.REST.RESTFulSense.Servers/STX.REST.RESTFulSense.Servers.csproj new file mode 100644 index 0000000..09eb1bc --- /dev/null +++ b/STX.REST.RESTFulSense.Servers/STX.REST.RESTFulSense.Servers.csproj @@ -0,0 +1,53 @@ + + + + net8.0 + disable + enable + STX.REST.RESTFulSense + STX.REST.RESTFulSense + STX.REST.RESTFulSense + The Standard Community + The Standard Community + RESTFul Integration w/ Love <3 + The Standard Community 2024 (c) + RESTFulSense.png + https://github.com/The-Standard-Organization/STX.REST.RESTFulSense + https://github.com/The-Standard-Organization/STX.REST.RESTFulSense + git + Standard; REST; RESTFulSense; API; .NET; Client; Server; The Standard + + Initial release of STX.REST.RESTFulSense. + + True + 0.1.0 + 0.1.0 + 0.1.0 + README.md + License.txt + True + + + + + true + + Always + + + True + + + + True + + + + + + + + + + +