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
149 changes: 9 additions & 140 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
@@ -1,169 +1,38 @@
name: .NET build

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

jobs:
build:

runs-on: ubuntu-latest
steps:
- name: Determine Git Checkout information
id: checkout-info
run: |
if [ $GITHUB_EVENT_NAME == 'pull_request' ]; then
BRANCH_NAME=$(echo ${{ github.event.pull_request.head.ref }})
REPOSITORY_NAME=$(echo ${{ github.event.pull_request.head.repo.full_name }})
else
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})
REPOSITORY_NAME=$(echo ${{ github.repository }})
fi

echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV
echo "Git checkout information:"
echo "Branch name: $BRANCH_NAME"
echo "Repository name: $REPOSITORY_NAME"

- name: Git Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}

- name: Force fetch tags
run: |
# get current repository tags
git fetch --tags --force

# deal with forked repositories
git remote add upstream https://github.com/${{ github.repository }}
git fetch --tags upstream

- name: Find last tag
id: prev-version-tag
run: |
last_tag=$(git tag -l "*[0-9].*[0-9].*[0-9]*" --sort "-version:refname" | head -n 1)
echo "::set-output name=tag::$last_tag"

- name: Find last commit message
id: last-commit-message
run: |
last_commit_message=$(git log -1 --pretty=%s $BRANCH_NAME --)
echo "Last commit message found:"
echo " $last_commit_message"
echo "LAST_COMMIT_MESSAGE=$last_commit_message" >> $GITHUB_ENV

- name: Bump next build version options
id: semvers
uses: "WyriHaximus/github-action-next-semvers@v1.0"
with:
version: ${{ steps.prev-version-tag.outputs.tag }}

- name: Set next build version
id: build-context
env:
MAJOR: ${{steps.semvers.outputs.major}}
MINOR: ${{steps.semvers.outputs.minor}}
PATCH: ${{steps.semvers.outputs.patch}}
CURRENT: ${{steps.prev-version-tag.outputs.tag}}
run: |
echo "::set-output name=current-version::$CURRENT"

if [[ $LAST_COMMIT_MESSAGE =~ ^major:.*$ ]]; then
echo "Bumping to next major version."
NEXT_VERSION="$MAJOR"
elif [[ $LAST_COMMIT_MESSAGE =~ ^feat:.*$ ]]; then
echo "Bumping to next minor version."
NEXT_VERSION="$MINOR"
elif [[ $LAST_COMMIT_MESSAGE =~ ^(fix|ci|refactor|chore):.*$ ]]; then
echo "Bumping to next patch version."
NEXT_VERSION="$PATCH"
else
echo "Skipping version bump."
NEXT_VERSION="$CURRENT"
fi

if [[ $BRANCH_NAME = 'master' ]]; then
echo '::set-output name=context::release'
elif [[ $NEXT_VERSION != $CURRENT ]]; then
NEXT_VERSION="$NEXT_VERSION-beta"
echo '::set-output name=context::beta'
else
echo '::set-output name=context::beta'
fi

echo "::set-output name=next-version::$NEXT_VERSION"
echo "Next version is: $NEXT_VERSION"
echo "BUILD_VERSION=$NEXT_VERSION" >> $GITHUB_ENV

- name: Print build version
run: echo "Build version will be $BUILD_VERSION"

- name: Update project version
uses: roryprimrose/set-vs-sdk-project-version@v1
with:
projectFilter: '*.csproj'
version: ${{ env.BUILD_VERSION }}
assemblyVersion: ${{ env.BUILD_VERSION }}
fileVersion: ${{ env.BUILD_VERSION }}
informationalVersion: ${{ env.BUILD_VERSION }}

- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
6.0.x

dotnet-version: 6.0.x
dotnet-quality: ga
- name: Setup Report Generator
run: dotnet tool install --global dotnet-reportgenerator-globaltool

- name: MongoDB in GitHub Actions
uses: supercharge/mongodb-github-action@1.6.0
uses: supercharge/mongodb-github-action@1.9.0
with:
mongodb-version: '4.4'

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore -c Release
# Generate code coverage reports, which are recovered by Codacy afterwards.
- name: Test
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory:"../../coverage-outputs" -m:1 -c Release

run: dotnet test --no-build --verbosity normal -m:1 -c Release --collect:"XPlat Code Coverage" --results-directory:"../../coverage-outputs"
- name: Merge coverage results
run: |
reportgenerator -reports:"../../coverage-outputs/**/*.xml" -targetdir:"../../coverage-outputs" -reporttypes:SonarQube
reportgenerator -reports:"../../coverage-outputs/**/*.xml" -targetdir:"../../coverage-outputs" -reporttypes:Cobertura
rm -rfv ../../coverage-outputs/*/
ls -la ../../coverage-outputs

- name: Clean
run: dotnet clean -c Release

- name: Clear Nuget locals
run: dotnet nuget locals all --clear

- name: Delete build tag if exists
uses: dev-drprasad/delete-tag-and-release@v0.2.0
continue-on-error: true
with:
delete_release: false
tag_name: ${{ env.BUILD_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set build tag
uses: anothrNick/github-tag-action@1.26.0
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: none
WITH_V: false
CUSTOM_TAG: ${{ env.BUILD_VERSION }}
TAG_CONTEXT: branch
RELEASE_BRANCHES: .*
ls -la ../../coverage-outputs
4 changes: 1 addition & 3 deletions .github/workflows/dotnet-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
3.1.x
6.0.x
dotnet-version: 6.0.x

- name: Set packages authoring information
id: set-packages-authoring-information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>9.0</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Authors></Authors>
Expand All @@ -27,7 +27,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Meziantou.Analyzer" Version="1.0.756">
<PackageReference Include="Meziantou.Analyzer" Version="2.0.29">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
11 changes: 2 additions & 9 deletions src/Rules.Framework.WebUI/Rules.Framework.WebUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<SignAssembly Condition="'$(OS)'=='Windows_NT'">true</SignAssembly>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<Authors></Authors>
<Version></Version>
<PackageVersion></PackageVersion>
Expand Down Expand Up @@ -35,14 +35,7 @@
<EmbeddedResource Include="node_modules/rules_list.ico" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="2.2.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.9" />
<PackageReference Include="System.Text.Json" Version="6.0.6" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

Expand Down
6 changes: 0 additions & 6 deletions src/Rules.Framework.WebUI/WebUIMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ namespace Rules.Framework.WebUI
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

#if NETSTANDARD2_0

using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;

#endif

internal sealed class WebUIMiddleware
{
private readonly IEnumerable<IHttpRequestHandler> httpRequestHandlers;
Expand Down
82 changes: 41 additions & 41 deletions src/Rules.Framework/Rules.Framework.csproj
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>9.0</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Authors></Authors>
<Version></Version>
<PackageVersion></PackageVersion>
<AssemblyVersion></AssemblyVersion>
<FileVersion></FileVersion>
<InformationalVersion></InformationalVersion>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<PackageProjectUrl></PackageProjectUrl>
<RepositoryUrl></RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageTags>rules rulesframework</PackageTags>
<Description>A generic rules framework that allows defining and evaluating rules for complex business scenarios.</Description>
<Copyright></Copyright>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>9.0</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Authors></Authors>
<Version></Version>
<PackageVersion></PackageVersion>
<AssemblyVersion></AssemblyVersion>
<FileVersion></FileVersion>
<InformationalVersion></InformationalVersion>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<PackageProjectUrl></PackageProjectUrl>
<RepositoryUrl></RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageTags>rules rulesframework</PackageTags>
<Description>A generic rules framework that allows defining and evaluating rules for complex business scenarios.</Description>
<Copyright></Copyright>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\LICENSE.md" >
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<None Include="..\..\LICENSE.md">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>


<ItemGroup>
<PackageReference Include="FluentValidation" Version="10.3.6" />
<PackageReference Include="Meziantou.Analyzer" Version="1.0.756">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.1.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentValidation" Version="10.3.6" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.29">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="6.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="FluentAssertions" Version="6.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
Expand Down
7 changes: 4 additions & 3 deletions tests/Rules.Framework.IntegrationTests/RulesFromJsonFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace Rules.Framework.IntegrationTests
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
Expand Down Expand Up @@ -112,14 +113,14 @@ private IConditionNode<TConditionType> CreateValueConditionNode<TConditionType>(
return conditionNodeBuilder.AsValued(integrationTestsConditionType)
.OfDataType<int>()
.WithComparisonOperator(@operator)
.SetOperand(Convert.ToInt32(conditionNodeDataModel.Operand))
.SetOperand(Convert.ToInt32(conditionNodeDataModel.Operand, CultureInfo.InvariantCulture))
.Build();

case DataTypes.Decimal:
return conditionNodeBuilder.AsValued(integrationTestsConditionType)
.OfDataType<decimal>()
.WithComparisonOperator(@operator)
.SetOperand(Convert.ToDecimal(conditionNodeDataModel.Operand))
.SetOperand(Convert.ToDecimal(conditionNodeDataModel.Operand, CultureInfo.InvariantCulture))
.Build();

case DataTypes.String:
Expand All @@ -133,7 +134,7 @@ private IConditionNode<TConditionType> CreateValueConditionNode<TConditionType>(
return conditionNodeBuilder.AsValued(integrationTestsConditionType)
.OfDataType<bool>()
.WithComparisonOperator(@operator)
.SetOperand(Convert.ToBoolean(conditionNodeDataModel.Operand))
.SetOperand(Convert.ToBoolean(conditionNodeDataModel.Operand, CultureInfo.InvariantCulture))
.Build();

default:
Expand Down
Loading