Skip to content
Merged
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
103 changes: 103 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# EditorConfig — https://editorconfig.org
root = true

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

[*.{csproj,props,targets,xml,config,nuspec}]
indent_size = 2

[*.{json,yml,yaml}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.cs]
# Namespace
csharp_style_namespace_declarations = file_scoped: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

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

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

# Modifier preferences
dotnet_style_require_accessibility_modifiers = always:suggestion

# this. qualification
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion

# Language keywords vs BCL types
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# Parentheses
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

# Newline 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

# Indentation
csharp_indent_case_contents = true
csharp_indent_switch_labels = true

# Spacing
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_call_parameter_list_parentheses = false

# Wrapping
csharp_preserve_single_line_statements = false
csharp_preserve_single_line_blocks = true

# Using directives
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false

# Naming conventions
dotnet_naming_rule.private_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.private_fields_should_be_camel_case.symbols = private_fields
dotnet_naming_rule.private_fields_should_be_camel_case.style = camel_case_underscore

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, private_protected
dotnet_naming_symbols.private_fields.required_modifiers =

dotnet_naming_style.camel_case_underscore.required_prefix = _
dotnet_naming_style.camel_case_underscore.capitalization = camel_case
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Bug report
about: Report a bug in Resilion
title: ''
labels: bug
assignees: ''

---

**Resilion version**
<!-- e.g. 0.1.0 -->

**.NET SDK version**
<!-- Run `dotnet --version` and paste the output -->

**Target framework**
<!-- e.g. net9.0 -->

**Describe the bug**
A clear description of what the bug is.

**Minimal reproduction**
<!-- Paste the smallest code that reproduces the issue -->

```csharp
var pipeline = Pipeline.Create(builder => builder
.AddRetry(new RetryStrategyOptions { MaxRetryAttempts = 3 })
.AddTimeout(TimeSpan.FromSeconds(10)));

await pipeline.ExecuteAsync(async (state, ct) =>
{
// Your operation here
return null;
}, (object?)null, CancellationToken.None);
```

**Expected behavior**
What you expected to happen.

**Actual behavior**
What actually happened. Include any exceptions or stack traces.

**Additional context**
Any other context about the problem.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest a feature for Resilion
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem?**
A clear description of what the problem is.

**Describe the solution you'd like**
A clear description of what you want to happen.

**Describe alternatives you've considered**
Any alternative solutions or features you've considered.

**Additional context**
Any other context, code examples, or references about the feature request.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

env:
DOTNET_VERSION: '9.0.x'

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
Comment thread
FreakyAli marked this conversation as resolved.
with:
persist-credentials: false

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Restore
run: dotnet restore

- name: Build
run: dotnet build -c Release --no-restore
77 changes: 77 additions & 0 deletions .github/workflows/release-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Create a release on NuGet

on:
push:
tags:
- "v*.*.*"
- "v*.*.*-pre"

env:
DOTNET_VERSION: '9.0.x'

jobs:
release-nuget:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Verify commit exists in origin/master
run: |
git fetch --no-tags --prune origin +refs/heads/*:refs/remotes/origin/*
git merge-base --is-ancestor origin/master HEAD || { echo "Tag is not on origin/master. Aborting release."; exit 1; }

- name: Get version information from tag
id: get_version
run: |
VERSION="${GITHUB_REF_NAME#v}"
# Validate SemVer format (basic check for X.Y.Z or X.Y.Z-prerelease)
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]]; then
echo "Invalid version format: $VERSION"
exit 1
fi
echo "version_without_v=$VERSION" >> "$GITHUB_OUTPUT"

- name: Build
env:
VERSION: ${{ steps.get_version.outputs.version_without_v }}
run: dotnet build -c Release -p:Version="${VERSION}"

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

- name: Pack NuGet packages
env:
VERSION: ${{ steps.get_version.outputs.version_without_v }}
run: |
dotnet pack src/Resilion/Resilion.csproj -c Release --no-build -p:Version="${VERSION}"
dotnet pack src/Resilion.Extensions/Resilion.Extensions.csproj -c Release --no-build -p:Version="${VERSION}"
dotnet pack src/Resilion.RateLimiting/Resilion.RateLimiting.csproj -c Release --no-build -p:Version="${VERSION}"

- name: NuGet login (OIDC - trusted publishing)
id: login
uses: NuGet/login@v1
with:
user: FreakyAli

- name: Push NuGet packages
run: |
VERSION="${{ steps.get_version.outputs.version_without_v }}"
NUPKGS=$(find . -name "*.nupkg" -path "*${VERSION}*" ! -name "*.symbols.nupkg")
COUNT=$(echo "$NUPKGS" | wc -l)
if [ "$COUNT" -ne 3 ]; then
echo "Expected exactly 3 matching .nupkg files, found $COUNT. Aborting."
exit 1
fi
echo "$NUPKGS" | while read -r nupkg; do
echo "Pushing: $nupkg"
dotnet nuget push "$nupkg" -s https://api.nuget.org/v3/index.json -k ${{ steps.login.outputs.NUGET_API_KEY }}
done
60 changes: 60 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: test
run-name: '[Test] ${{ github.event.head_commit.message || github.event.pull_request.title || github.ref_name }}'

on:
pull_request:
branches:
- "*"
push:
branches:
- "master"

permissions:
contents: read
checks: write
pull-requests: write

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
Comment thread
FreakyAli marked this conversation as resolved.
persist-credentials: false

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x

- name: Restore dependencies
run: dotnet restore

- name: Build Solution
run: dotnet build --configuration Release --no-restore

- name: Run Unit Tests
run: dotnet test --configuration Release --no-build -- --report-trx --results-directory ${{ github.workspace }}/TestResults

- name: Upload Test Results
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-results-${{ github.run_id }}
path: TestResults/*.trx
retention-days: 7

- name: Publish Test Results
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Unit Test Results
path: TestResults/*.trx
reporter: dotnet-trx
fail-on-error: false
token: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ ClientBin/
*.pfx
*.publishsettings
orleans.codegen.cs
.DS_Store

# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
Expand Down Expand Up @@ -427,3 +428,35 @@ FodyWeavers.xsd
*.msix
*.msm
*.msp

# AI coding agents
.claude/
.cursor/
.cursorignore
.cursorindexingignore
.cursorrules
.codex/
AGENTS.md
.copilot/
.windsurf/
.windsurfrules
.codeium/
.cody/
.continue/
.aider*
.aiderignore
.cline/
.clinerules
.roo/
.roorules
.devin/
.junie/
.augment/
.amazonq/
.gemini/
.tabnine/
.tabby/
.bolt/
.v0/
.idx/
.sourcery/
Loading
Loading