Skip to content

Commit

Permalink
Merge branch 'preview/v1.0.0-preview.15' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
CalvinWilkinson committed Jul 18, 2023
2 parents 6c582cb + be382e6 commit a22a203
Show file tree
Hide file tree
Showing 109 changed files with 4,622 additions and 400 deletions.
53 changes: 37 additions & 16 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ indent_style = space
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
charset = utf-8-bom


###############################
# .NET Coding Conventions #
###############################
[*.{cs,vb}]
# Organize usings
dotnet_sort_system_directives_first = true

Expand Down Expand Up @@ -63,16 +60,11 @@ dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# Use PascalCase for constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = warning
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const

# SA1309: A field name in C# begins with an underscore
dotnet_diagnostic.SA1309.severity = warning

# SA1200: Using directive should appear within a namespace declaration
dotnet_diagnostic.SA1200.severity = none

###############################
# C# Coding Conventions #
Expand All @@ -81,7 +73,16 @@ dotnet_diagnostic.SA1200.severity = none
# IDE0060: Remove unused parameter
dotnet_code_quality_unused_parameters = all:warning

[*.cs]
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
end_of_line = crlf
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion

# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = discard_variable:warning

# var preferences
csharp_style_var_for_built_in_types = true:warning
csharp_style_var_when_type_is_apparent = true:warning
Expand All @@ -94,6 +95,8 @@ csharp_style_expression_bodied_operators = true:warning
csharp_style_expression_bodied_properties = true:warning
csharp_style_expression_bodied_indexers = true:warning
csharp_style_expression_bodied_accessors = true:warning
csharp_style_expression_bodied_lambdas = true:warning
csharp_style_expression_bodied_local_functions = true:warning

# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
Expand All @@ -113,9 +116,14 @@ csharp_prefer_simple_default_expression = true:warning
csharp_style_pattern_local_over_anonymous_function = true:warning
csharp_style_inlined_variable_declaration = true:warning

csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent

# IDE0057: Use range operator
csharp_style_prefer_range_operator = true:warning

csharp_style_namespace_declarations = file_scoped:warning

###############################
# C# Formatting Rules #
###############################
Expand Down Expand Up @@ -149,7 +157,6 @@ csharp_space_between_method_call_empty_parameter_list_parentheses = false
# Wrapping preferences
csharp_preserve_single_line_blocks = true


# IDE0051: Remove unused private members
dotnet_diagnostic.IDE0051.severity = warning

Expand All @@ -162,17 +169,31 @@ csharp_style_unused_value_assignment_preference = discard_variable:warning
# SA1503: Braces should not be omitted
dotnet_diagnostic.SA1503.severity = warning

# SA1101: Prefix local calls with this
# Prefix local calls with this
dotnet_diagnostic.SA1101.severity = none

# SA1116: Split parameters should start on line after declaration
# Split parameters should start on line after declaration
dotnet_diagnostic.SA1116.severity = warning

# SA1516: Elements should be separated by blank line
# Elements should be separated by blank line
dotnet_diagnostic.SA1516.severity = none

# SA1011: Closing square brackets should be spaced correctly
# Closing square brackets should be spaced correctly
dotnet_diagnostic.SA1011.severity = none

# SA0001: XML comment analysis is disabled due to project configuration
# XML comment analysis is disabled due to project configuration
dotnet_diagnostic.SA0001.severity = none

# An element within a C# code file is out of order within regard to access level, in relation to other elements in the code
dotnet_diagnostic.SA1202.severity = warning

dotnet_diagnostic.CA1852.severity = warning

# Do not guard 'Dictionary.Remove(key)' with 'Dictionary.ContainsKey(key)'
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
18 changes: 18 additions & 0 deletions .github/workflows/add-new-issue-to-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 🤖Add New Issue To Project


on:
issues:
types: opened


jobs:
add_new_issue_to_project:
name: Add New Issue
uses: KinsonDigital/Infrastructure/.github/workflows/add-issue-to-project.yml@v9.1.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 }}
32 changes: 32 additions & 0 deletions .github/workflows/build-pr-status-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: ✅Build Status Check
run-name: ✅Build Status Check ${{ github.base_ref == 'main' && '(Release Build)' || '(Debug Build)' }}


defaults:
run:
shell: pwsh


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


jobs:
main_build_status_check:
name: ${{ vars.PROJECT_NAME }} Build Status Check
uses: KinsonDigital/Infrastructure/.github/workflows/build-csharp-project.yml@v9.1.0
with:
project-name: "${{ vars.PROJECT_NAME }}"
build-config: Debug
net-sdk-version: "${{ vars.NET_SDK_VERSION }}"


perf_build_status_check:
name: ${{ vars.PROJECT_NAME }} Perf Tests Build Status Check
uses: KinsonDigital/Infrastructure/.github/workflows/build-csharp-project.yml@v9.1.0
with:
project-name: "${{ vars.PROJECT_NAME }}PerfTests"
build-config: Debug
net-sdk-version: "${{ vars.NET_SDK_VERSION }}"
31 changes: 31 additions & 0 deletions .github/workflows/prev-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 🚀Preview Release


defaults:
run:
shell: pwsh


on:
workflow_dispatch:


jobs:
preview_release:
name: Preview Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Restore DotNet Tools
run: dotnet tool restore

- name: Run Preview Release
run: dotnet cicd PreviewRelease --skip-twitter-announcement
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NugetOrgApiKey: ${{ secrets.NUGET_ORG_API_KEY }}
TwitterConsumerApiKey: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
TwitterConsumerApiSecret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
TwitterAccessToken: ${{ secrets.TWITTER_ACCESS_TOKEN }}
TwitterAccessTokenSecret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
66 changes: 66 additions & 0 deletions .github/workflows/sonar-scan-pr-status-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: ✅Sonar Scan Status Check


defaults:
run:
shell: pwsh


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


jobs:
sonar_analyze_code:
name: Analyze Code
runs-on: ubuntu-latest
steps:
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'zulu' # Alternative distribution options are available.

- uses: actions/setup-dotnet@v3
name: Setup dotnet
with:
dotnet-version: '7.x.x'

- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v3
with:
path: ./.sonar/scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner

- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
run: |
New-Item -Path ./.sonar/scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner
- name: Build and Analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
./.sonar/scanner/dotnet-sonarscanner begin /k:"KinsonDigital_Carbonate" /o:"kinsondigital" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet clean "${{ github.workspace }}/Carbonate/Carbonate.csproj";
dotnet build "${{ github.workspace }}/Carbonate/Carbonate.csproj" -c Debug;
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
51 changes: 51 additions & 0 deletions .github/workflows/sync-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: 🤖Sync Bot


defaults:
run:
shell: pwsh


on:
issues:
types: [labeled, unlabeled, assigned, unassigned, milestoned, demilestoned]


jobs:
sync_bot:
name: Sync Bot
if: ${{ !github.event.issue.pull_request }}
runs-on: ubuntu-latest
steps:
- name: Set Up Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Run Sync Bot (Issue Change)
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 "::error::The issue or PR number must be a value greater than 0.";
exit 1;
}
<# Deno Args:
1. Project name
2. Issue number
3. Event type - set to issue event type
4. PAT
#>
deno run `
--allow-net `
"$scriptUrl" `
"${{ vars.PROJECT_NAME }}" `
"$issueNumber" `
"issue" `
"cicd-pat: ${{ secrets.CICD_TOKEN }}";
59 changes: 59 additions & 0 deletions .github/workflows/sync-issue-to-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
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' ||
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";
$prNumber = $eventName -eq "pull_request" ? "${{ github.event.number }}" : "${{ github.event.issue.number }}";
$command = $eventName -eq "issue_comment" ? "${{ github.event.comment.body }}" : "[initial-sync]";
Write-Host "::notice::Event Name: $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: $prNumber";
Write-Host "::notice::Comment: $command";
<# Deno Args:
1. Organization name
2. Project name
3. Login name of the user making the issue change
4. Pull request number
5. The sync command - Either '[initial-sync]' or '[run-sync]'
6. PAT
#>
deno run `
--allow-net `
"$scriptUrl" `
"${{ vars.ORGANIZATION_NAME }}" `
"${{ vars.PROJECT_NAME }}" `
"${{ github.event.sender.login }}" `
"$prNumber" `
"$command" `
"${{ secrets.CICD_TOKEN }}";
Loading

0 comments on commit a22a203

Please sign in to comment.