Skip to content

Commit

Permalink
chore: initial project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
derevnjuk committed Nov 4, 2022
0 parents commit 20c7446
Show file tree
Hide file tree
Showing 26 changed files with 6,513 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '2'
checks:
argument-count:
config:
threshold: 4
complex-logic:
config:
threshold: 10
file-lines:
config:
threshold: 500
method-complexity:
config:
threshold: 5
method-count:
enabled: false
method-lines:
config:
threshold: 25
nested-control-flow:
config:
threshold: 3
return-statements:
config:
threshold: 4
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"husky": {
"version": "0.5.2",
"commands": [
"husky"
]
}
}
}
107 changes: 107 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Editor configuration, see http://editorconfig.org
root = true

# All files
[*]
indent_style = space
insert_final_newline = true
indent_size = 2

[*.cs]
# 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:silent
dotnet_style_predefined_type_for_member_access = true:silent
# 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 = for_non_interface_members:silent
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:silent
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
# Use PascalCase for constant fields
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
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const

# 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 = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
# 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 = true:silent
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

[*.md]
max_line_length = off
trim_trailing_whitespace = false
55 changes: 55 additions & 0 deletions .github/workflows/auto-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI / Automated testing

on:
workflow_dispatch:

pull_request:
branches:
- '**'

jobs:
install-deps:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install .NET deps
uses: ./.github/workflows/composite/net

build-and-test:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: install-deps

strategy:
fail-fast: false
matrix:
# Using macos-12 because we need Xcode 13.3 or later (macos-latest currently points at macos-11 which uses Xcode 13.2)
# Using windows-2019 because windows-latest is much slower and we don't need anything in particular from it.
os: [ ubuntu-latest, windows-2019, macos-12 ]

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

- name: Install .NET deps
uses: ./.github/workflows/composite/net

- name: Restore .NET Dependencies
run: dotnet restore --nologo

- name: Build
run: dotnet build -c Release --no-restore --nologo /p:CopyLocalLockFileAssemblies=true

- name: dotnet format
run: dotnet format --no-restore

- name: dotnet test
run: dotnet test -c Release --no-build --nologo


27 changes: 27 additions & 0 deletions .github/workflows/composite/net/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: '.NET'
description: 'Installs .NET deps'

runs:
using: 'composite'
steps:
- name: Set Global Environment Variables
shell: bash
run: |
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> $GITHUB_ENV
echo "DOTNET_NOLOGO=1" >> $GITHUB_ENV
# Note, the following is needed on the windows-2019 image only.
# All other versions of .NET we need are pre-installed on the GitHub Actions virtual images.
- name: Install .NET 6 SDK
uses: actions/setup-dotnet@v3
if: runner.os == 'Windows'
with:
dotnet-version: 6.x.x

- name: Dependency Caching
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
25 changes: 25 additions & 0 deletions .github/workflows/composite/npm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'NPM'
description: 'Installs NPM deps'

inputs:
registry:
description: 'NPM registry'
default: 'https://registry.npmjs.org'
required: false

runs:
using: 'composite'
steps:
- name: Set Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
registry-url: ${{ inputs.registry }}


- name: Install deps in quiet mode
shell: bash
run: npm ci -q
env:
NODE_AUTH_TOKEN: ${{ env.NODE_AUTH_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI / Coverage

on:
workflow_dispatch:

pull_request:
branches:
- '**'
push:
branches:
- master

env:
NX_CACHE: nx-cache

jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install deps
uses: ./.github/workflows/composite/net

- name: Restore .NET Dependencies
run: dotnet restore --nologo

- name: Build
run: dotnet build -c Release --no-restore --nologo /p:CopyLocalLockFileAssemblies=true

- name: dotnet test
run: dotnet test -c Release --no-build --nologo

- name: Send reports to Codeclimate
uses: paambaati/[email protected]
if: ${{ hashFiles('test/**/coverage/coverage.info') }}
env:
CC_TEST_REPORTER_ID: 1a61ea2fb28c8abe9961c5f2678c063d656d29ac41cc2b4614d7c2eafa576c21
with:
coverageLocations: test/**/coverage/coverage.info:lcov
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Automated deploy

on:
release:
types: [created]

env:
TARGET_REF: ${{ github.event.release.target_commitish }}
TAG: ${{ github.event.release.target_commitish == 'master' && 'latest' || 'next' }}

jobs:
install-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.TARGET_REF }}
token: ${{ secrets.GPR_TOKEN }}

- name: Install deps
uses: ./.github/workflows/composite/net

publish:
runs-on: ubuntu-latest
needs: install-deps
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.TARGET_REF }}
token: ${{ secrets.GPR_TOKEN }}

- name: Install deps
uses: ./.github/workflows/composite/net

- name: Restore .NET Dependencies
run: dotnet restore --nologo

- name: Build
run: dotnet build -c Release --no-restore --nologo /p:CopyLocalLockFileAssemblies=true

- name: Create Nuget Packages
run: dotnet pack -c Release --no-build --nologo

- uses: actions/upload-artifact@v2
with:
name: build
path: |
src/**/Release/*.nupkg
- name: Publish package to NuGet
run: dotnet nuget push src/**/bin/Release/*.nupkg -s nuget.org -k ${{ secrets.NUGET_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Semantic release

on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GPR_TOKEN }}

- name: Install deps
uses: ./.github/workflows/composite/npm

- name: Release a new version
run: npm run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }}
Loading

0 comments on commit 20c7446

Please sign in to comment.