Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/dependabot-dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2
updates:
- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
labels:
- "dependencies"
commit-message:
prefix: "chore"
include: "scope"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
- "github-actions"
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,32 @@ jobs:
test -f dist/index.cjs
test -f dist/index.d.ts
test -f dist/index.d.cts

dotnet-sdk:
name: .NET SDK Build & Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Setup .NET
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
with:
dotnet-version: "8.0.x"

- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('sdk/dotnet/**/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Restore
run: dotnet restore sdk/dotnet/RuleSync.Sdk.DotNet.sln

- name: Build
run: dotnet build sdk/dotnet/RuleSync.Sdk.DotNet.sln --configuration Release --no-restore

- name: Test
run: dotnet test sdk/dotnet/RuleSync.Sdk.DotNet.sln --configuration Release --no-build --verbosity normal
18 changes: 18 additions & 0 deletions .github/workflows/publish-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,23 @@ jobs:
EVENT_NAME: ${{ github.event_name }}
HEAD_REF: ${{ github.event.pull_request.head.ref }}

- name: Setup .NET
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
with:
dotnet-version: "8.0.x"

- name: Build .NET SDK
run: |
dotnet restore sdk/dotnet/RuleSync.Sdk.DotNet.sln
dotnet build sdk/dotnet/RuleSync.Sdk.DotNet.sln --configuration Release --no-restore

- name: Pack .NET SDK
env:
RELEASE_TAG: ${{ steps.tag.outputs.tag }}
run: |
VERSION="${RELEASE_TAG#v}"
dotnet pack sdk/dotnet/src/RuleSync.Sdk.DotNet/RuleSync.Sdk.DotNet.csproj --configuration Release --no-build --output ./nupkgs -p:Version="$VERSION"

- name: Upload assets to release
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
with:
Expand All @@ -94,3 +111,4 @@ jobs:
repomix-toon.zip
config-schema.json
mcp-schema.json
nupkgs/*.nupkg
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
permissions:
id-token: write # Required for OIDC
contents: write # Required for checking out code and editing release state
packages: write # Required for publishing to GitHub Packages

jobs:
publish:
Expand All @@ -32,6 +33,29 @@ jobs:
- name: Publish to npm
run: pnpm publish

- name: Setup .NET
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
with:
dotnet-version: "8.0.x"

- name: Download NuGet package from release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
run: |
TAG="${HEAD_BRANCH#release/}"
mkdir -p nupkgs
gh release download "$TAG" --pattern "*.nupkg" --dir nupkgs

- name: Publish to GitHub Packages
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_OWNER: ${{ github.repository_owner }}
run: |
dotnet nuget add source "https://nuget.pkg.github.com/${REPO_OWNER}/index.json" --name github --username "$GITHUB_ACTOR" --password "$GITHUB_TOKEN" --store-password-in-clear-text
dotnet nuget push nupkgs/*.nupkg --source github --skip-duplicate

- name: Publish target draft release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
142 changes: 142 additions & 0 deletions sdk/dotnet/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
root = true

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

# C# files
[*.cs]
# Indentation
indent_size = 4
tab_width = 4

# New lines
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

# Spaces
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
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_parameter_list_parentheses = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false

# Wrapping
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true

# Organize usings
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false

# Naming conventions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
dotnet_naming_style.camel_case_style.capitalization = camel_case

# Classes, structs, enums, delegates: PascalCase
dotnet_naming_symbols.types.applicable_kinds = class, struct, enum, delegate, interface
dotnet_naming_rule.types_naming.symbols = types
dotnet_naming_rule.types_naming.style = pascal_case_style
dotnet_naming_rule.types_naming.severity = suggestion

# Constants: PascalCase
dotnet_naming_symbols.constants.applicable_kinds = field
dotnet_naming_symbols.constants.applicable_accessibilities = *
dotnet_naming_symbols.constants.required_modifiers = const
dotnet_naming_rule.constants_naming.symbols = constants
dotnet_naming_rule.constants_naming.style = pascal_case_style
dotnet_naming_rule.constants_naming.severity = suggestion

# Static fields: PascalCase
dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.applicable_accessibilities = *
dotnet_naming_symbols.static_fields.required_modifiers = static
dotnet_naming_rule.static_fields_naming.symbols = static_fields
dotnet_naming_rule.static_fields_naming.style = pascal_case_style
dotnet_naming_rule.static_fields_naming.severity = suggestion

# Instance fields: camelCase with underscore prefix
dotnet_naming_style.instance_field_style.capitalization = camel_case
net_naming_style.instance_field_style.required_prefix = _
dotnet_naming_symbols.instance_fields.applicable_kinds = field
dotnet_naming_symbols.instance_fields.applicable_accessibilities = private
dotnet_naming_rule.instance_fields_naming.symbols = instance_fields
dotnet_naming_rule.instance_fields_naming.style = instance_field_style
dotnet_naming_rule.instance_fields_naming.severity = suggestion

# Parameters, locals: camelCase
dotnet_naming_symbols.parameters_locals.applicable_kinds = parameter, local
dotnet_naming_rule.parameters_locals_naming.symbols = parameters_locals
dotnet_naming_rule.parameters_locals_naming.style = camel_case_style
dotnet_naming_rule.parameters_locals_naming.severity = suggestion

# Expression-bodied members
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_constructors = when_on_single_line:suggestion
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
csharp_style_expression_bodied_lambdas = when_on_single_line:suggestion
csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion

# Pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion

# Var preferences
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion

# Null checking
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion

# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion

# Roslyn analyzer settings
dotnet_diagnostic.CA1822.severity = suggestion # Mark members as static
dotnet_diagnostic.CA2201.severity = none # Do not raise reserved exception types
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary

# XML documentation
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion

# Project files
[*.{csproj,props,targets}]
indent_size = 2

# JSON files
[*.{json,jsonc}]
indent_size = 2

# YAML files
[*.{yml,yaml}]
indent_size = 2

# Markdown files
[*.md]
trim_trailing_whitespace = false
27 changes: 27 additions & 0 deletions sdk/dotnet/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Build outputs
bin/
obj/

# NuGet packages
*.nupkg
nupkgs/

# User-specific files
*.user
*.suo

# IDE
.vscode/
.idea/
*.sln.iml

# Test results
TestResults/

# Coverage
coverage/
*.coverage

# Misc
*.log
*.tmp
31 changes: 31 additions & 0 deletions sdk/dotnet/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>

<!-- Roslyn Source Generators -->
<ItemGroup>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
</ItemGroup>

<!-- Runtime Dependencies -->
<ItemGroup>
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
</ItemGroup>

<!-- Node.js Interop -->
<ItemGroup>
<PackageVersion Include="Microsoft.JavaScript.NodeApi" Version="0.9.5" />
</ItemGroup>

<!-- Testing Packages -->
<ItemGroup>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="xunit" Version="2.7.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
</ItemGroup>
</Project>
Loading
Loading