From 17f331e98745c684967940f0ab9b4c494afb8316 Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Mon, 7 Aug 2023 15:52:52 +0100 Subject: [PATCH 01/14] Start work for issue #14 From 3373f587eb845d1a635d396bb7b11d96184c35d5 Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Mon, 7 Aug 2023 15:57:15 +0100 Subject: [PATCH 02/14] ci: create workflow to auto add issues and prs to the org project --- .../workflows/add-new-issue-to-project.yml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/add-new-issue-to-project.yml diff --git a/.github/workflows/add-new-issue-to-project.yml b/.github/workflows/add-new-issue-to-project.yml new file mode 100644 index 0000000..39336ef --- /dev/null +++ b/.github/workflows/add-new-issue-to-project.yml @@ -0,0 +1,21 @@ +name: 🤖Add New Issue To Project + + +on: + issues: + types: opened + pull_request: + types: opened + branches: [main, preview] + + +jobs: + add_new_issue_to_project: + name: Add New Issue + uses: KinsonDigital/Infrastructure/.github/workflows/add-issue-to-project.yml@v10.2.0 + with: + org-name: "${{ vars.ORGANIZATION_NAME }}" + org-project-name: "${{ vars.ORG_PROJECT_NAME }}" + project-name: "${{ vars.PROJECT_NAME }}" + secrets: + cicd-pat: ${{ secrets.CICD_TOKEN }} From 32111491844497c178ce9a7da01eac37666824ef Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Mon, 7 Aug 2023 16:30:39 +0100 Subject: [PATCH 03/14] ci: create build status check workflow --- .github/workflows/build-status-check.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/build-status-check.yml diff --git a/.github/workflows/build-status-check.yml b/.github/workflows/build-status-check.yml new file mode 100644 index 0000000..07f608a --- /dev/null +++ b/.github/workflows/build-status-check.yml @@ -0,0 +1,22 @@ +name: ✅Build Status Check +run-name: ✅Build Status Check (${{ github.base_ref }} branch) + + +defaults: + run: + shell: pwsh + + +on: + pull_request: + branches: [main, preview] + + +jobs: + build_status_check: + name: ${{ vars.PROJECT_NAME }} Build Status Check + uses: KinsonDigital/Infrastructure/.github/workflows/build-csharp-project.yml@v10.2.0 + with: + project-name: "${{ vars.PROJECT_NAME }}" + build-config: Debug + net-sdk-version: "${{ vars.NET_SDK_VERSION }}" From 91f7de672fd72158037fac5f74fc7481d46be5e3 Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Mon, 7 Aug 2023 16:31:34 +0100 Subject: [PATCH 04/14] ci: create unit test status check workflow --- .github/workflows/unit-test-status-check.yml | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/unit-test-status-check.yml diff --git a/.github/workflows/unit-test-status-check.yml b/.github/workflows/unit-test-status-check.yml new file mode 100644 index 0000000..78e435b --- /dev/null +++ b/.github/workflows/unit-test-status-check.yml @@ -0,0 +1,23 @@ +name: ✅Unit Testing Status Check +run-name: ✅Unit Testing Status Check (${{ github.base_ref }} branch) + + +defaults: + run: + shell: pwsh + + +on: + workflow_dispatch: + pull_request: + branches: [main, preview] + + +jobs: + run_tests: + name: ${{ vars.PROJECT_NAME }} Test Status Check + uses: KinsonDigital/Infrastructure/.github/workflows/run-csharp-tests.yml@v10.2.0 + with: + project-name: "${{ vars.PROJECT_NAME }}Tests" + build-config: Debug + net-sdk-version: "${{ vars.NET_SDK_VERSION }}" From 93d9ad2c8242516a770cdf79fff2d630fed5ea76 Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Mon, 7 Aug 2023 16:34:26 +0100 Subject: [PATCH 05/14] ci: create workflows to enable syncing system --- .github/workflows/sync-bot.yml | 54 ++++++++++++++++++++++++ .github/workflows/sync-issue-to-pr.yml | 55 +++++++++++++++++++++++++ .github/workflows/sync-status-check.yml | 53 ++++++++++++++++++++++++ 3 files changed, 162 insertions(+) create mode 100644 .github/workflows/sync-bot.yml create mode 100644 .github/workflows/sync-issue-to-pr.yml create mode 100644 .github/workflows/sync-status-check.yml diff --git a/.github/workflows/sync-bot.yml b/.github/workflows/sync-bot.yml new file mode 100644 index 0000000..e95e0b9 --- /dev/null +++ b/.github/workflows/sync-bot.yml @@ -0,0 +1,54 @@ +name: 🤖Sync Bot + + +defaults: + run: + shell: pwsh + + +on: + issues: + types: [labeled, unlabeled, assigned, unassigned, milestoned, demilestoned] + + +jobs: + sync_bot: + name: Sync Bot Status Check + if: ${{ !github.event.issue.pull_request }} + runs-on: ubuntu-latest + steps: + - name: Set Up Deno + if: startsWith(github.ref_name, 'feature/') + uses: denoland/setup-deno@v1 + with: + deno-version: v1.x + + - name: Run Sync Bot (Issue Change) + if: startsWith(github.ref_name, 'feature/') + run: | + $scriptUrl = "${{ vars.SCRIPT_BASE_URL }}/${{ vars.CICD_SCRIPTS_VERSION }}/${{ vars.SCRIPT_RELATIVE_DIR_PATH}}/sync-bot-status-check.ts"; + + $issueNumber = "${{ github.event.issue.number }}"; + + Write-Host "::notice::Project Name: ${{ vars.PROJECT_NAME }}"; + Write-Host "::notice::Issue: $issueNumber"; + + if ($manuallyExecuted -and $issueNumber -eq "0") { + Write-Host "::notice::The issue or PR number must be a value greater than 0."; + exit 1; + } + + <# Deno Args: + 1. Organization name + 2. Project name + 3. Issue number + 4. Event Type - set to issue event type + 5. PAT + #> + deno run ` + --allow-net ` + "$scriptUrl" ` + "${{ vars.PROJECT_NAME }}" ` + "$issueNumber" ` + "issue" ` + "${{ secrets.CICD_TOKEN }}"; diff --git a/.github/workflows/sync-issue-to-pr.yml b/.github/workflows/sync-issue-to-pr.yml new file mode 100644 index 0000000..dc2ace5 --- /dev/null +++ b/.github/workflows/sync-issue-to-pr.yml @@ -0,0 +1,55 @@ +name: 🔄️Sync Issue To PR + + +defaults: + run: + shell: pwsh + + +on: + pull_request: + types: opened + issue_comment: # This event is triggered when creating issue and pr comments + types: created + + +jobs: + sync_issue_to_pr: + name: Start Sync Process + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '[run-sync]')) || + github.event_name == 'pull_request' && startsWith(github.head_ref, 'feature/') + runs-on: ubuntu-latest + steps: + - name: Set Up Deno + uses: denoland/setup-deno@v1 + with: + deno-version: v1.x + + - name: Sync + run: | + $eventName = "${{ github.event_name }}"; + $scriptUrl = "${{ vars.SCRIPT_BASE_URL }}/${{ vars.CICD_SCRIPTS_VERSION }}/${{ vars.SCRIPT_RELATIVE_DIR_PATH }}/sync-issue-to-pr.ts"; + $issueOrPrNumber = $eventName -eq "pull_request" ? "${{ github.event.number }}" : "${{ github.event.issue.number }}"; + + Write-Host "::notice::Event Type: $eventName"; + Write-Host "::notice::Organization Name: ${{ vars.ORGANIZATION_NAME }}"; + Write-Host "::notice::Project Name: ${{ vars.PROJECT_NAME }}"; + Write-Host "::notice::Requested By: ${{ github.event.sender.login }}"; + Write-Host "::notice::PR Number: $issueOrPrNumber"; + + <# Deno Args: + 1. Organization name + 2. Project name + 3. Triggered by user + 4. Issue or pull request number + 5. PAT + #> + deno run ` + --allow-net ` + "$scriptUrl" ` + "${{ vars.ORGANIZATION_NAME }}" ` + "${{ vars.PROJECT_NAME }}" ` + "${{ github.event.sender.login }}" ` + "$issueOrPrNumber" ` + "${{ secrets.CICD_TOKEN }}"; diff --git a/.github/workflows/sync-status-check.yml b/.github/workflows/sync-status-check.yml new file mode 100644 index 0000000..e1e85c7 --- /dev/null +++ b/.github/workflows/sync-status-check.yml @@ -0,0 +1,53 @@ +name: ✅Sync Status Check + + +defaults: + run: + shell: pwsh + + +on: + pull_request: + branches: [main, preview] + + +jobs: + sync_status_check: + name: Sync Status Check + if: startsWith(github.head_ref, 'feature/') + runs-on: ubuntu-latest + steps: + - name: Set Up Deno + uses: denoland/setup-deno@v1 + with: + deno-version: v1.x + + - name: Run Sync Status Check + run: | + $scriptUrl = "${{ vars.SCRIPT_BASE_URL }}/${{ vars.CICD_SCRIPTS_VERSION }}/${{ vars.SCRIPT_RELATIVE_DIR_PATH}}/sync-bot-status-check.ts"; + $prNumber = "${{ github.event.number }}"; + + Write-Host "::notice::Project Name: ${{ vars.PROJECT_NAME }}"; + Write-Host "::notice::PR Number: $prNumber"; + Write-Host "::notice::Event Type: pr"; + + if ($manuallyExecuted -and $prNumber -eq "0") { + Write-Host "::notice::The issue or PR number must be a value greater than 0."; + exit 1; + } + + <# Deno Args: + 1. Organization name + 2. Project name + 3. Pull request number + 4. Event Type - set to pull request event type + 5. PAT + #> + deno run ` + --allow-net ` + "$scriptUrl" ` + "${{ vars.ORGANIZATION_NAME }}" ` + "${{ vars.PROJECT_NAME }}" ` + "$prNumber" ` + "pr" ` + "${{ secrets.CICD_TOKEN }}"; From 81fc0dbc987417de0b804d04204663f75f7abe83 Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Mon, 7 Aug 2023 16:34:37 +0100 Subject: [PATCH 06/14] ci: create workflow to auto triage issues --- .github/workflows/triage-issue.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/triage-issue.yml diff --git a/.github/workflows/triage-issue.yml b/.github/workflows/triage-issue.yml new file mode 100644 index 0000000..4bfc6eb --- /dev/null +++ b/.github/workflows/triage-issue.yml @@ -0,0 +1,21 @@ +name: 🤖Triage Issue + + +on: + issues: + types: [opened] + + +jobs: + label_issues: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Label issues + uses: andymckay/labeler@1.0.4 + with: + add-labels: "⚕️NEEDS TRIAGE" + ignore-if-assigned: true + ignore-if-labeled: true + repo-token: ${{ secrets.GITHUB_TOKEN }} From d7d0a1a85584b0afa82ec7223177ebf48201bcd2 Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Mon, 7 Aug 2023 16:37:18 +0100 Subject: [PATCH 07/14] ci: create a workflow to perform prev and prod releases --- .github/workflows/release.yml | 61 +++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..82039a6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,61 @@ +name: 🚀Release +run-name: ${{ vars.PROJECT_NAME }} ${{ inputs.release-type }} Release ${{ inputs.dry-run == true && '(Dry Run)' || '' }} + + +defaults: + run: + shell: pwsh + + +on: + workflow_dispatch: + inputs: + release-type: + description: The type of release. Choose 'Preview' or 'Production'. + required: true + type: choice + options: [Preview, Production] + dry-run: + description: Dry Run - Check to run the workflow without creating a release. + required: false + default: false + type: boolean + + +jobs: + determine_release_notes_path: + name: Determine Release Notes Dir Path + runs-on: ubuntu-latest + outputs: + release-notes-dir-path: ${{ steps.get-dir-path.outputs.release-notes-dir-path }} + steps: + - name: Get Dir Path + id: get-dir-path + run: | + $dirPath = "${{ inputs.release-type }}" -eq "Production" ? "${{ vars.PROD_RELATIVE_RELEASE_NOTES_DIR_PATH }}" : "${{ vars.PREV_RELATIVE_RELEASE_NOTES_DIR_PATH }}"; + "release-notes-dir-path=$dirPath" >> $env:GITHUB_OUTPUT; + + + run_release: + name: Performing ${{ inputs.release-type }} Release of ${{ vars.PROJECT_NAME }} (${{ inputs.release-type == 'Production' && 'Release' || 'Debug' }}) + needs: determine_release_notes_path + uses: KinsonDigital/Infrastructure/.github/workflows/dotnet-lib-release.yml@v10.2.0 + with: + project-name: "${{ vars.PROJECT_NAME}}" + release-type: "${{ inputs.release-type }}" + run-branch: "${{ github.ref_name }}" + net-sdk-version: "${{ vars.NET_SDK_VERSION }}" + relative-release-notes-dir-path: "${{ needs.determine_release_notes_path.outputs.release-notes-dir-path }}" + release-notes-file-name-prefix: "${{ vars.RELEASE_NOTES_FILE_NAME_PREFIX }}" + build-config: ${{ inputs.release-type == 'Production' && 'Release' || 'Debug' }} + pr-include-notes-label: "${{ vars.PR_INCLUDE_NOTES_LABEL }}" + send-release-tweet: ${{ vars.TWITTER_BROADCAST_ENABLED == 'true' }} + dry-run: ${{ inputs.dry-run }} + transpile-readme: true + secrets: + cicd-pat: "${{ secrets.CICD_TOKEN }}" + nuget-org-api-key: "${{ secrets.NUGET_ORG_API_KEY }}" + twitter-consumer-api-key: "${{ secrets.TWITTER_CONSUMER_API_KEY }}" + twitter-consumer-api-secret: "${{ secrets.TWITTER_CONSUMER_API_SECRET }}" + twitter-access-token: "${{ secrets.TWITTER_ACCESS_TOKEN }}" + twitter-access-token-secret: "${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}" From 8330a680ea3aed595015a33b29d5155244895256 Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Mon, 7 Aug 2023 16:38:28 +0100 Subject: [PATCH 08/14] ide: add tab settings to vscode settings config --- .vscode/settings.json | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 6d356ea..7ab427f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,22 @@ "pwsh", "runsettings" ], - "dotnet.defaultSolution": "Plazma.sln" + "dotnet.defaultSolution": "Plazma.sln", + "[csharp]": { + "editor.insertSpaces": false, + "editor.indentSize": 4, + }, + "[jsonc]": { + "editor.insertSpaces": false, + "editor.tabSize": 4, + }, + "[yaml]": { + "editor.insertSpaces": true, + "editor.tabSize": 2, + }, + "editor.detectIndentation": false, + "[github-actions-workflow]": { + "editor.tabSize": 2, + "editor.insertSpaces": true + } } From dc8be9d32ed4fc5ad5b5b87bfbc6af2cc0249256 Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Mon, 7 Aug 2023 16:44:02 +0100 Subject: [PATCH 09/14] config: update main solution level editorconfig --- .editorconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/.editorconfig b/.editorconfig index 12e9562..beeadd0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -195,4 +195,5 @@ dotnet_diagnostic.CA1853.severity = warning csharp_prefer_simple_using_statement = true:suggestion # Using directives must be placed inside of a namespace declaration +# IDE0065: Misplaced using directive csharp_using_directive_placement = inside_namespace From 4c352e9da4525b71d5a4e2c34a7ff36c001175df Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Mon, 7 Aug 2023 16:51:30 +0100 Subject: [PATCH 10/14] ide: add words to rider dictionary --- Plazma.sln.DotSettings | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plazma.sln.DotSettings b/Plazma.sln.DotSettings index 966c316..1b06239 100644 --- a/Plazma.sln.DotSettings +++ b/Plazma.sln.DotSettings @@ -75,6 +75,8 @@ public void Ctor_WithNull$PARAM_1$Param_ThrowsException() /// <returns>The instance to test.</returns> private $OBJECT_TYPE$ CreateSystemUnderTest() => new ($END$); + True + True True True True From a5356013b2c337025dd25d5a6d1207e691b58635 Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Mon, 7 Aug 2023 16:51:41 +0100 Subject: [PATCH 11/14] docs: fix spelling errors in code docs --- Plazma/ParticleColor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plazma/ParticleColor.cs b/Plazma/ParticleColor.cs index e9a8a35..1cd358c 100644 --- a/Plazma/ParticleColor.cs +++ b/Plazma/ParticleColor.cs @@ -462,7 +462,7 @@ public ParticleColor(byte a, byte r, byte g, byte b) public static ParticleColor MediumSpringGreen => new ParticleColor(255, 0, 250, 154); /// - /// Gets get the color MdeiumTurquoise. + /// Gets get the color MediumTurquoise. /// public static ParticleColor MediumTurquoise => new ParticleColor(255, 72, 209, 204); @@ -717,7 +717,7 @@ public ParticleColor(byte a, byte r, byte g, byte b) public static ParticleColor Yellow => new ParticleColor(255, 255, 255, 0); /// - /// Gets get the color YelloGreen. + /// Gets get the color YellowGreen. /// public static ParticleColor YellowGreen => new ParticleColor(255, 154, 205, 50); From 361a633db1d0dfcd63a1e359a759f8cd660e6c8c Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Mon, 7 Aug 2023 17:31:54 +0100 Subject: [PATCH 12/14] ide: update solution items --- Plazma.sln | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Plazma.sln b/Plazma.sln index 3d984e4..3d24ac9 100644 --- a/Plazma.sln +++ b/Plazma.sln @@ -17,9 +17,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution codecov.yml = codecov.yml LICENSE.md = LICENSE.md README.md = README.md + renovate.json = renovate.json EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workflows", "Workflows", "{8518113E-D0C3-4E63-8F2E-542EB6D1CCE9}" + ProjectSection(SolutionItems) = preProject + .github\workflows\add-new-issue-to-project.yml = .github\workflows\add-new-issue-to-project.yml + .github\workflows\build-status-check.yml = .github\workflows\build-status-check.yml + .github\workflows\release.yml = .github\workflows\release.yml + .github\workflows\sync-bot.yml = .github\workflows\sync-bot.yml + .github\workflows\sync-issue-to-pr.yml = .github\workflows\sync-issue-to-pr.yml + .github\workflows\sync-status-check.yml = .github\workflows\sync-status-check.yml + .github\workflows\triage-issue.yml = .github\workflows\triage-issue.yml + .github\workflows\unit-test-status-check.yml = .github\workflows\unit-test-status-check.yml + EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlazmaTests", "Testing\PlazmaTests\PlazmaTests.csproj", "{AF6A9738-F676-408A-B1B9-E7F43631BC08}" EndProject From c2719b3d27603542a61c96413380531e388d82c0 Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Mon, 7 Aug 2023 17:47:14 +0100 Subject: [PATCH 13/14] force status checks From 14e47e198518259a07ed88fcd8f5b63273c6a41a Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Mon, 7 Aug 2023 19:28:28 +0100 Subject: [PATCH 14/14] ci: remove defaults from workflows --- .github/workflows/build-status-check.yml | 5 ----- .github/workflows/unit-test-status-check.yml | 5 ----- 2 files changed, 10 deletions(-) diff --git a/.github/workflows/build-status-check.yml b/.github/workflows/build-status-check.yml index 07f608a..9e306ea 100644 --- a/.github/workflows/build-status-check.yml +++ b/.github/workflows/build-status-check.yml @@ -2,11 +2,6 @@ name: ✅Build Status Check run-name: ✅Build Status Check (${{ github.base_ref }} branch) -defaults: - run: - shell: pwsh - - on: pull_request: branches: [main, preview] diff --git a/.github/workflows/unit-test-status-check.yml b/.github/workflows/unit-test-status-check.yml index 78e435b..fa0035c 100644 --- a/.github/workflows/unit-test-status-check.yml +++ b/.github/workflows/unit-test-status-check.yml @@ -2,11 +2,6 @@ name: ✅Unit Testing Status Check run-name: ✅Unit Testing Status Check (${{ github.base_ref }} branch) -defaults: - run: - shell: pwsh - - on: workflow_dispatch: pull_request: