Skip to content

Commit 6e621f2

Browse files
setup github action build and updates
1 parent a886c7b commit 6e621f2

13 files changed

+444
-65
lines changed

.editorconfig

+271
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
# Roslyn-analyzer-based code-style rules
2+
# docs: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview?tabs=net-9
3+
# docs: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options?source=recommendations
4+
# docs: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/
5+
6+
root = true
7+
8+
# C# files
9+
[*.cs]
10+
11+
#### Core EditorConfig Options ####
12+
13+
# Indentation and spacing
14+
indent_size = 4
15+
indent_style = space
16+
tab_width = 4
17+
18+
# New line preferences
19+
end_of_line = crlf
20+
insert_final_newline = false
21+
22+
#### .NET Coding Conventions ####
23+
24+
# Organize usings
25+
dotnet_separate_import_directive_groups = false
26+
dotnet_sort_system_directives_first = true:warning
27+
file_header_template = unset
28+
29+
# this. and Me. preferences
30+
dotnet_style_qualification_for_event = false
31+
dotnet_style_qualification_for_field = false
32+
dotnet_style_qualification_for_method = false
33+
dotnet_style_qualification_for_property = false
34+
35+
# Language keywords vs BCL types preferences
36+
dotnet_style_predefined_type_for_locals_parameters_members = true
37+
dotnet_style_predefined_type_for_member_access = true
38+
39+
# Parentheses preferences
40+
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
41+
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
42+
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
43+
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
44+
45+
# Modifier preferences
46+
dotnet_style_require_accessibility_modifiers = for_non_interface_members
47+
48+
# Expression-level preferences
49+
dotnet_style_coalesce_expression = true:warning
50+
dotnet_style_collection_initializer = true
51+
dotnet_style_explicit_tuple_names = true
52+
dotnet_style_namespace_match_folder = true:warning
53+
dotnet_style_null_propagation = true:warning
54+
dotnet_style_object_initializer = true
55+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
56+
dotnet_style_prefer_auto_properties = true
57+
dotnet_style_prefer_collection_expression = when_types_loosely_match
58+
dotnet_style_prefer_compound_assignment = true:warning
59+
dotnet_style_prefer_conditional_expression_over_assignment = true:warning
60+
dotnet_style_prefer_conditional_expression_over_return = true:warning
61+
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
62+
dotnet_style_prefer_inferred_anonymous_type_member_names = true
63+
dotnet_style_prefer_inferred_tuple_names = true
64+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
65+
dotnet_style_prefer_simplified_boolean_expressions = true:warning
66+
dotnet_style_prefer_simplified_interpolation = true:warning
67+
68+
# Field preferences
69+
dotnet_style_readonly_field = true
70+
71+
# Parameter preferences
72+
dotnet_code_quality_unused_parameters = all
73+
74+
# Suppression preferences
75+
dotnet_remove_unnecessary_suppression_exclusions = none
76+
77+
# New line preferences
78+
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
79+
dotnet_style_allow_statement_immediately_after_block_experimental = false:warning
80+
81+
#### C# Coding Conventions ####
82+
83+
# var preferences
84+
csharp_style_var_elsewhere = false
85+
csharp_style_var_for_built_in_types = true:warning
86+
csharp_style_var_when_type_is_apparent = true:warning
87+
88+
# Expression-bodied members
89+
csharp_style_expression_bodied_accessors = true:silent
90+
csharp_style_expression_bodied_constructors = true:suggestion
91+
csharp_style_expression_bodied_indexers = true:suggestion
92+
csharp_style_expression_bodied_lambdas = true:suggestion
93+
csharp_style_expression_bodied_local_functions = true:suggestion
94+
csharp_style_expression_bodied_methods = true:suggestion
95+
csharp_style_expression_bodied_operators = true:suggestion
96+
csharp_style_expression_bodied_properties = true:suggestion
97+
98+
# Pattern matching preferences
99+
csharp_style_pattern_matching_over_as_with_null_check = true
100+
csharp_style_pattern_matching_over_is_with_cast_check = true
101+
csharp_style_prefer_extended_property_pattern = true
102+
csharp_style_prefer_not_pattern = true
103+
csharp_style_prefer_pattern_matching = true
104+
csharp_style_prefer_switch_expression = true
105+
106+
# Null-checking preferences
107+
csharp_style_conditional_delegate_call = true
108+
109+
# Modifier preferences
110+
csharp_prefer_static_anonymous_function = true
111+
csharp_prefer_static_local_function = true
112+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
113+
csharp_style_prefer_readonly_struct = true
114+
csharp_style_prefer_readonly_struct_member = true
115+
116+
# Code-block preferences
117+
csharp_prefer_braces = true:suggestion
118+
csharp_prefer_simple_using_statement = true:warning
119+
csharp_style_namespace_declarations = file_scoped:warning
120+
csharp_style_prefer_method_group_conversion = true:warning
121+
csharp_style_prefer_primary_constructors = true:suggestion
122+
csharp_style_prefer_top_level_statements = true:suggestion
123+
124+
# Expression-level preferences
125+
csharp_prefer_simple_default_expression = true:warning
126+
csharp_style_deconstructed_variable_declaration = true
127+
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
128+
csharp_style_inlined_variable_declaration = true:warning
129+
csharp_style_prefer_index_operator = true
130+
csharp_style_prefer_local_over_anonymous_function = true:warning
131+
csharp_style_prefer_null_check_over_type_check = true:warning
132+
csharp_style_prefer_range_operator = true
133+
csharp_style_prefer_tuple_swap = true:warning
134+
csharp_style_prefer_utf8_string_literals = true:warning
135+
csharp_style_throw_expression = true:warning
136+
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
137+
csharp_style_unused_value_expression_statement_preference = discard_variable:warning
138+
139+
# 'using' directive preferences
140+
csharp_using_directive_placement = outside_namespace:warning
141+
142+
# New line preferences
143+
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
144+
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
145+
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
146+
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
147+
csharp_style_allow_embedded_statements_on_same_line_experimental = true
148+
149+
#### C# Formatting Rules ####
150+
151+
# New line preferences
152+
csharp_new_line_before_catch = true
153+
csharp_new_line_before_else = true
154+
csharp_new_line_before_finally = true
155+
csharp_new_line_before_members_in_anonymous_types = true
156+
csharp_new_line_before_members_in_object_initializers = true
157+
csharp_new_line_before_open_brace = all
158+
csharp_new_line_between_query_expression_clauses = true
159+
160+
# Indentation preferences
161+
csharp_indent_block_contents = true
162+
csharp_indent_braces = false
163+
csharp_indent_case_contents = true
164+
csharp_indent_case_contents_when_block = true
165+
csharp_indent_labels = one_less_than_current
166+
csharp_indent_switch_labels = true
167+
168+
# Space preferences
169+
csharp_space_after_cast = false
170+
csharp_space_after_colon_in_inheritance_clause = true
171+
csharp_space_after_comma = true
172+
csharp_space_after_dot = false
173+
csharp_space_after_keywords_in_control_flow_statements = true
174+
csharp_space_after_semicolon_in_for_statement = true
175+
csharp_space_around_binary_operators = before_and_after
176+
csharp_space_around_declaration_statements = false
177+
csharp_space_before_colon_in_inheritance_clause = true
178+
csharp_space_before_comma = false
179+
csharp_space_before_dot = false
180+
csharp_space_before_open_square_brackets = false
181+
csharp_space_before_semicolon_in_for_statement = false
182+
csharp_space_between_empty_square_brackets = false
183+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
184+
csharp_space_between_method_call_name_and_opening_parenthesis = false
185+
csharp_space_between_method_call_parameter_list_parentheses = false
186+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
187+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
188+
csharp_space_between_method_declaration_parameter_list_parentheses = false
189+
csharp_space_between_parentheses = false
190+
csharp_space_between_square_brackets = false
191+
192+
# Wrapping preferences
193+
csharp_preserve_single_line_blocks = true
194+
csharp_preserve_single_line_statements = true
195+
196+
#### Naming styles ####
197+
198+
# Naming rules
199+
200+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
201+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
202+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
203+
204+
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
205+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
206+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
207+
208+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
209+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
210+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
211+
212+
# Symbol specifications
213+
214+
dotnet_naming_symbols.interface.applicable_kinds = interface
215+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
216+
dotnet_naming_symbols.interface.required_modifiers =
217+
218+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
219+
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
220+
dotnet_naming_symbols.types.required_modifiers =
221+
222+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
223+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
224+
dotnet_naming_symbols.non_field_members.required_modifiers =
225+
226+
# Naming styles
227+
228+
dotnet_naming_style.pascal_case.required_prefix =
229+
dotnet_naming_style.pascal_case.required_suffix =
230+
dotnet_naming_style.pascal_case.word_separator =
231+
dotnet_naming_style.pascal_case.capitalization = pascal_case
232+
233+
dotnet_naming_style.begins_with_i.required_prefix = I
234+
dotnet_naming_style.begins_with_i.required_suffix =
235+
dotnet_naming_style.begins_with_i.word_separator =
236+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
237+
238+
# Trim trailing whitespace at the end of lines
239+
trim_trailing_whitespace = true:warning
240+
241+
# Configure unnecessary usings (from Roslyn analyzers)
242+
dotnet_diagnostic.IDE0005.severity = warning
243+
244+
# Configure unnecessary usings (from C# compiler during build)
245+
dotnet_diagnostic.CS8019.severity = silent
246+
247+
# Configure redundant suppression of diagnostics
248+
dotnet_diagnostic.IDE0079.severity = warning
249+
250+
#Configure inconsistent nameof usage
251+
#Examples
252+
#throw new ArgumentNullException("parameterName"); // Hardcoded string
253+
#throw new ArgumentNullException(nameof(parameterName)); // Recommended
254+
dotnet_diagnostic.IDE0130.severity = suggestion
255+
256+
# CS1591: Missing XML comment for publicly visible type or member
257+
dotnet_diagnostic.CS1591.severity = silent
258+
csharp_prefer_system_threading_lock = true:suggestion
259+
260+
[*.{cs,vb}]
261+
dotnet_style_coalesce_expression = true:warning
262+
dotnet_style_null_propagation = true:warning
263+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
264+
dotnet_style_prefer_auto_properties = true:silent
265+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
266+
tab_width = 4
267+
indent_size = 4
268+
end_of_line = crlf
269+
dotnet_style_object_initializer = true:suggestion
270+
dotnet_style_collection_initializer = true:suggestion
271+
dotnet_style_prefer_simplified_boolean_expressions = true:warning

.github/workflows/build.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build
2+
3+
on:
4+
# Pull requests targeting main
5+
pull_request:
6+
branches: [ main ]
7+
8+
# opened: when a PR is created
9+
# reopened: when a PR is reopened
10+
# synchronize: when commits are pushed to an open PR
11+
types: [opened, reopened, synchronize]
12+
13+
# Manually triggered
14+
workflow_dispatch:
15+
16+
jobs:
17+
build-and-test:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
24+
- name: Set up .NET
25+
uses: actions/setup-dotnet@v3
26+
with:
27+
dotnet-version: '8.0.x'
28+
29+
- name: Restore
30+
run: dotnet restore
31+
32+
- name: Install Format Tool
33+
run: dotnet tool install -g dotnet-format
34+
35+
- name: Check Format
36+
run: dotnet format --verify-no-changes --verbosity diagnostic
37+
38+
- name: Build
39+
run: dotnet build --no-restore -c Release --warnAsError
40+
41+
- name: Tests
42+
run: dotnet test --no-build --no-restore -c Release tests/Xes.UnitTests/Xes.Tests.csproj

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
# Simply.Track
22

33
Simply Track is a free to use package that allows you to add tracking capabilities to your .NET models.
4-
Add a Tracker property to your core model and a DbTracker property to your database model.
4+
Add a Tracker property to your core model and a DbTracker property to your database model.
5+
6+
Install from NuGet:
7+
```
8+
https://www.nuget.org/packages/Simply.Track/1.0.0
9+
```
10+
11+
## Package Usage Project Example

Simply.Track.sln

+19-5
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,34 @@ Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio Version 17
33
VisualStudioVersion = 17.12.35527.113
44
MinimumVisualStudioVersion = 10.0.40219.1
5-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Simply.Track", "Simply.Track.csproj", "{A2EDBBE4-3BD1-4A1E-84FB-CD0DC7FCA0A3}"
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Simply.Track", "src\Simply.Track.csproj", "{0120FA69-A1C0-4207-8076-1566408C24F4}"
6+
EndProject
7+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5642B832-0D12-43EF-8682-878A592102F4}"
8+
EndProject
9+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{8247F3F8-A8A6-4B3F-B01B-F49ACF965175}"
10+
EndProject
11+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Simply.Track.Tests", "tests\Simply.Track.Tests\Simply.Track.Tests.csproj", "{ED414189-DA18-41A6-8D8F-40E26EA4AF44}"
612
EndProject
713
Global
814
GlobalSection(SolutionConfigurationPlatforms) = preSolution
915
Debug|Any CPU = Debug|Any CPU
1016
Release|Any CPU = Release|Any CPU
1117
EndGlobalSection
1218
GlobalSection(ProjectConfigurationPlatforms) = postSolution
13-
{A2EDBBE4-3BD1-4A1E-84FB-CD0DC7FCA0A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
14-
{A2EDBBE4-3BD1-4A1E-84FB-CD0DC7FCA0A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
15-
{A2EDBBE4-3BD1-4A1E-84FB-CD0DC7FCA0A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
16-
{A2EDBBE4-3BD1-4A1E-84FB-CD0DC7FCA0A3}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{0120FA69-A1C0-4207-8076-1566408C24F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20+
{0120FA69-A1C0-4207-8076-1566408C24F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
21+
{0120FA69-A1C0-4207-8076-1566408C24F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
22+
{0120FA69-A1C0-4207-8076-1566408C24F4}.Release|Any CPU.Build.0 = Release|Any CPU
23+
{ED414189-DA18-41A6-8D8F-40E26EA4AF44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24+
{ED414189-DA18-41A6-8D8F-40E26EA4AF44}.Debug|Any CPU.Build.0 = Debug|Any CPU
25+
{ED414189-DA18-41A6-8D8F-40E26EA4AF44}.Release|Any CPU.ActiveCfg = Release|Any CPU
26+
{ED414189-DA18-41A6-8D8F-40E26EA4AF44}.Release|Any CPU.Build.0 = Release|Any CPU
1727
EndGlobalSection
1828
GlobalSection(SolutionProperties) = preSolution
1929
HideSolutionNode = FALSE
2030
EndGlobalSection
31+
GlobalSection(NestedProjects) = preSolution
32+
{0120FA69-A1C0-4207-8076-1566408C24F4} = {5642B832-0D12-43EF-8682-878A592102F4}
33+
{ED414189-DA18-41A6-8D8F-40E26EA4AF44} = {8247F3F8-A8A6-4B3F-B01B-F49ACF965175}
34+
EndGlobalSection
2135
EndGlobal

TrackBase.cs

-28
This file was deleted.

0 commit comments

Comments
 (0)