From fdb051fd61f760ce3e1981e5abcfa982ee7014dc Mon Sep 17 00:00:00 2001 From: Luis Garces Date: Sun, 2 Apr 2023 22:25:40 +0100 Subject: [PATCH 1/3] chore: upgrade to .Net Standard 2.1 --- .../Rules.Framework.InMemory.Sample.csproj | 2 +- .../Rules.Framework.Providers.MongoDb.csproj | 4 +- .../Rules.Framework.WebUI.csproj | 6 +- src/Rules.Framework.WebUI/WebUIMiddleware.cs | 2 +- src/Rules.Framework/Rules.Framework.csproj | 82 +++++++++---------- .../Rules.Framework.IntegrationTests.csproj | 6 +- .../RulesFromJsonFile.cs | 7 +- ...Providers.InMemory.IntegrationTests.csproj | 8 +- ....Framework.Providers.InMemory.Tests.csproj | 12 +-- ....Providers.MongoDb.IntegrationTests.csproj | 8 +- ...s.Framework.Providers.MongoDb.Tests.csproj | 8 +- .../Rules.Framework.Tests.csproj | 16 ++-- .../Rules.Framework.WebUI.Tests.csproj | 12 +-- 13 files changed, 85 insertions(+), 88 deletions(-) diff --git a/samples/Rules.Framework.InMemory.Sample/Rules.Framework.InMemory.Sample.csproj b/samples/Rules.Framework.InMemory.Sample/Rules.Framework.InMemory.Sample.csproj index 48f467ee..21f85a59 100644 --- a/samples/Rules.Framework.InMemory.Sample/Rules.Framework.InMemory.Sample.csproj +++ b/samples/Rules.Framework.InMemory.Sample/Rules.Framework.InMemory.Sample.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 diff --git a/src/Rules.Framework.Providers.MongoDb/Rules.Framework.Providers.MongoDb.csproj b/src/Rules.Framework.Providers.MongoDb/Rules.Framework.Providers.MongoDb.csproj index 8c213d0a..c364ddd3 100644 --- a/src/Rules.Framework.Providers.MongoDb/Rules.Framework.Providers.MongoDb.csproj +++ b/src/Rules.Framework.Providers.MongoDb/Rules.Framework.Providers.MongoDb.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + netstandard2.1 9.0 true @@ -27,7 +27,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Rules.Framework.WebUI/Rules.Framework.WebUI.csproj b/src/Rules.Framework.WebUI/Rules.Framework.WebUI.csproj index 151ced4e..7cb63393 100644 --- a/src/Rules.Framework.WebUI/Rules.Framework.WebUI.csproj +++ b/src/Rules.Framework.WebUI/Rules.Framework.WebUI.csproj @@ -3,7 +3,7 @@ true true - netstandard2.0;net6.0 + netstandard2.1;net6.0 @@ -35,14 +35,14 @@ - + - + diff --git a/src/Rules.Framework.WebUI/WebUIMiddleware.cs b/src/Rules.Framework.WebUI/WebUIMiddleware.cs index 9f04643c..992c5743 100644 --- a/src/Rules.Framework.WebUI/WebUIMiddleware.cs +++ b/src/Rules.Framework.WebUI/WebUIMiddleware.cs @@ -12,7 +12,7 @@ namespace Rules.Framework.WebUI using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -#if NETSTANDARD2_0 +#if NETSTANDARD2_1 using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; diff --git a/src/Rules.Framework/Rules.Framework.csproj b/src/Rules.Framework/Rules.Framework.csproj index fe2cc12a..5346ee37 100644 --- a/src/Rules.Framework/Rules.Framework.csproj +++ b/src/Rules.Framework/Rules.Framework.csproj @@ -1,47 +1,47 @@ - + - - netstandard2.0 - 9.0 - true - - - - - - - LICENSE.md - - - Git - rules rulesframework - A generic rules framework that allows defining and evaluating rules for complex business scenarios. - - + + netstandard2.1 + 9.0 + true + + + + + + + LICENSE.md + + + Git + rules rulesframework + A generic rules framework that allows defining and evaluating rules for complex business scenarios. + + - - full - true - + + full + true + - - - True - - - + + + True + + + - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + \ No newline at end of file diff --git a/tests/Rules.Framework.IntegrationTests/Rules.Framework.IntegrationTests.csproj b/tests/Rules.Framework.IntegrationTests/Rules.Framework.IntegrationTests.csproj index 8aa0683e..d2fab03a 100644 --- a/tests/Rules.Framework.IntegrationTests/Rules.Framework.IntegrationTests.csproj +++ b/tests/Rules.Framework.IntegrationTests/Rules.Framework.IntegrationTests.csproj @@ -7,12 +7,12 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all diff --git a/tests/Rules.Framework.IntegrationTests/RulesFromJsonFile.cs b/tests/Rules.Framework.IntegrationTests/RulesFromJsonFile.cs index 0084930b..c38518d6 100644 --- a/tests/Rules.Framework.IntegrationTests/RulesFromJsonFile.cs +++ b/tests/Rules.Framework.IntegrationTests/RulesFromJsonFile.cs @@ -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; @@ -112,14 +113,14 @@ private IConditionNode CreateValueConditionNode( return conditionNodeBuilder.AsValued(integrationTestsConditionType) .OfDataType() .WithComparisonOperator(@operator) - .SetOperand(Convert.ToInt32(conditionNodeDataModel.Operand)) + .SetOperand(Convert.ToInt32(conditionNodeDataModel.Operand, CultureInfo.InvariantCulture)) .Build(); case DataTypes.Decimal: return conditionNodeBuilder.AsValued(integrationTestsConditionType) .OfDataType() .WithComparisonOperator(@operator) - .SetOperand(Convert.ToDecimal(conditionNodeDataModel.Operand)) + .SetOperand(Convert.ToDecimal(conditionNodeDataModel.Operand, CultureInfo.InvariantCulture)) .Build(); case DataTypes.String: @@ -133,7 +134,7 @@ private IConditionNode CreateValueConditionNode( return conditionNodeBuilder.AsValued(integrationTestsConditionType) .OfDataType() .WithComparisonOperator(@operator) - .SetOperand(Convert.ToBoolean(conditionNodeDataModel.Operand)) + .SetOperand(Convert.ToBoolean(conditionNodeDataModel.Operand, CultureInfo.InvariantCulture)) .Build(); default: diff --git a/tests/Rules.Framework.Providers.InMemory.IntegrationTests/Rules.Framework.Providers.InMemory.IntegrationTests.csproj b/tests/Rules.Framework.Providers.InMemory.IntegrationTests/Rules.Framework.Providers.InMemory.IntegrationTests.csproj index 891d4db9..efbaaf1f 100644 --- a/tests/Rules.Framework.Providers.InMemory.IntegrationTests/Rules.Framework.Providers.InMemory.IntegrationTests.csproj +++ b/tests/Rules.Framework.Providers.InMemory.IntegrationTests/Rules.Framework.Providers.InMemory.IntegrationTests.csproj @@ -7,15 +7,15 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Rules.Framework.Providers.InMemory.Tests/Rules.Framework.Providers.InMemory.Tests.csproj b/tests/Rules.Framework.Providers.InMemory.Tests/Rules.Framework.Providers.InMemory.Tests.csproj index 8824d451..b86a7a0f 100644 --- a/tests/Rules.Framework.Providers.InMemory.Tests/Rules.Framework.Providers.InMemory.Tests.csproj +++ b/tests/Rules.Framework.Providers.InMemory.Tests/Rules.Framework.Providers.InMemory.Tests.csproj @@ -9,17 +9,17 @@ - - - - - + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Rules.Framework.Providers.MongoDb.IntegrationTests/Rules.Framework.Providers.MongoDb.IntegrationTests.csproj b/tests/Rules.Framework.Providers.MongoDb.IntegrationTests/Rules.Framework.Providers.MongoDb.IntegrationTests.csproj index 08606ff5..57fb8591 100644 --- a/tests/Rules.Framework.Providers.MongoDb.IntegrationTests/Rules.Framework.Providers.MongoDb.IntegrationTests.csproj +++ b/tests/Rules.Framework.Providers.MongoDb.IntegrationTests/Rules.Framework.Providers.MongoDb.IntegrationTests.csproj @@ -13,13 +13,13 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + diff --git a/tests/Rules.Framework.Providers.MongoDb.Tests/Rules.Framework.Providers.MongoDb.Tests.csproj b/tests/Rules.Framework.Providers.MongoDb.Tests/Rules.Framework.Providers.MongoDb.Tests.csproj index f1fd9b8f..92785d5c 100644 --- a/tests/Rules.Framework.Providers.MongoDb.Tests/Rules.Framework.Providers.MongoDb.Tests.csproj +++ b/tests/Rules.Framework.Providers.MongoDb.Tests/Rules.Framework.Providers.MongoDb.Tests.csproj @@ -9,14 +9,14 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - + all diff --git a/tests/Rules.Framework.Tests/Rules.Framework.Tests.csproj b/tests/Rules.Framework.Tests/Rules.Framework.Tests.csproj index 4b3fc947..9334c8d7 100644 --- a/tests/Rules.Framework.Tests/Rules.Framework.Tests.csproj +++ b/tests/Rules.Framework.Tests/Rules.Framework.Tests.csproj @@ -8,19 +8,15 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/Rules.Framework.WebUI.Tests/Rules.Framework.WebUI.Tests.csproj b/tests/Rules.Framework.WebUI.Tests/Rules.Framework.WebUI.Tests.csproj index a2b51717..563da5f3 100644 --- a/tests/Rules.Framework.WebUI.Tests/Rules.Framework.WebUI.Tests.csproj +++ b/tests/Rules.Framework.WebUI.Tests/Rules.Framework.WebUI.Tests.csproj @@ -8,16 +8,16 @@ - + - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive From 739b0fd2e2df1428c0c1bc7d3b57eace2684af11 Mon Sep 17 00:00:00 2001 From: Luis Garces Date: Sun, 2 Apr 2023 22:37:35 +0100 Subject: [PATCH 2/3] chore: build workflow remove unused steps and upgrade actions --- .github/workflows/dotnet-build.yml | 149 ++--------------------------- 1 file changed, 9 insertions(+), 140 deletions(-) diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index 59d3fb5f..be4914d5 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -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 \ No newline at end of file From 8c391e54349cb8d7df44a16d6cb0a18372603a26 Mon Sep 17 00:00:00 2001 From: Luis Garces Date: Tue, 4 Apr 2023 21:17:36 +0100 Subject: [PATCH 3/3] chore: remove .Net Standard 2.1 target on Web UI --- .github/workflows/dotnet-publish.yml | 4 +--- .../Rules.Framework.WebUI.csproj | 11 ++--------- src/Rules.Framework.WebUI/WebUIMiddleware.cs | 6 ------ 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/.github/workflows/dotnet-publish.yml b/.github/workflows/dotnet-publish.yml index fe9e6c04..a4f8a54e 100644 --- a/.github/workflows/dotnet-publish.yml +++ b/.github/workflows/dotnet-publish.yml @@ -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 diff --git a/src/Rules.Framework.WebUI/Rules.Framework.WebUI.csproj b/src/Rules.Framework.WebUI/Rules.Framework.WebUI.csproj index 7cb63393..26cdc3c1 100644 --- a/src/Rules.Framework.WebUI/Rules.Framework.WebUI.csproj +++ b/src/Rules.Framework.WebUI/Rules.Framework.WebUI.csproj @@ -3,7 +3,7 @@ true true - netstandard2.1;net6.0 + net6.0 @@ -35,14 +35,7 @@ - - - - - - - - + diff --git a/src/Rules.Framework.WebUI/WebUIMiddleware.cs b/src/Rules.Framework.WebUI/WebUIMiddleware.cs index 992c5743..c38b9544 100644 --- a/src/Rules.Framework.WebUI/WebUIMiddleware.cs +++ b/src/Rules.Framework.WebUI/WebUIMiddleware.cs @@ -12,12 +12,6 @@ namespace Rules.Framework.WebUI using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -#if NETSTANDARD2_1 - - using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; - -#endif - internal sealed class WebUIMiddleware { private readonly IEnumerable httpRequestHandlers;