-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from martinsmith1968/feature/beta-package-version
Feature/beta package version
- Loading branch information
Showing
3 changed files
with
270 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
root = true | ||
|
||
# Suggestions : https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2019 | ||
# Recommended : https://marketplace.visualstudio.com/items?itemName=MadsKristensen.EditorConfig | ||
# Examples : https://github.com/RehanSaeed/EditorConfig/blob/master/.editorconfig | ||
|
||
[*] | ||
end_of_line = crlf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
charset = utf-8 | ||
|
||
# Microsoft .NET properties | ||
csharp_new_line_before_members_in_object_initializers = false | ||
csharp_preferred_modifier_order = public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async : suggestion | ||
csharp_style_var_elsewhere = true : suggestion | ||
csharp_style_var_for_built_in_types = true : suggestion | ||
csharp_style_var_when_type_is_apparent = true : suggestion | ||
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary : none | ||
dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary : none | ||
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary : none | ||
dotnet_style_predefined_type_for_locals_parameters_members = true : suggestion | ||
dotnet_style_predefined_type_for_member_access = true : suggestion | ||
dotnet_style_qualification_for_event = false : suggestion | ||
dotnet_style_qualification_for_field = false : suggestion | ||
dotnet_style_qualification_for_method = false : suggestion | ||
dotnet_style_qualification_for_property = false : suggestion | ||
dotnet_style_require_accessibility_modifiers = for_non_interface_members : suggestion | ||
|
||
# ReSharper properties | ||
resharper_csharp_max_line_length = 200 | ||
resharper_csharp_wrap_lines = false | ||
resharper_enforce_line_ending_style = true | ||
resharper_space_within_single_line_array_initializer_braces = true | ||
resharper_use_indent_from_vs = false | ||
|
||
# ReSharper inspection severities | ||
resharper_arrange_redundant_parentheses_highlighting = hint | ||
resharper_arrange_this_qualifier_highlighting = hint | ||
resharper_arrange_type_member_modifiers_highlighting = hint | ||
resharper_arrange_type_modifiers_highlighting = hint | ||
resharper_built_in_type_reference_style_for_member_access_highlighting = hint | ||
resharper_built_in_type_reference_style_highlighting = hint | ||
resharper_localizable_element_highlighting = hint | ||
resharper_redundant_base_qualifier_highlighting = warning | ||
resharper_static_member_in_generic_type_highlighting = hint | ||
resharper_suggest_var_or_type_built_in_types_highlighting = hint | ||
resharper_suggest_var_or_type_elsewhere_highlighting = hint | ||
resharper_suggest_var_or_type_simple_types_highlighting = hint | ||
|
||
|
||
# CSharp code style settings: | ||
[*.cs] | ||
indent_size = 4 | ||
|
||
# Prefer "var" everywhere | ||
csharp_style_var_for_built_in_types = true : suggestion | ||
csharp_style_var_when_type_is_apparent = true : suggestion | ||
csharp_style_var_elsewhere = true : suggestion | ||
|
||
# Prefer method-like constructs to have a block body | ||
csharp_style_expression_bodied_methods = false:none | ||
csharp_style_expression_bodied_constructors = false:none | ||
csharp_style_expression_bodied_operators = false:none | ||
|
||
# Prefer property-like constructs to have an expression-body | ||
csharp_style_expression_bodied_properties = true:none | ||
csharp_style_expression_bodied_indexers = true:none | ||
csharp_style_expression_bodied_accessors = true:none | ||
|
||
# Suggest more modern language features when available | ||
csharp_style_pattern_matching_over_is_with_cast_check = true : suggestion | ||
csharp_style_pattern_matching_over_as_with_null_check = true : suggestion | ||
csharp_style_inlined_variable_declaration = true : suggestion | ||
csharp_style_throw_expression = true : suggestion | ||
csharp_style_conditional_delegate_call = true : suggestion | ||
|
||
# Newline settings | ||
csharp_new_line_before_open_brace = all | ||
csharp_new_line_before_else = true | ||
csharp_new_line_before_catch = true | ||
csharp_new_line_before_finally = true | ||
csharp_new_line_before_members_in_object_initializers = true | ||
csharp_new_line_before_members_in_anonymous_types = true | ||
|
||
# 'using' directive preferences | ||
csharp_using_directive_placement = outside_namespace:silent | ||
dotnet_sort_system_directives_first = true | ||
dotnet_separate_import_directive_groups = false | ||
|
||
# Settings exported from ReSharper | ||
csharp_indent_case_contents = true | ||
csharp_indent_case_contents_when_block = true | ||
csharp_indent_labels = flush_left | ||
csharp_indent_switch_labels = true | ||
csharp_new_line_between_query_expression_clauses = true | ||
csharp_prefer_braces = true:silent | ||
csharp_prefer_simple_default_expression = true : suggestion | ||
csharp_style_deconstructed_variable_declaration = true : suggestion | ||
csharp_preserve_single_line_blocks = true | ||
csharp_preserve_single_line_statements = true | ||
csharp_space_after_cast = false | ||
csharp_space_after_colon_in_inheritance_clause = true | ||
csharp_space_after_keywords_in_control_flow_statements = true | ||
csharp_space_around_binary_operators = before_and_after | ||
csharp_space_before_colon_in_inheritance_clause = true | ||
csharp_space_between_method_call_empty_parameter_list_parentheses = false | ||
csharp_space_between_method_call_name_and_opening_parenthesis = false | ||
csharp_space_between_method_call_parameter_list_parentheses = false | ||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false | ||
csharp_space_between_method_declaration_parameter_list_parentheses = false | ||
csharp_space_between_parentheses = false | ||
csharp_style_pattern_local_over_anonymous_function = true : suggestion | ||
csharp_prefer_simple_using_statement = true:suggestion | ||
csharp_style_namespace_declarations = block_scoped:silent | ||
csharp_style_prefer_method_group_conversion = true:silent | ||
csharp_style_prefer_top_level_statements = true:silent | ||
csharp_style_expression_bodied_lambdas = true:silent | ||
csharp_style_expression_bodied_local_functions = false:silent | ||
|
||
|
||
# XML and Config style settings: | ||
[*.{xml,config,csproj,props}] | ||
indent_size = 2 | ||
|
||
#JSON | ||
[*.{json}] | ||
indent_size = 2 | ||
|
||
# YAML | ||
[*.{yml,yaml}] | ||
indent_size = 2 | ||
|
||
# Markdown | ||
[*.{md,txt}] | ||
trim_trailing_whitespace = false | ||
|
||
# Terraform | ||
[*.{tf}] | ||
indent_size = 2 | ||
|
||
[*.{cs,vb}] | ||
#### Naming styles #### | ||
|
||
# Naming rules | ||
|
||
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion | ||
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface | ||
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i | ||
|
||
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion | ||
dotnet_naming_rule.types_should_be_pascal_case.symbols = types | ||
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case | ||
|
||
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion | ||
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members | ||
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case | ||
|
||
# Symbol specifications | ||
|
||
dotnet_naming_symbols.interface.applicable_kinds = interface | ||
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected | ||
dotnet_naming_symbols.interface.required_modifiers = | ||
|
||
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum | ||
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected | ||
dotnet_naming_symbols.types.required_modifiers = | ||
|
||
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method | ||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected | ||
dotnet_naming_symbols.non_field_members.required_modifiers = | ||
|
||
# Naming styles | ||
|
||
dotnet_naming_style.begins_with_i.required_prefix = I | ||
dotnet_naming_style.begins_with_i.required_suffix = | ||
dotnet_naming_style.begins_with_i.word_separator = | ||
dotnet_naming_style.begins_with_i.capitalization = pascal_case | ||
|
||
dotnet_naming_style.pascal_case.required_prefix = | ||
dotnet_naming_style.pascal_case.required_suffix = | ||
dotnet_naming_style.pascal_case.word_separator = | ||
dotnet_naming_style.pascal_case.capitalization = pascal_case | ||
|
||
dotnet_naming_style.pascal_case.required_prefix = | ||
dotnet_naming_style.pascal_case.required_suffix = | ||
dotnet_naming_style.pascal_case.word_separator = | ||
dotnet_naming_style.pascal_case.capitalization = pascal_case | ||
dotnet_style_coalesce_expression = true:suggestion | ||
dotnet_style_null_propagation = true:suggestion | ||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion | ||
dotnet_style_prefer_auto_properties = true:silent | ||
dotnet_style_object_initializer = true:suggestion | ||
dotnet_style_collection_initializer = true:suggestion | ||
dotnet_style_operator_placement_when_wrapping = beginning_of_line | ||
tab_width = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: CI Build | ||
run-name: CIBuild_${{ github.event_name }}_${{ github.ref_name }}_${{ github.run_number }}.${{ github.run_attempt }} | ||
run-name: CIBuild_${{ github.event_name }}_${{ github.ref_name }}_${{ github.run_number }}${{ github.run_attempt }} | ||
|
||
env: | ||
PKG_MAJOR_VERSION: '1.1' | ||
|
@@ -26,8 +26,8 @@ on: | |
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build .NET | ||
setup: | ||
name: Setup Pipeline | ||
|
||
runs-on: ubuntu-latest | ||
|
||
|
@@ -36,6 +36,34 @@ jobs: | |
id: build_date | ||
run: echo "build_date=$(date +'%y%j')" >> $GITHUB_ENV | ||
|
||
- name: Set Package Suffix | ||
id: package_suffix | ||
run: | | ||
branch='${{ github.ref }}' | ||
package_suffix='' | ||
if [ "$branch" != "refs/heads/main" ] | ||
then | ||
package_suffix='-beta' | ||
fi | ||
echo "package_suffix=${package_suffix}" >> $GITHUB_ENV | ||
- name: Determine package publishing | ||
id: should_publish | ||
run: | | ||
should_publish=false | ||
if [ "${{ github.event_name }}" == "pull_request" ] | ||
then | ||
should_publish=true | ||
elif [ "${{ github.ref }}" == 'refs/heads/main' ] | ||
then | ||
should_publish=true | ||
fi | ||
echo "should_publish=${should_publish}" >> $GITHUB_ENV | ||
- name: Set Product Version | ||
id: product_version | ||
run: echo "product_version=${{ env.PKG_MAJOR_VERSION }}" >> $GITHUB_ENV | ||
|
@@ -44,6 +72,26 @@ jobs: | |
id: assembly_version | ||
run: echo "assembly_version=${{ env.PKG_MAJOR_VERSION }}.${{ env.build_date }}.${{ github.run_number }}${{ github.run_attempt }}" >> $GITHUB_ENV | ||
|
||
- name: Set Package Version | ||
id: package_version | ||
run: echo "package_version=${{ env.assembly_version }}${{ env.package_suffix }}" >> $GITHUB_ENV | ||
|
||
outputs: | ||
assembly_version: ${{ env.assembly_version }} | ||
product_version: ${{ env.product_version }} | ||
package_version: ${{ env.package_version }} | ||
should_publish: ${{ env.should_publish }} | ||
|
||
########################################################## | ||
## Bulid DotNet projects | ||
build: | ||
name: Build .NET | ||
|
||
needs: setup | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
|
@@ -56,7 +104,7 @@ jobs: | |
run: dotnet restore | ||
|
||
- name: Build | ||
run: dotnet build --configuration ${{ env.BUILD_CONFIG }} /p:"Platform=${{ env.BUILD_PLATFORM }}" /p:"Version=${{ env.product_version }}" /p:"AssemblyVersion=${{ env.assembly_version }}" --no-restore | ||
run: dotnet build --configuration ${{ env.BUILD_CONFIG }} /p:"Platform=${{ env.BUILD_PLATFORM }}" /p:"Version=${{ needs.setup.outputs.product_version }}" /p:"AssemblyVersion=${{ needs.setup.outputs.assembly_version }}" --no-restore | ||
|
||
- name: Test | ||
run: dotnet test --configuration ${{ env.BUILD_CONFIG }} --no-restore --no-build --verbosity normal --collect:"XPlat Code Coverage" | ||
|
@@ -82,7 +130,7 @@ jobs: | |
path: code-coverage-results.md | ||
|
||
- name: Pack | ||
run: dotnet pack --configuration ${{ env.BUILD_CONFIG }} /p:"Platform=${{ env.BUILD_PLATFORM }}" /p:"Version=${{ env.assembly_version }}" --no-restore --output "${{ env.NUGET_OUTPUT_FOLDER }}" | ||
run: dotnet pack --configuration ${{ env.BUILD_CONFIG }} /p:"Platform=${{ env.BUILD_PLATFORM }}" /p:"PackageVersion=${{ needs.setup.outputs.package_version }}" --no-restore --output "${{ env.NUGET_OUTPUT_FOLDER }}" | ||
|
||
- name: Upload Build Artifact | ||
uses: actions/upload-artifact@v3 | ||
|
@@ -98,15 +146,13 @@ jobs: | |
path: "${{ env.NUGET_OUTPUT_FOLDER }}/**" | ||
if-no-files-found: error | ||
|
||
outputs: | ||
assembly_version: ${{ env.assembly_version }} | ||
product_version: ${{ env.product_version }} | ||
|
||
########################################################## | ||
## Generate a Release and Tag in git | ||
release: | ||
name: Create GitHub Release | ||
if: github.ref == 'refs/heads/main' && success() | ||
|
||
needs: build | ||
needs: [setup, build] | ||
|
||
runs-on: ubuntu-latest | ||
|
||
|
@@ -115,16 +161,13 @@ jobs: | |
uses: actions/checkout@v3 | ||
|
||
- name: Tag git | ||
uses: actions/github-script@v5 | ||
uses: pkgdeps/[email protected] | ||
with: | ||
script: | | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'refs/tags/v${{ needs.build.outputs.assembly_version }}', | ||
sha: context.sha, | ||
force: true | ||
}) | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
github_repo: ${{ github.repository }} | ||
git_commit_sha: ${{ github.sha }} | ||
git_tag_prefix: "v" | ||
version: ${{ needs.setup.outputs.assembly_version }} | ||
|
||
- name: Build Changelog | ||
id: build_changelog | ||
|
@@ -135,13 +178,15 @@ jobs: | |
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: v${{ needs.build.outputs.assembly_version }} | ||
name: Release ${{ needs.build.outputs.assembly_version }} | ||
tag: v${{ needs.setup.outputs.assembly_version }} | ||
name: Release ${{ needs.setup.outputs.assembly_version }} | ||
body: ${{ steps.build_changelog.outputs.changelog }} | ||
|
||
########################################################## | ||
## Publish to NuGet | ||
publish: | ||
name: Publish to NuGet | ||
if: github.ref == 'refs/heads/main' && success() | ||
if: needs.setup.outputs.should_publish && always() | ||
|
||
needs: release | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters