Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasteles committed Jul 5, 2023
0 parents commit a0ec408
Show file tree
Hide file tree
Showing 41 changed files with 2,736 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-format": {
"version": "5.1.250801",
"commands": [
"dotnet-format"
]
},
"dotnet-reportgenerator-globaltool": {
"version": "5.1.9",
"commands": [
"reportgenerator"
]
},
"nuke.globaltool": {
"version": "6.1.2",
"commands": [
"nuke"
]
}
}
}
161 changes: 161 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
root = true

[*]
indent_style = space
charset = utf-8
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf

# XML project files
[*.{csproj,fsproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# XML config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

[*.{cs,csx}]
# Organize usings
dotnet_sort_system_directives_first = true
# this. preferences
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:error
dotnet_style_predefined_type_for_member_access = true:error
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
# Modifier preferences
dotnet_style_require_accessibility_modifiers = omit_if_default:warning
dotnet_style_readonly_field = true:suggestion
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent

# Style Definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
dotnet_naming_style.camel_case_style.capitalization = camel_case


# constant case preferences
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const

dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
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

# fields case preferences
dotnet_naming_symbols.private_field_symbols.applicable_kinds = field
dotnet_naming_symbols.private_field_symbols.applicable_accessibilities = private
dotnet_naming_rule.private_field_symbols_should_be_camel_case.symbols = private_field_symbols
dotnet_naming_rule.private_field_symbols_should_be_camel_case.severity = warning
dotnet_naming_rule.private_field_symbols_should_be_camel_case.style = camel_case_style

# protected fields
dotnet_naming_symbols.protected_field_symbols.applicable_kinds = field
dotnet_naming_symbols.protected_field_symbols.applicable_accessibilities = protected
dotnet_naming_rule.protected_field_symbols_should_be_camel_case.symbols = protected_field_symbols
dotnet_naming_rule.protected_field_symbols_should_be_camel_case.severity = warning
dotnet_naming_rule.protected_field_symbols_should_be_camel_case.style = camel_case_style

[*.cs]
# var preferences
csharp_style_var_for_built_in_types = true:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_var_elsewhere = true:silent

# Expression-bodied members
csharp_style_expression_bodied_methods = true:suggestion
csharp_style_expression_bodied_constructors = true:suggestion
csharp_style_expression_bodied_operators = true:suggestion
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_indexers = true:suggestion
csharp_style_expression_bodied_accessors = true:suggestion
csharp_style_expression_bodied_lambdas = true:suggestion
csharp_style_expression_bodied_local_functions = true:suggestion

# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
# Null-checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
# Expression-level preferences
csharp_prefer_braces = when_multiline:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion

# New line preferences
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
csharp_new_line_between_query_expression_clauses = true

# Indentation preferences
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
# Space preferences
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
# Wrapping preferences
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true


# Roslynator
dotnet_analyzer_diagnostic.category-roslynator.severity = default
roslynator_analyzers.enabled_by_default = true
roslynator_refactorings.enabled = true
roslynator_compiler_diagnostic_fixes.enabled = true

dotnet_diagnostic.RCS1214.severity = warning
dotnet_diagnostic.RCS1036.severity = warning
dotnet_diagnostic.S3881.severity = suggestion
dotnet_diagnostic.IDE0011.severity = silent
dotnet_diagnostic.RCS1001.severity = silent
dotnet_diagnostic.RCS1194.severity = silent
dotnet_diagnostic.RCS1163.severity = silent
dotnet_diagnostic.RCS1118.severity = silent
dotnet_diagnostic.CA1050.severity = silent
dotnet_diagnostic.S3925.severity = silent


# Nunit
dotnet_diagnostic.NUnit1027.severity = silent
dotnet_diagnostic.S3903.severity = silent
dotnet_diagnostic.AsyncFixer05.severity = silent
dotnet_diagnostic.S3973.severity = silent
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: nuget
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 3
88 changes: 88 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: CI

on:
workflow_dispatch:
push:
branches: ["master"]

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true

jobs:
build:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup .NET Core
uses: actions/setup-dotnet@v2
with:
global-json-file: global.json

- name: Tool Restore
run: dotnet tool restore

- name: Build
run: dotnet nuke build

- name: Lint
run: dotnet nuke lint

- name: Tests
run: dotnet nuke test-coverage --configuration Release --skip build --no-logo

- name: Test Result
if: ${{ github.actor != 'dependabot[bot]' && (success() || failure()) }}
uses: dorny/[email protected]
with:
name: Test Report
reporter: dotnet-trx
path: tests/**/test_result.xml

- name: Generate Coverage Html Report
if: ${{ github.actor != 'dependabot[bot]' }}
run: dotnet nuke generate-report --no-logo

- name: Create CheckRun for code Coverage
uses: LouisBrunner/[email protected]
if: ${{ github.actor != 'dependabot[bot]' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Coverage Report Summary
conclusion: ${{ job.status }}
output_text_description_file: TestReport/Summary.md
output: '{"summary":"Created by Report-Generator"}'

- name: Upload Report
uses: actions/upload-artifact@v3
if: ${{ github.actor != 'dependabot[bot]' }}
with:
name: test_report
path: ./TestReport

- name: Generate Coverage Badges
run: dotnet nuke generate-badges --no-logo

- name: Lines of Code Badge
uses: DeathSy/[email protected]
with:
directory: ./
badge: ./Badges/lines_badge.svg
patterns: "**/*.fs|**/*.fsx|**/*.cs|**/*.ts|**/*.js"
ignore: "node_modules"

- name: Publish Badges
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./Badges
publish_branch: badges
force_orphan: true
78 changes: 78 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Publish

on:
workflow_dispatch:

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
GITHUB_ACTIONS: true

jobs:
build:
runs-on: ubuntu-latest
outputs:
Version: ${{ steps.gitversion.outputs.SemVer }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 5.x

- name: Determine Version
uses: gittools/actions/gitversion/[email protected]
id: gitversion

- name: Display GitVersion outputs
run: |
echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
- name: Setup .NET Core
uses: actions/setup-dotnet@v2
with:
global-json-file: global.json

- name: Tool Restore
run: dotnet tool restore

- name: Test
run: dotnet nuke test

- name: Build and Pack NuGet package
run: dotnet pack src/ --configuration Release --include-symbols -p:Version='${{ steps.gitversion.outputs.SemVer }}' --output ./Package

- name: Upload lib NuGet package artifact to GitHub
uses: actions/upload-artifact@v2
with:
name: libPackage
path: ./Package

release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && needs.build.outputs.CommitsSinceVersionSource > 0 #Only release if there has been a commit/version change
needs: build

steps:
- name: Download lib nuget package artifact
uses: actions/[email protected]
with:
name: libPackage

- name: Push package to Nuget
run: |
dotnet nuget push libPackage/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.build.outputs.Version }}
name: Release ${{ needs.build.outputs.Version }}
artifacts: "libPackage/*"
token: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit a0ec408

Please sign in to comment.