Skip to content

Commit

Permalink
Move preview into production (#113)
Browse files Browse the repository at this point in the history
* 🚧Improve release workflow (#96)

* Start work for issue #95

* ci: add reusable worflows

* ci: improve release workflow to reusable one

* pr-changes: remove "not required" workflows

* pr-changes: update token ref

* pr-changes: update token ref, link to reusable workflow and version

* pr-changes: remove job, update build-config

* pr-changes: add pwsh code blk

* ide: setup tab settings for vscode

* docs: update links in readme

* ci: update version of reusable workflow reference in release workflow

* ci: remove workflow

* ci: update build and test status check workflows

---------

Co-authored-by: Calvin Wilkinson <[email protected]>

* 🚧Perform various improvements (#100)

* Start work for issue #99

* ci: improve workflows

* docs: move images folder

* docs: move release notes folder

* docs: update badges

* ide: add and change various configs for tooling

* ci: add renovate config for dependency management

* ci: update reusable workflow versions and command syntax

* ide: update tab settings

* ci: update release workflow

* 🚧Adjust release workflow input (#102)

* Start work for issue #101

* ci: update dry run input on release.yml

* ci: update reusable workflow refs from v10.0.1 to v10.1.1

* ci: update sync issue to PR workflow

* ci: update sync bot workflow

* ci: add job to release workflow to determine rel notes path

* ci: update sync status check

* chore(deps): update dependency xunit to v2.5.0 (#107)

* chore(deps): update dependency xunit to v2.5.0

| datasource | package | from  | to    |
| ---------- | ------- | ----- | ----- |
| nuget      | xunit   | 2.4.2 | 2.5.0 |

* tests: adjust tests to use fluent assertions

* tests: remove unused extension methods

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Calvin Wilkinson <[email protected]>

* chore(deps): update dependency coverlet.msbuild to v6 (#111)

| datasource | package          | from  | to    |
| ---------- | ---------------- | ----- | ----- |
| nuget      | coverlet.msbuild | 3.2.0 | 6.0.0 |

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency moq to v4.20.0 (#112)

| datasource | package | from   | to     |
| ---------- | ------- | ------ | ------ |
| nuget      | Moq     | 4.18.4 | 4.20.0 |

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Calvin Wilkinson (Admin) <[email protected]>

* chore(deps): update dependency coverlet.collector to v6 (#110)

| datasource | package            | from  | to    |
| ---------- | ------------------ | ----- | ----- |
| nuget      | coverlet.collector | 3.2.0 | 6.0.0 |

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Calvin Wilkinson (Admin) <[email protected]>

* chore(deps): update dependency xunit.runner.visualstudio to v2.5.0 (#108)

| datasource | package                   | from  | to    |
| ---------- | ------------------------- | ----- | ----- |
| nuget      | xunit.runner.visualstudio | 2.4.5 | 2.5.0 |

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Calvin Wilkinson (Admin) <[email protected]>

* chore(deps): update dependency microsoft.net.test.sdk to v17.7.0 (#106)

| datasource | package                | from   | to     |
| ---------- | ---------------------- | ------ | ------ |
| nuget      | Microsoft.NET.Test.Sdk | 17.5.0 | 17.7.0 |

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Calvin Wilkinson (Admin) <[email protected]>

* chore(deps): update dependency system.io.abstractions to v19.2.51 (#104)

| datasource | package                | from    | to      |
| ---------- | ---------------------- | ------- | ------- |
| nuget      | System.IO.Abstractions | 19.2.18 | 19.2.51 |

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Calvin Wilkinson (Admin) <[email protected]>

* chore(deps): update dependency microsoft.codeanalysis.netanalyzers to v7.0.3 (#103)

| datasource | package                             | from  | to    |
| ---------- | ----------------------------------- | ----- | ----- |
| nuget      | Microsoft.CodeAnalysis.NetAnalyzers | 7.0.1 | 7.0.3 |

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Calvin Wilkinson (Admin) <[email protected]>

* chore(deps): update kinsondigital/infrastructure action to v10.2.0 (#109)

| datasource  | package                      | from    | to      |
| ----------- | ---------------------------- | ------- | ------- |
| github-tags | KinsonDigital/Infrastructure | v10.1.1 | v10.2.0 |

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Calvin Wilkinson (Admin) <[email protected]>

* ci: adjust new issue to proj workflow

---------

Co-authored-by: Kristen Wilkinson <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Calvin Wilkinson (Admin) <[email protected]>
  • Loading branch information
4 people authored Aug 8, 2023
1 parent 3d52f34 commit deaef91
Show file tree
Hide file tree
Showing 30 changed files with 507 additions and 562 deletions.
50 changes: 35 additions & 15 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,7 +60,7 @@ 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
Expand All @@ -76,7 +73,16 @@ dotnet_naming_symbols.constant_fields.required_modifiers = const
# 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 @@ -89,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 @@ -108,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 @@ -144,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 @@ -157,23 +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

# SA1200: A C# using directive is placed outside of a namespace element
dotnet_diagnostic.SA1200.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

# SA1309: A field name in C# begins with an underscore
dotnet_diagnostic.SA1309.severity = warning
# 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 }}
23 changes: 0 additions & 23 deletions .github/workflows/build-status-check-not-required.yml

This file was deleted.

52 changes: 9 additions & 43 deletions .github/workflows/build-status-check.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,17 @@
name: ✅Build Status Check


env:
PROJECT_NAME: PackageMonster
NET_SDK_VERSION: 7.x


defaults:
run:
shell: pwsh
run-name: ✅Build Status Check (${{ github.base_ref }} branch)


on:
workflow_dispatch:
pull_request:
branches: master
paths:
- "**.cs"
- "**.csproj"
branches: [main, preview]


jobs:
build_status_check:
name: Build Status Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Get Build Config
id: get-build-config
run: |
# If the destination branch that the pull request is merging into is master, do a release build
if ( "${{ github.base_ref }}" -eq "master") {
"build-config=Release" >> "$env:GITHUB_OUTPUT";
} else { # Any other branch than master, do a debug build
"build-config=Debug" >> "$env:GITHUB_OUTPUT";
}
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.NET_SDK_VERSION }}

- name: Restore Dependencies
run: dotnet restore "${{ github.workspace }}/${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj"

- name: Build Project
run: dotnet build "${{ github.workspace }}/${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj" `
-c ${{ steps.get-build-config.outputs.build-config }} `
--no-restore
build_project:
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 }}
81 changes: 81 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: 🚁Prepare Release


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]
release-version:
required: true
description: The version of the release to prepare.
type: string


jobs:
print_validate_workflow:
name: Print & Validate Prepare Release Workflow
runs-on: ubuntu-latest
steps:
- name: Print Environment Variables
run: Get-ChildItem -Path Env:* | Sort-Object Name

- name: Validate Workflow Inputs
run: |
$releaseType = "${{ inputs.release-type }}".ToLower();
if ("${{ vars.PROJECT_NAME }}".Trim() -eq "") {
Write-Host "::error::The project name input cannot be empty.";
exit 1;
}
if ($releaseType -eq "") {
Write-Host "::error::The release type input cannot be empty.";
exit 1;
}
if ($releaseType -ne 'preview' -and $releaseType -ne 'roduction') {
Write-Host "::error::The release type input must be either 'Preview' or 'Production'.";
exit 1;
}
$releaseVersion = "${{ inputs.release-version }}".Trim().ToLower();
if ($releaseVersion -eq "") {
Write-Host "::error::The 'release-version' workflow input cannot be empty.";
exit 1;
}
$prodVersionRegex = "v[0-9]+\.[0-9]+\.[0-9]+";
$prevVersionRegex = "v[0-9]+\.[0-9]+\.[0-9]+-preview\.[0-9]+";
# Verify that the version has valid syntax
if (($releaseVersion -match $prodVersionRegex) -or ($releaseVersion -match $prevVersionRegex)) {
Write-Host "::notice::The 'release-version' workflow input is valid.";
} else {
$versionSyntax = $releaseType == "production" ? "v#.#.#" : "v#.#.#-preview.#";
Write-Host "::error::The 'release-version' workflow input is not valid. Expected format: '$versionSyntax";
exit 1;
}
prepare_release:
name: Prepare ${{ inputs.release-type }} Release Of ${{ vars.PROJECT_NAME }}
uses: KinsonDigital/Infrastructure/.github/workflows/[email protected]
with:
project-name: ${{ vars.PROJECT_NAME }}
release-type: ${{ inputs.release-type }}
release-version: ${{ inputs.release-version }}
secrets:
cicd-pat: ${{ secrets.CICD_TOKEN }}
Loading

0 comments on commit deaef91

Please sign in to comment.