Skip to content

Commit

Permalink
🚧Setup cicd and sync system (#16)
Browse files Browse the repository at this point in the history
* Start work for issue #14

* ci: create workflow to auto add issues and prs to the org project

* ci: create build status check workflow

* ci: create unit test status check workflow

* ci: create workflows to enable syncing system

* ci: create workflow to auto triage issues

* ci: create a workflow to perform prev and prod releases

* ide: add tab settings to vscode settings config

* config: update main solution level editorconfig

* ide: add words to rider dictionary

* docs: fix spelling errors in code docs

* ide: update solution items

* force status checks

* ci: remove defaults from workflows
  • Loading branch information
CalvinWilkinson authored Aug 7, 2023
1 parent 5050a91 commit eaa2356
Show file tree
Hide file tree
Showing 13 changed files with 334 additions and 3 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 21 additions & 0 deletions .github/workflows/add-new-issue-to-project.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
org-name: "${{ vars.ORGANIZATION_NAME }}"
org-project-name: "${{ vars.ORG_PROJECT_NAME }}"
project-name: "${{ vars.PROJECT_NAME }}"
secrets:
cicd-pat: ${{ secrets.CICD_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/build-status-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: ✅Build Status Check
run-name: ✅Build Status Check (${{ github.base_ref }} branch)


on:
pull_request:
branches: [main, preview]


jobs:
build_status_check:
name: ${{ vars.PROJECT_NAME }} Build Status Check
uses: KinsonDigital/Infrastructure/.github/workflows/[email protected]
with:
project-name: "${{ vars.PROJECT_NAME }}"
build-config: Debug
net-sdk-version: "${{ vars.NET_SDK_VERSION }}"
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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 }}"
54 changes: 54 additions & 0 deletions .github/workflows/sync-bot.yml
Original file line number Diff line number Diff line change
@@ -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 }}";
55 changes: 55 additions & 0 deletions .github/workflows/sync-issue-to-pr.yml
Original file line number Diff line number Diff line change
@@ -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 }}";
53 changes: 53 additions & 0 deletions .github/workflows/sync-status-check.yml
Original file line number Diff line number Diff line change
@@ -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 }}";
21 changes: 21 additions & 0 deletions .github/workflows/triage-issue.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
add-labels: "⚕️NEEDS TRIAGE"
ignore-if-assigned: true
ignore-if-labeled: true
repo-token: ${{ secrets.GITHUB_TOKEN }}
18 changes: 18 additions & 0 deletions .github/workflows/unit-test-status-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: ✅Unit Testing Status Check
run-name: ✅Unit Testing Status Check (${{ github.base_ref }} branch)


on:
workflow_dispatch:
pull_request:
branches: [main, preview]


jobs:
run_tests:
name: ${{ vars.PROJECT_NAME }} Test Status Check
uses: KinsonDigital/Infrastructure/.github/workflows/[email protected]
with:
project-name: "${{ vars.PROJECT_NAME }}Tests"
build-config: Debug
net-sdk-version: "${{ vars.NET_SDK_VERSION }}"
19 changes: 18 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
11 changes: 11 additions & 0 deletions Plazma.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Plazma.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public void Ctor_WithNull$PARAM_1$Param_ThrowsException()
/// &lt;returns&gt;The instance to test.&lt;/returns&gt;
private $OBJECT_TYPE$ CreateSystemUnderTest()
=&gt; new ($END$);</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cornsilk/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gainsboro/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Kinson/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Plazma/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Usings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
4 changes: 2 additions & 2 deletions Plazma/ParticleColor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ public ParticleColor(byte a, byte r, byte g, byte b)
public static ParticleColor MediumSpringGreen => new ParticleColor(255, 0, 250, 154);

/// <summary>
/// Gets get the color MdeiumTurquoise.
/// Gets get the color MediumTurquoise.
/// </summary>
public static ParticleColor MediumTurquoise => new ParticleColor(255, 72, 209, 204);

Expand Down Expand Up @@ -717,7 +717,7 @@ public ParticleColor(byte a, byte r, byte g, byte b)
public static ParticleColor Yellow => new ParticleColor(255, 255, 255, 0);

/// <summary>
/// Gets get the color YelloGreen.
/// Gets get the color YellowGreen.
/// </summary>
public static ParticleColor YellowGreen => new ParticleColor(255, 154, 205, 50);

Expand Down

0 comments on commit eaa2356

Please sign in to comment.