Skip to content

Commit

Permalink
More SDK changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
MustaphaTR committed Apr 10, 2023
1 parent 096fdd2 commit 21911dd
Show file tree
Hide file tree
Showing 14 changed files with 428 additions and 70 deletions.
200 changes: 198 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,17 +1,213 @@
; Top-most http://editorconfig.org/ file
root = true
charset=utf-8

; Unix-style newlines
[*]
end_of_line = LF
insert_final_newline = true
trim_trailing_whitespace = true

; 4-column tab indentation
; 4-column tab indentation and .NET coding conventions
[*.cs]
indent_style = tab
indent_size = 4

dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = true

csharp_style_var_elsewhere = true:suggestion
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion

csharp_prefer_braces = when_multiline:suggestion
csharp_using_directive_placement = outside_namespace:suggestion
csharp_new_line_before_open_brace = all
csharp_space_around_binary_operators = before_and_after

## Naming styles:

dotnet_naming_style.camel_case.capitalization = camel_case

dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.i_prefix_pascal_case.capitalization = pascal_case
dotnet_naming_style.i_prefix_pascal_case.required_prefix = I

## Symbol specifications:

dotnet_naming_symbols.const_locals.applicable_kinds = local
dotnet_naming_symbols.const_locals.applicable_accessibilities = *
dotnet_naming_symbols.const_locals.required_modifiers = const

dotnet_naming_symbols.const_fields.applicable_kinds = field
dotnet_naming_symbols.const_fields.applicable_accessibilities = *
dotnet_naming_symbols.const_fields.required_modifiers = const

dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = *
dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly

dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, internal, protected, protected_internal, private_protected
dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly

dotnet_naming_symbols.private_or_protected_fields.applicable_kinds = field
dotnet_naming_symbols.private_or_protected_fields.applicable_accessibilities = private, protected, private_protected

dotnet_naming_symbols.interfaces.applicable_kinds = interface
dotnet_naming_symbols.interfaces.applicable_accessibilities = *

dotnet_naming_symbols.parameters_and_locals.applicable_kinds = parameter, local
dotnet_naming_symbols.parameters_and_locals.applicable_accessibilities = *

dotnet_naming_symbols.most_symbols.applicable_kinds = namespace, class, struct, enum, field, property, method, local_function, event, delegate, type_parameter
dotnet_naming_symbols.most_symbols.applicable_accessibilities = *

## Naming rules:

dotnet_naming_rule.const_locals_should_be_pascal_case.symbols = const_locals
dotnet_naming_rule.const_locals_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.const_locals_should_be_pascal_case.severity = warning

dotnet_naming_rule.const_fields_should_be_pascal_case.symbols = const_fields
dotnet_naming_rule.const_fields_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.const_fields_should_be_pascal_case.severity = warning

dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.symbols = static_readonly_fields
dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.severity = warning

dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = warning

dotnet_naming_rule.private_or_protected_fields_should_be_camel_case.symbols = private_or_protected_fields
dotnet_naming_rule.private_or_protected_fields_should_be_camel_case.style = camel_case
dotnet_naming_rule.private_or_protected_fields_should_be_camel_case.severity = warning

dotnet_naming_rule.interfaces_should_be_i_prefix_pascal_case.symbols = interfaces
dotnet_naming_rule.interfaces_should_be_i_prefix_pascal_case.style = i_prefix_pascal_case
dotnet_naming_rule.interfaces_should_be_i_prefix_pascal_case.severity = warning

dotnet_naming_rule.parameters_and_locals_should_be_camel_case.symbols = parameters_and_locals
dotnet_naming_rule.parameters_and_locals_should_be_camel_case.style = camel_case
dotnet_naming_rule.parameters_and_locals_should_be_camel_case.severity = warning

dotnet_naming_rule.most_symbols_should_be_pascal_case.symbols = most_symbols
dotnet_naming_rule.most_symbols_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.most_symbols_should_be_pascal_case.severity = warning

## Formatting:

# Also handled by StyleCopAnalyzers - SA1024: ColonsMustBeSpacedCorrectly.
csharp_space_after_colon_in_inheritance_clause = true

# Also handled by StyleCopAnalyzers - SA1024: ColonsMustBeSpacedCorrectly.
csharp_space_before_colon_in_inheritance_clause = true

# Also handled by StyleCopAnalyzers - SA1000: KeywordsMustBeSpacedCorrectly.
csharp_space_after_keywords_in_control_flow_statements = true

# Leave code block on single line.
csharp_preserve_single_line_blocks = true

# Leave statements and member declarations on the same line.
csharp_preserve_single_line_statements = true

# IDE0049, IDE-only counterpart of StyleCopAnalyzers - SA1121: UseBuiltInTypeAlias.
dotnet_style_predefined_type_for_member_access = true

# IDE0049, IDE-only counterpart of StyleCopAnalyzers - SA1121: UseBuiltInTypeAlias.
dotnet_style_predefined_type_for_locals_parameters_members = true

## Others:

# Show an IDE warning when default access modifiers are explicitly specified.
dotnet_style_require_accessibility_modifiers = omit_if_default:warning

# Use 'var' instead of explicit type.
dotnet_diagnostic.IDE0007.severity = warning

# Don't prefer braces (for one liners).
dotnet_diagnostic.IDE0011.severity = silent

# Object initialization can be simplified / Use object initializer.
dotnet_diagnostic.IDE0017.severity = warning

# Collection initialization can be simplified
dotnet_diagnostic.IDE0028.severity = warning

# Simplify 'default' expression
dotnet_diagnostic.IDE0034.severity = warning

# Modifiers are not ordered.
dotnet_diagnostic.IDE0036.severity = warning

# Raise a warning on build when default access modifiers are explicitly specified.
dotnet_diagnostic.IDE0040.severity = warning

# Make field readonly.
dotnet_diagnostic.IDE0044.severity = warning

# Unused private member.
dotnet_diagnostic.IDE0052.severity = warning

# Unnecessary value assignment.
dotnet_diagnostic.IDE0059.severity = warning

# Unused parameter.
dotnet_diagnostic.IDE0060.severity = warning

# Naming rule violation.
dotnet_diagnostic.IDE1006.severity = warning

# Avoid unnecessary zero-length array allocations.
dotnet_diagnostic.CA1825.severity = warning

# Do not use Enumerable methods on indexable collections. Instead use the collection directly.
dotnet_diagnostic.CA1826.severity = warning

# Count() is used where Any() could be used instead to improve performance.
dotnet_diagnostic.CA1827.severity = warning

# Use Length/Count property instead of Enumerable.Count method.
dotnet_diagnostic.CA1829.severity = warning

# Use string.Contains(char) instead of string.Contains(string) with single characters.
dotnet_diagnostic.CA1847.severity = warning

; 4-column tab indentation
[*.yaml]
indent_style = tab
indent_size = 4
indent_size = 4

# Use 'Count' property instead of 'Any' method.
dotnet_diagnostic.RCS1080.severity = warning

# Use read-only auto-implemented property.
dotnet_diagnostic.RCS1170.severity = warning

# Unnecessary interpolated string.
dotnet_diagnostic.RCS1214.severity = warning

# Unnecessary usage of verbatim string literal.
dotnet_diagnostic.RCS1192.severity = warning

# Use pattern matching instead of combination of 'as' operator and null check.
dotnet_diagnostic.RCS1221.severity = warning

# Expression is always equal to 'true'.
dotnet_diagnostic.RCS1215.severity = warning

# Use StringComparison when comparing strings.
dotnet_diagnostic.RCS1155.severity = warning

# Abstract type should not have public constructors.
dotnet_diagnostic.RCS1160.severity = warning

# Optimize 'Dictionary<TKey, TValue>.ContainsKey' call.
dotnet_diagnostic.RCS1235.severity = warning

# Call extension method as instance method.
dotnet_diagnostic.RCS1196.severity = warning
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Enforce LF normalization on Windows
*.yaml eol=lf
*.lua eol=lf
*.cs eol=lf
*.csproj eol=lf
*.sln eol=lf
* text=lf

# Custom for Visual Studio
*.cs diff=csharp
86 changes: 86 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Continuous Integration

on:
push:
pull_request:

jobs:
linux:
name: Linux (.NET 6.0)
runs-on: ubuntu-22.04

steps:
- name: Clone Repository
uses: actions/checkout@v3

- name: Install .NET 6.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

- name: Prepare Environment
run: |
. mod.config;
awk '/\r$$/ { exit(1); }' mod.config || (printf "Invalid mod.config format. File must be saved using unix-style (LF, not CRLF or CR) line endings.\n"; exit 1);
- name: Check Code
run: |
make check
make check-packaging-scripts
- name: Check Mod
run: |
sudo apt-get install lua5.1
make check-scripts
make test
linux-mono:
name: Linux (mono)
runs-on: ubuntu-22.04

steps:
- name: Clone Repository
uses: actions/checkout@v3

- name: Prepare Environment
run: |
. mod.config;
awk '/\r$$/ { exit(1); }' mod.config || (printf "Invalid mod.config format. File must be saved using unix-style (LF, not CRLF or CR) line endings.\n"; exit 1);
- name: Check Code
run: |
# check-packaging-scripts does not depend on .net/mono, so is not needed here
mono --version
make RUNTIME=mono check
- name: Check Mod
run: |
# check-scripts does not depend on .net/mono, so is not needed here
make RUNTIME=mono test
windows:
name: Windows (.NET 6.0)
runs-on: windows-2019

steps:
- name: Clone Repository
uses: actions/checkout@v3

- name: Install .NET 6.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

- name: Check Code
shell: powershell
run: |
# Work around runtime failures on the GH Actions runner
dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
.\make.ps1 check
- name: Check Mods
run: |
chocolatey install lua --version 5.1.5.52
$ENV:Path = $ENV:Path + ";C:\Program Files (x86)\Lua\5.1\"
.\make.ps1 check-scripts
.\make.ps1 test
28 changes: 13 additions & 15 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ on:
jobs:
linux:
name: Linux AppImages
runs-on: ubuntu-20.04

runs-on: ubuntu-22.04
steps:
- name: Clone Repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install .NET 6.0
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

Expand All @@ -26,6 +25,7 @@ jobs:
run: |
make engine
mkdir -p build/linux
sudo apt install libfuse2
./packaging/linux/buildpackage.sh "${GIT_TAG}" "${PWD}/build/linux"
- name: Upload Packages
Expand All @@ -38,22 +38,21 @@ jobs:
file: build/linux/*

macos:
name: macOS Disk Images
runs-on: macos-10.15

name: macOS Disk Image
runs-on: macos-11
steps:
- name: Clone Repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install .NET 6.0
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

- name: Prepare Environment
run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV}

- name: Package Disk Images
- name: Package Disk Image
env:
MACOS_DEVELOPER_IDENTITY: ${{ secrets.MACOS_DEVELOPER_IDENTITY }}
MACOS_DEVELOPER_CERTIFICATE_BASE64: ${{ secrets.MACOS_DEVELOPER_CERTIFICATE_BASE64 }}
Expand All @@ -65,7 +64,7 @@ jobs:
mkdir -p build/macos
./packaging/macos/buildpackage.sh "${GIT_TAG}" "${PWD}/build/macos"
- name: Upload Packages
- name: Upload Package
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -76,14 +75,13 @@ jobs:

windows:
name: Windows Installers
runs-on: ubuntu-20.04

runs-on: ubuntu-22.04
steps:
- name: Clone Repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install .NET 6.0
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

Expand Down
Loading

0 comments on commit 21911dd

Please sign in to comment.