Skip to content

Commit

Permalink
Merge pull request #1 from xledger/implement-and-test
Browse files Browse the repository at this point in the history
Implement and test.
  • Loading branch information
isaksky authored Oct 8, 2024
2 parents 0ff67d5 + 88fff47 commit a672635
Show file tree
Hide file tree
Showing 23 changed files with 1,870 additions and 0 deletions.
93 changes: 93 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.csproj]
indent_size = 2
indent_style = space

[*.yml]
indent_size = 2
indent_style = space

[*.sln]
end_of_line = crlf
indent_size = 4
indent_style = tab

[*.md]
indent_size = 4
indent_style = space

# CSharp code style settings:
[*.cs]
indent_size = 4
indent_style = space

# Prefer "var" everywhere
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion

# Prefer "this" on fields
dotnet_style_qualification_for_field = true:error
dotnet_style_qualification_for_property = false
dotnet_style_qualification_for_method = false
dotnet_style_qualification_for_event = false

# No "private" fields.
dotnet_style_require_accessibility_modifiers = omit_if_default:error

# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none

# Prefer property-like constructs to have an expression-body
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent

# Use braces but not for "using"
csharp_prefer_braces = true:error
csharp_prefer_simple_using_statement = true:suggestion

# Newline settings
csharp_new_line_before_open_brace = none
csharp_new_line_before_else = false
csharp_new_line_before_catch = false
csharp_new_line_before_finally = false

# Namespace and using and whitespace
csharp_indent_labels = one_less_than_current
csharp_space_around_binary_operators = before_and_after
csharp_style_namespace_declarations = file_scoped:silent
csharp_using_directive_placement = outside_namespace:silent

# Suggest more modern language features when available
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion

csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text eol=lf
*.sln text eol=crlf
19 changes: 19 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build .NET assemblies and test

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

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- run: dotnet restore
- run: dotnet build --no-restore
- run: dotnet test --no-build --verbosity normal
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Upload .NET package

on:
release:
types: [created]

jobs:
release:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
env:
version: ${{ github.event.release.tag_name }}
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build and pack
run: |
echo $version
echo ${version:1}
case $version in v*) true;; *) echo "Git tag must start with a 'v'"; false;; esac
export version=${version:1}
echo $version
dotnet build /p:VersionPrefix=$version --configuration Release Xledger.Sql
dotnet pack /p:VersionPrefix=$version --configuration Release Xledger.Sql
# https://learn.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package-using-the-dotnet-cli
- name: Push package to nuget
run: dotnet nuget push Xledger.Sql/bin/Release/*.nupkg --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json
# run: dotnet nuget push Xledger.Sql/bin/Release/*.nupkg --api-key "$NUGET_API_KEY" --source https://apiint.nugettest.org/v3/index.json
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
Loading

0 comments on commit a672635

Please sign in to comment.