diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b97bfdf..52915e5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,225 +1,147 @@
-# The image has to use the same version as the .NET UnitTest project
-image: mcr.microsoft.com/dotnet/sdk:6.0
-
-variables:
- TZ: "Europe/Berlin"
- LANG: "de"
-
-
-stages:
- - build
- - test
- - deploy
-
-
-branch build:
- stage: build
- tags:
- - docker
- - lnx
- except:
- - tags
- script:
- - dotnet restore --no-cache --force
- - dotnet build -c Debug --nologo --no-restore --no-incremental
- - mkdir ./artifacts
- - mv ./AMWD.Common/bin/Debug/*.nupkg ./artifacts/
- - mv ./AMWD.Common/bin/Debug/*.snupkg ./artifacts/
- - mv ./AMWD.Common.AspNetCore/bin/Debug/*.nupkg ./artifacts/
- - mv ./AMWD.Common.AspNetCore/bin/Debug/*.snupkg ./artifacts/
- - mv ./AMWD.Common.EntityFrameworkCore/bin/Debug/*.nupkg ./artifacts/
- - mv ./AMWD.Common.EntityFrameworkCore/bin/Debug/*.snupkg ./artifacts/
- - mv ./AMWD.Common.Test/bin/Debug/*.nupkg ./artifacts/
- - mv ./AMWD.Common.Test/bin/Debug/*.snupkg ./artifacts/
- artifacts:
- paths:
- - artifacts/*.nupkg
- - artifacts/*.snupkg
- expire_in: 7 days
-
-branch test:
+# The image should use the same version as the UnitTests are
+image: mcr.microsoft.com/dotnet/sdk:6.0
+
+variables:
+ TZ: Europe/Berlin
+ LANG: de
+
+stages:
+ - build
+ - test
+ - deploy
+
+
+
+build-debug:
+ stage: build
+ tags:
+ - docker
+ - lnx
+ rules:
+ - if: $CI_COMMIT_TAG == null
+ script:
+ - dotnet restore --no-cache --force
+ - dotnet build -c Debug --nologo --no-restore --no-incremental
+ - mkdir ./artifacts
+ - mv ./AMWD.Common/bin/Debug/*.nupkg ./artifacts/
+ - mv ./AMWD.Common/bin/Debug/*.snupkg ./artifacts/
+ - mv ./AMWD.Common.AspNetCore/bin/Debug/*.nupkg ./artifacts/
+ - mv ./AMWD.Common.AspNetCore/bin/Debug/*.snupkg ./artifacts/
+ - mv ./AMWD.Common.EntityFrameworkCore/bin/Debug/*.nupkg ./artifacts/
+ - mv ./AMWD.Common.EntityFrameworkCore/bin/Debug/*.snupkg ./artifacts/
+ - mv ./AMWD.Common.Test/bin/Debug/*.nupkg ./artifacts/
+ - mv ./AMWD.Common.Test/bin/Debug/*.snupkg ./artifacts/
+ artifacts:
+ paths:
+ - artifacts/*.nupkg
+ - artifacts/*.snupkg
+ expire_in: 7 days
+
+test-debug:
stage: test
- tags:
- - docker
- - lnx
- except:
- - tags
- coverage: '/Total[^|]*\|[^|]*\|\s*([0-9.%]+)/'
- script:
- - dotnet restore --no-cache --force
+ dependencies:
+ - build-debug
+ tags:
+ - docker
+ - lnx
+ rules:
+ - if: $CI_COMMIT_TAG == null
+ # line-coverage
+ #coverage: '/Total[^|]*\|\s*([0-9.%]+)/'
+ # branch-coverage
+ coverage: '/Total[^|]*\|[^|]*\|\s*([0-9.%]+)/'
+ script:
+ - dotnet restore --no-cache --force
- dotnet test -c Debug --nologo --no-restore
-main build common:
- stage: build
- tags:
- - docker
- - lnx
- - amd64
- only:
- refs:
- - tags
- changes:
- - AMWD.Common/**
- script:
- - dotnet restore --no-cache --force
- - dotnet build -c Release --nologo --no-restore --no-incremental
- - mkdir ./artifacts
- - mv ./AMWD.Common/bin/Release/*.nupkg ./artifacts/
- - mv ./AMWD.Common/bin/Release/*.snupkg ./artifacts/
- artifacts:
- paths:
- - artifacts/*.nupkg
- - artifacts/*.snupkg
- expire_in: 1 day
-
-main build aspnet:
- stage: build
- tags:
- - docker
- - lnx
- - amd64
- only:
- refs:
- - tags
- changes:
- - AMWD.Common.AspNetCore/**
- script:
- - dotnet restore --no-cache --force
- - dotnet build -c Release --nologo --no-restore --no-incremental
- - mkdir ./artifacts
- - mv ./AMWD.Common.AspNetCore/bin/Release/*.nupkg ./artifacts/
- - mv ./AMWD.Common.AspNetCore/bin/Release/*.snupkg ./artifacts/
- artifacts:
- paths:
- - artifacts/*.nupkg
- - artifacts/*.snupkg
- expire_in: 1 day
-
-main build entityframework:
- stage: build
- tags:
- - docker
- - lnx
- - amd64
- only:
- refs:
- - tags
- changes:
- - AMWD.Common.EntityFrameworkCore/**
- script:
- - dotnet restore --no-cache --force
- - dotnet build -c Release --nologo --no-restore --no-incremental
- - mkdir ./artifacts
- - mv ./AMWD.Common.EntityFrameworkCore/bin/Release/*.nupkg ./artifacts/
- - mv ./AMWD.Common.EntityFrameworkCore/bin/Release/*.snupkg ./artifacts/
- artifacts:
- paths:
- - artifacts/*.nupkg
- - artifacts/*.snupkg
- expire_in: 1 day
-
-main build test:
- stage: build
- tags:
- - docker
- - lnx
- - amd64
- only:
- refs:
- - tags
- changes:
- - AMWD.Common.AspNetCore/**
- script:
- - dotnet restore --no-cache --force
- - dotnet build -c Release --nologo --no-restore --no-incremental
- - mkdir ./artifacts
- - mv ./AMWD.Common.Test/bin/Release/*.nupkg ./artifacts/
- - mv ./AMWD.Common.Test/bin/Release/*.snupkg ./artifacts/
- artifacts:
- paths:
- - artifacts/*.nupkg
- - artifacts/*.snupkg
- expire_in: 1 day
-
-main test all:
+
+build-release:
+ stage: build
+ tags:
+ - docker
+ - lnx
+ rules:
+ - if: $CI_COMMIT_TAG != null
+ script:
+ - dotnet restore --no-cache --force
+ - dotnet build -c Release --nologo --no-restore --no-incremental
+ - mkdir ./artifacts
+ - mv ./AMWD.Common/bin/Release/*.nupkg ./artifacts/
+ - mv ./AMWD.Common/bin/Release/*.snupkg ./artifacts/
+ - mv ./AMWD.Common.AspNetCore/bin/Release/*.nupkg ./artifacts/
+ - mv ./AMWD.Common.AspNetCore/bin/Release/*.snupkg ./artifacts/
+ - mv ./AMWD.Common.EntityFrameworkCore/bin/Release/*.nupkg ./artifacts/
+ - mv ./AMWD.Common.EntityFrameworkCore/bin/Release/*.snupkg ./artifacts/
+ - mv ./AMWD.Common.Test/bin/Release/*.nupkg ./artifacts/
+ - mv ./AMWD.Common.Test/bin/Release/*.snupkg ./artifacts/
+ artifacts:
+ paths:
+ - artifacts/*.nupkg
+ - artifacts/*.snupkg
+ expire_in: 1 days
+
+test-release:
stage: test
- tags:
- - docker
- - lnx
- - amd64
- only:
- refs:
- - tags
- coverage: '/Total[^|]*\|[^|]*\|\s*([0-9.%]+)/'
- script:
- - dotnet restore --no-cache --force
- - dotnet test -c Release --nologo --no-restore
-
-deploy common:
+ dependencies:
+ - build-release
+ tags:
+ - docker
+ - lnx
+ rules:
+ - if: $CI_COMMIT_TAG != null
+ # line-coverage
+ #coverage: '/Total[^|]*\|\s*([0-9.%]+)/'
+ # branch-coverage
+ coverage: '/Total[^|]*\|[^|]*\|\s*([0-9.%]+)/'
+ script:
+ - dotnet restore --no-cache --force
+ - dotnet test -c Release --nologo --no-restore
+
+deploy-common:
stage: deploy
- dependencies:
- - main test all
- - main build common
- tags:
- - docker
- - lnx
- - amd64
- only:
- refs:
- - tags
- changes:
- - AMWD.Common/**
- script:
- - dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/AMWD.Common.*.nupkg
-
-deploy aspnet:
+ dependencies:
+ - test-release
+ tags:
+ - docker
+ - lnx
+ rules:
+ - if: $CI_COMMIT_TAG =~ /^v[0-9.]+/
+ script:
+ - dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/AMWD.Common.[0-9]*.nupkg
+
+deploy-aspnet:
stage: deploy
- dependencies:
- - main test all
- - main build aspnet
- tags:
- - docker
- - lnx
- - amd64
- only:
- refs:
- - tags
- changes:
- - AMWD.Common.AspNetCore/**
- script:
- - dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/AMWD.Common.AspNetCore.*.nupkg
-
-deploy entityframework:
+ dependencies:
+ - test-release
+ tags:
+ - docker
+ - lnx
+ rules:
+ - if: $CI_COMMIT_TAG =~ /^asp\/v[0-9.]+/
+ script:
+ - dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/AMWD.Common.AspNetCore.*.nupkg
+
+deploy-entityframework:
stage: deploy
- dependencies:
- - main test all
- - main build entityframework
- tags:
- - docker
- - lnx
- - amd64
- only:
- refs:
- - tags
- changes:
- - AMWD.Common.EntityFrameworkCore/**
- script:
- - dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/AMWD.Common.EntityFrameworkCore.*.nupkg
-
-deploy-main-test:
+ dependencies:
+ - test-release
+ tags:
+ - docker
+ - lnx
+ rules:
+ - if: $CI_COMMIT_TAG =~ /^efc\/v[0-9.]+/
+ script:
+ - dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/AMWD.Common.EntityFrameworkCore.*.nupkg
+
+deploy-test:
stage: deploy
- dependencies:
- - main test all
- - main build test
- tags:
- - docker
- - lnx
- - amd64
- only:
- refs:
- - tags
- changes:
- - AMWD.Common.Test/**
- script:
- - dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/AMWD.Common.Test.*.nupkg
+ dependencies:
+ - test-release
+ tags:
+ - docker
+ - lnx
+ rules:
+ - if: $CI_COMMIT_TAG =~ /^test\/v[0-9.]+/
+ script:
+ - dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/AMWD.Common.Test.*.nupkg
diff --git a/AMWD.Common.AspNetCore/Extensions/HttpContextExtensions.cs b/AMWD.Common.AspNetCore/Extensions/HttpContextExtensions.cs
index 13f49c3..fee482c 100644
--- a/AMWD.Common.AspNetCore/Extensions/HttpContextExtensions.cs
+++ b/AMWD.Common.AspNetCore/Extensions/HttpContextExtensions.cs
@@ -49,7 +49,9 @@ namespace Microsoft.AspNetCore.Http
{
string forwardedForAddress = null;
- var headerNames = string.IsNullOrWhiteSpace(ipHeaderName) ? defaultIpHeaderNames : new[] { ipHeaderName }.Concat(defaultIpHeaderNames);
+ var headerNames = string.IsNullOrWhiteSpace(ipHeaderName)
+ ? defaultIpHeaderNames
+ : new[] { ipHeaderName }.Concat(defaultIpHeaderNames);
foreach (string headerName in headerNames)
{
if (!httpContext.Request.Headers.ContainsKey(headerName))
diff --git a/AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathExtensions.cs b/AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathExtensions.cs
index cf56de0..3362365 100644
--- a/AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathExtensions.cs
+++ b/AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathExtensions.cs
@@ -3,7 +3,7 @@
namespace AMWD.Common.AspNetCore.Security.PathProtection
{
///
- /// Extnsion for to enable folder protection.
+ /// Extension for to enable folder protection.
///
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public static class ProtectedPathExtensions
diff --git a/Directory.Build.targets b/Directory.Build.targets
deleted file mode 100644
index 39a9eb1..0000000
--- a/Directory.Build.targets
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/README.md b/README.md
index a8cea2b..a82d58e 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ To save time, they are all packed to NuGet packages.
| AMWD.Common |  |
| AMWD.Common.AspNetCore |  |
| AMWD.Common.EntityFrameworkCore |  |
-| AMWD.Common.Moq |  |
+| AMWD.Common.Test |  |
| CI / CD |   |
## Documentation
@@ -22,8 +22,8 @@ Create a `nuget.config` file in your root project folder (where the `.sln` file
```xml
-
-
-
+
+
+
```