Skip to content

Commit

Permalink
Add CI templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebazzz committed Mar 14, 2020
1 parent 04b16e1 commit d8458ac
Show file tree
Hide file tree
Showing 8 changed files with 487 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
version: 2
jobs:
build:
parallelism: 4
docker:
- image: mcr.microsoft.com/dotnet/core/sdk:3.1
steps:
- checkout

- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "src/PokerTime.Web/yarn.lock" }}

- run:
name: Install Chrome
command: |
apt-get -qqy update
apt-get -qqy install lsb-release libappindicator3-1
curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
apt -y install ./google-chrome.deb
sed -i 's|HERE/chrome"|HERE/chrome" --no-sandbox|g' /opt/google/chrome/google-chrome
rm google-chrome.deb
- run:
name: Install node.js prereqs
command: apt-get -qq update && apt-get -qqy --no-install-recommends install wget gnupg git unzip

- run:
name: Download and install node.js
command: |
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt-get install --no-install-recommends -y gcc g++ make build-essential nodejs
- run:
name: Install Yarn
command: |
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.16.0
echo 'export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"' >> $BASH_ENV
- run:
name: Output important software versions
command: |
node --version
yarn --version
dotnet --version
- run:
name: Build - restore nuget packages
command: ./build.sh --target=restore-nuget-packages --verbosity=verbose

- run:
name: Build - restore node packages
command: ./build.sh --target=restore-node-packages --verbosity=verbose

- run:
name: Build - test
command: |
export MOZ_HEADLESS=1
export CIRCLECI=1
./build.sh --target=test --verbosity=verbose < /dev/null
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "src/PokerTime.Web/yarn.lock" }}
paths:
- ~/.cache/yarn
326 changes: 326 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,326 @@
root = true

# Must-have extension for: https://marketplace.visualstudio.com/items?itemName=MadsKristensen.EditorConfig

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

[*.{html,cshtml}]
indent_size = 2

# Ref: https://www.jetbrains.com/help/resharper/2018.1/EditorConfig_Razor_CSharp_RazorCodeStylePageImplSchema.html
linebreaks_around_razor_statements = true
html_blank_lines_around_razor_functions = 2
blank_lines_around_razor_helpers = 1
blank_lines_around_razor_sections = 1

spaces_around_eq_in_attribute = false
space_after_last_attribute = false
space_before_self_closing = false
attribute_style = do_not_touch
attribute_indent = align_by_first_attribute

sort_class_selectors = false
linebreak_before_all_elements = false
extra_spaces = leave_all
quote_style = doublequoted
delete_quotes_from_solid_values = false
normalize_tag_names = true

[*.{scss,css}]
#Ref: https://www.jetbrains.com/help/resharper/2018.1/EditorConfig_CSS_CodeLayoutPageSchema.html
# (note these settings don't matter much - prettier takes over when committing files anyway)

declarations_style = separate_lines
brace_style = end_of_line
keep_user_linebreaks = true
keep_blank_lines_between_declarations = 1
space_around_selector_operator = true

[*.{js,ts}]
#Ref: https://www.jetbrains.com/help/resharper/2018.1/EditorConfig_JAVA_SCRIPT_BracesPageSchema.html
# (note these settings don't matter much - prettier takes over when committing files anyway)

empty_block_style = together
function_braces = end_of_line
function_in_invocation_braces = end_of_line
control_statements_braces = end_of_line
indent_pars = outside_and_inside
force_control_statements_braces = do_not_change
indent_switch_labels = true
space_before_colon_in_type_annotation = false
space_around_pipe_or_amper_in_type_usage = false

[*.xml]
indent_size = 2

[*.json]
indent_size = 4

[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

[*.{cs,cshtml}]
charset = utf-8-bom

[*.{cs,ts,js,scss,css}]
trim_trailing_whitespace = true
insert_final_newline = true

# Line length in .prettierrc
max_line_length = 120

[*]
## Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#language-conventions
# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#this_and_me
dotnet_style_qualification_for_field = true:error
dotnet_style_qualification_for_property = true:error
dotnet_style_qualification_for_method = true:suggestion
dotnet_style_qualification_for_event = true:error

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#language_keywords
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = false:suggestion

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#normalize_modifiers
dotnet_style_require_accessibility_modifiers = always:error
dotnet_style_readonly_field = true:error

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#parentheses
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:silent

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#expression_level
dotnet_style_object_initializer=true:suggestion
dotnet_style_collection_initializer=true:suggestion
dotnet_style_explicit_tuple_names=true:warning
dotnet_style_prefer_inferred_tuple_names = false:none
dotnet_style_prefer_inferred_anonymous_type_member_names=true:suggestion
dotnet_style_prefer_auto_properties=true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method=true:warning
dotnet_style_prefer_conditional_expression_over_assignment=true:suggestion
dotnet_style_prefer_conditional_expression_over_return=true:suggestion

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#null_checking
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#implicit-and-explicit-types
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = false:suggestion

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#expression_bodied_members
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_constructors = false:warning
csharp_style_expression_bodied_operators = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = when_on_single_line:suggestion
csharp_style_expression_bodied_indexers = when_on_single_line:suggestion
csharp_style_expression_bodied_accessors = when_on_single_line:suggestion

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#pattern_matching
csharp_style_pattern_matching_over_is_with_cast_check=true:warning
csharp_style_pattern_matching_over_as_with_null_check=true:suggestion

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#inlined_variable_declarations
csharp_style_inlined_variable_declaration = true:suggestion

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#expression_level_csharp
csharp_prefer_simple_default_expression=true:warning
csharp_style_deconstructed_variable_declaration=true:suggestion
csharp_style_pattern_local_over_anonymous_function=true:suggestion

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#null_checking_csharp
csharp_style_throw_expression=true:suggestion
csharp_style_conditional_delegate_call=true:suggestion

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#code_block
csharp_prefer_braces=false:suggestion

## Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#formatting-conventions
# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#usings
dotnet_sort_system_directives_first = false:warning
dotnet_separate_import_directive_groups = true:suggestion

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#newline
csharp_new_line_before_open_brace = all:warning
csharp_new_line_before_else = false:warning
csharp_new_line_before_catch = false:warning
csharp_new_line_before_finally = true:warning
csharp_new_line_before_members_in_object_initializers = true:warning
csharp_new_line_before_members_in_anonymous_types = true:warning
csharp_new_line_between_query_expression_clauses = true:warning

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#indent
csharp_indent_case_contents = true:warning
csharp_indent_switch_labels = true:warning
csharp_indent_labels = flush_left:warning

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#spacing
csharp_space_after_cast = true:warning
csharp_space_after_keywords_in_control_flow_statements = true:warning
csharp_space_between_method_declaration_parameter_list_parentheses = false:warning
csharp_space_between_method_call_parameter_list_parentheses = false:warning
csharp_space_between_parentheses = expressions:silent
csharp_space_before_colon_in_inheritance_clause = true:warning
csharp_space_after_colon_in_inheritance_clause = true:warning
csharp_space_around_binary_operators = before_and_after:suggestion
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false:warning
csharp_space_between_method_call_name_and_opening_parenthesis = false:warning
csharp_space_between_method_call_empty_parameter_list_parentheses = false:warning

# Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#wrapping
csharp_preserve_single_line_statements = false:suggestion
csharp_preserve_single_line_blocks = true:silent

## Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions?view=vs-2017


# By default, name items with PascalCase
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style

dotnet_naming_symbols.all_members.applicable_kinds = namespace, class, struct, interface, enum, property, method, event, delegate, type_parameter, local_function

dotnet_naming_style.pascal_case_style.capitalization = pascal_case

# Public members must be capitalized (public_members_must_be_capitalized)
dotnet_naming_rule.public_members_must_be_capitalized.symbols = public_symbols
dotnet_naming_symbols.public_symbols.applicable_kinds = property,method,field,event,delegate
dotnet_naming_symbols.public_symbols.applicable_accessibilities = public
dotnet_naming_symbols.public_symbols.required_modifiers = readonly

dotnet_naming_rule.public_members_must_be_capitalized.style = first_word_upper_case_style
dotnet_naming_style.first_word_upper_case_style.capitalization = first_word_upper

dotnet_naming_rule.public_members_must_be_capitalized.severity = suggestion

# Non-private static fields are PascalCase
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style

dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected internal, private protected
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static

dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case

# Constants are PascalCase
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style

dotnet_naming_symbols.constants.applicable_kinds = field, local
dotnet_naming_symbols.constants.required_modifiers = const

dotnet_naming_style.constant_style.capitalization = pascal_case


# Instance fields are camelCase and start with _
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style

dotnet_naming_symbols.instance_fields.applicable_kinds = field

dotnet_naming_style.instance_field_style.capitalization = camel_case
dotnet_naming_style.instance_field_style.required_prefix = _


# Local functions are PascalCase
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style

dotnet_naming_symbols.local_functions.applicable_kinds = local_function

dotnet_naming_style.local_function_style.capitalization = pascal_case

# Locals are camelCase
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
dotnet_naming_rule.locals_should_be_camel_case.symbols = local
dotnet_naming_rule.locals_should_be_camel_case.style = locals_style

dotnet_naming_symbols.locals_style.applicable_kinds = local

dotnet_naming_style.locals_style.capitalization = camel_case


# Static fields are PascalCased and are not prefixed
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style

dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static

dotnet_naming_style.static_field_style.capitalization = pascal_case

# Ref: https://www.jetbrains.com/help/resharper/2018.1/EditorConfig_Index.html
add_imports_to_deepest_scope = true

default_private_modifier = explicit

arguments_literal = named
arguments_string_literal = named
arguments_named = named
arguments_anonymous_function = named

braces_for_ifelse = required_for_multiline_statement
braces_for_for = required
braces_for_foreach = required
braces_for_while = required_for_multiline
braces_for_dowhile = required
braces_for_dowhile = required
braces_for_using = required_for_multiline
braces_for_lock = required
braces_for_fixed = required

braces_redundant = true

local_function_body = expression_body
constructor_or_destructor_body = block_body

force_attribute_style = separate

csharp_keep_user_linebreaks = true

keep_existing_attribute_arrangement = false
place_attribute_on_same_line = if_owner_is_single_line

csharp_wrap_parameters_style = chop_if_long
keep_existing_declaration_parens_arrangement = false

wrap_before_declaration_lpar = false
wrap_after_declaration_lpar = true
wrap_before_declaration_rpar = true

place_constructor_initializer_on_same_line = true

csharp_wrap_arguments_style = chop_if_long
csharp_wrap_after_dot_in_method_calls = true
csharp_wrap_chained_method_calls = chop_if_long
csharp_wrap_before_binary_opsign = false

csharp_wrap_linq_expressions = chop_always
csharp_wrap_before_linq_expression = true
csharp_place_linq_into_on_new_line = false

csharp_extra_spaces = remove_all
space_before_colon_in_inheritance_clause = true
space_after_colon_in_inheritance_clause = true

space_before_type_parameter_constraint_colon= true
space_after_type_parameter_constraint_colon= true

[*.cs]

# CS0660: Type defines operator == or operator != but does not override Object.Equals(object o)
dotnet_diagnostic.CS0660.severity = none
Loading

0 comments on commit d8458ac

Please sign in to comment.