1
0

Fixing CI build

This commit is contained in:
2023-10-15 07:20:55 +02:00
parent 5bd5e4b802
commit 18b9627ea4
5 changed files with 146 additions and 231 deletions

View File

@@ -1,225 +1,147 @@
# The image has to use the same version as the .NET UnitTest project # The image should use the same version as the UnitTests are
image: mcr.microsoft.com/dotnet/sdk:6.0 image: mcr.microsoft.com/dotnet/sdk:6.0
variables: variables:
TZ: "Europe/Berlin" TZ: Europe/Berlin
LANG: "de" LANG: de
stages:
stages: - build
- build - test
- test - deploy
- deploy
branch build: build-debug:
stage: build stage: build
tags: tags:
- docker - docker
- lnx - lnx
except: rules:
- tags - if: $CI_COMMIT_TAG == null
script: script:
- dotnet restore --no-cache --force - dotnet restore --no-cache --force
- dotnet build -c Debug --nologo --no-restore --no-incremental - dotnet build -c Debug --nologo --no-restore --no-incremental
- mkdir ./artifacts - mkdir ./artifacts
- mv ./AMWD.Common/bin/Debug/*.nupkg ./artifacts/ - mv ./AMWD.Common/bin/Debug/*.nupkg ./artifacts/
- mv ./AMWD.Common/bin/Debug/*.snupkg ./artifacts/ - mv ./AMWD.Common/bin/Debug/*.snupkg ./artifacts/
- mv ./AMWD.Common.AspNetCore/bin/Debug/*.nupkg ./artifacts/ - mv ./AMWD.Common.AspNetCore/bin/Debug/*.nupkg ./artifacts/
- mv ./AMWD.Common.AspNetCore/bin/Debug/*.snupkg ./artifacts/ - mv ./AMWD.Common.AspNetCore/bin/Debug/*.snupkg ./artifacts/
- mv ./AMWD.Common.EntityFrameworkCore/bin/Debug/*.nupkg ./artifacts/ - mv ./AMWD.Common.EntityFrameworkCore/bin/Debug/*.nupkg ./artifacts/
- mv ./AMWD.Common.EntityFrameworkCore/bin/Debug/*.snupkg ./artifacts/ - mv ./AMWD.Common.EntityFrameworkCore/bin/Debug/*.snupkg ./artifacts/
- mv ./AMWD.Common.Test/bin/Debug/*.nupkg ./artifacts/ - mv ./AMWD.Common.Test/bin/Debug/*.nupkg ./artifacts/
- mv ./AMWD.Common.Test/bin/Debug/*.snupkg ./artifacts/ - mv ./AMWD.Common.Test/bin/Debug/*.snupkg ./artifacts/
artifacts: artifacts:
paths: paths:
- artifacts/*.nupkg - artifacts/*.nupkg
- artifacts/*.snupkg - artifacts/*.snupkg
expire_in: 7 days expire_in: 7 days
branch test: test-debug:
stage: test stage: test
tags: dependencies:
- docker - build-debug
- lnx tags:
except: - docker
- tags - lnx
coverage: '/Total[^|]*\|[^|]*\|\s*([0-9.%]+)/' rules:
script: - if: $CI_COMMIT_TAG == null
- dotnet restore --no-cache --force # 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 - dotnet test -c Debug --nologo --no-restore
main build common:
stage: build build-release:
tags: stage: build
- docker tags:
- lnx - docker
- amd64 - lnx
only: rules:
refs: - if: $CI_COMMIT_TAG != null
- tags script:
changes: - dotnet restore --no-cache --force
- AMWD.Common/** - dotnet build -c Release --nologo --no-restore --no-incremental
script: - mkdir ./artifacts
- dotnet restore --no-cache --force - mv ./AMWD.Common/bin/Release/*.nupkg ./artifacts/
- dotnet build -c Release --nologo --no-restore --no-incremental - mv ./AMWD.Common/bin/Release/*.snupkg ./artifacts/
- mkdir ./artifacts - mv ./AMWD.Common.AspNetCore/bin/Release/*.nupkg ./artifacts/
- mv ./AMWD.Common/bin/Release/*.nupkg ./artifacts/ - mv ./AMWD.Common.AspNetCore/bin/Release/*.snupkg ./artifacts/
- mv ./AMWD.Common/bin/Release/*.snupkg ./artifacts/ - mv ./AMWD.Common.EntityFrameworkCore/bin/Release/*.nupkg ./artifacts/
artifacts: - mv ./AMWD.Common.EntityFrameworkCore/bin/Release/*.snupkg ./artifacts/
paths: - mv ./AMWD.Common.Test/bin/Release/*.nupkg ./artifacts/
- artifacts/*.nupkg - mv ./AMWD.Common.Test/bin/Release/*.snupkg ./artifacts/
- artifacts/*.snupkg artifacts:
expire_in: 1 day paths:
- artifacts/*.nupkg
main build aspnet: - artifacts/*.snupkg
stage: build expire_in: 1 days
tags:
- docker test-release:
- 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:
stage: test stage: test
tags: dependencies:
- docker - build-release
- lnx tags:
- amd64 - docker
only: - lnx
refs: rules:
- tags - if: $CI_COMMIT_TAG != null
coverage: '/Total[^|]*\|[^|]*\|\s*([0-9.%]+)/' # line-coverage
script: #coverage: '/Total[^|]*\|\s*([0-9.%]+)/'
- dotnet restore --no-cache --force # branch-coverage
- dotnet test -c Release --nologo --no-restore coverage: '/Total[^|]*\|[^|]*\|\s*([0-9.%]+)/'
script:
deploy common: - dotnet restore --no-cache --force
- dotnet test -c Release --nologo --no-restore
deploy-common:
stage: deploy stage: deploy
dependencies: dependencies:
- main test all - test-release
- main build common tags:
tags: - docker
- docker - lnx
- lnx rules:
- amd64 - if: $CI_COMMIT_TAG =~ /^v[0-9.]+/
only: script:
refs: - dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/AMWD.Common.[0-9]*.nupkg
- tags
changes: deploy-aspnet:
- 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:
stage: deploy stage: deploy
dependencies: dependencies:
- main test all - test-release
- main build aspnet tags:
tags: - docker
- docker - lnx
- lnx rules:
- amd64 - if: $CI_COMMIT_TAG =~ /^asp\/v[0-9.]+/
only: script:
refs: - dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/AMWD.Common.AspNetCore.*.nupkg
- tags
changes: deploy-entityframework:
- 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:
stage: deploy stage: deploy
dependencies: dependencies:
- main test all - test-release
- main build entityframework tags:
tags: - docker
- docker - lnx
- lnx rules:
- amd64 - if: $CI_COMMIT_TAG =~ /^efc\/v[0-9.]+/
only: script:
refs: - dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/AMWD.Common.EntityFrameworkCore.*.nupkg
- tags
changes: deploy-test:
- 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:
stage: deploy stage: deploy
dependencies: dependencies:
- main test all - test-release
- main build test tags:
tags: - docker
- docker - lnx
- lnx rules:
- amd64 - if: $CI_COMMIT_TAG =~ /^test\/v[0-9.]+/
only: script:
refs: - dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/AMWD.Common.Test.*.nupkg
- 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

View File

@@ -49,7 +49,9 @@ namespace Microsoft.AspNetCore.Http
{ {
string forwardedForAddress = null; 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) foreach (string headerName in headerNames)
{ {
if (!httpContext.Request.Headers.ContainsKey(headerName)) if (!httpContext.Request.Headers.ContainsKey(headerName))

View File

@@ -3,7 +3,7 @@
namespace AMWD.Common.AspNetCore.Security.PathProtection namespace AMWD.Common.AspNetCore.Security.PathProtection
{ {
/// <summary> /// <summary>
/// Extnsion for <see cref="IApplicationBuilder"/> to enable folder protection. /// Extension for <see cref="IApplicationBuilder"/> to enable folder protection.
/// </summary> /// </summary>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public static class ProtectedPathExtensions public static class ProtectedPathExtensions

View File

@@ -1,9 +0,0 @@
<Project>
<Target Condition="'$(Configuration)' == 'DebugLocal'" Name="CopyPackageToLocal" AfterTargets="Pack">
<Delete Files="D:\NuGetLocal\$(PackageId).$(PackageVersion).nupkg" />
<Delete Files="D:\NuGetLocal\$(PackageId).$(PackageVersion).snupkg" />
<Copy SourceFiles="$(MSBuildProjectDirectory)\bin\$(Configuration)\$(PackageId).$(PackageVersion).nupkg" DestinationFolder="D:\NuGetLocal" />
<Copy SourceFiles="$(MSBuildProjectDirectory)\bin\$(Configuration)\$(PackageId).$(PackageVersion).snupkg" DestinationFolder="D:\NuGetLocal" />
</Target>
</Project>

View File

@@ -8,7 +8,7 @@ To save time, they are all packed to NuGet packages.
| AMWD.Common | ![https://nuget.am-wd.de/packages/amwd.common/](https://services.am-wd.de/nuget.php?package=AMWD.Common) | | AMWD.Common | ![https://nuget.am-wd.de/packages/amwd.common/](https://services.am-wd.de/nuget.php?package=AMWD.Common) |
| AMWD.Common.AspNetCore | ![https://nuget.am-wd.de/packages/amwd.common.aspnetcore/](https://services.am-wd.de/nuget.php?package=AMWD.Common.AspNetCore) | | AMWD.Common.AspNetCore | ![https://nuget.am-wd.de/packages/amwd.common.aspnetcore/](https://services.am-wd.de/nuget.php?package=AMWD.Common.AspNetCore) |
| AMWD.Common.EntityFrameworkCore | ![https://nuget.am-wd.de/packages/amwd.common.entityframeworkcore/](https://services.am-wd.de/nuget.php?package=AMWD.Common.EntityFrameworkCore) | | AMWD.Common.EntityFrameworkCore | ![https://nuget.am-wd.de/packages/amwd.common.entityframeworkcore/](https://services.am-wd.de/nuget.php?package=AMWD.Common.EntityFrameworkCore) |
| AMWD.Common.Moq | ![https://nuget.am-wd.de/packages/amwd.common.moq/](https://services.am-wd.de/nuget.php?package=AMWD.Common.Moq) | | AMWD.Common.Test | ![https://nuget.am-wd.de/packages/amwd.common.test/](https://services.am-wd.de/nuget.php?package=AMWD.Common.Test) |
| CI / CD | ![https://git.am-wd.de/AM.WD/common/-/pipelines](https://git.am-wd.de/AM.WD/common/badges/main/pipeline.svg?style=flat-square) ![https://git.am-wd.de/AM.WD/common/-/tree/main](https://git.am-wd.de/AM.WD/common/badges/main/coverage.svg?style=flat-square) | | CI / CD | ![https://git.am-wd.de/AM.WD/common/-/pipelines](https://git.am-wd.de/AM.WD/common/badges/main/pipeline.svg?style=flat-square) ![https://git.am-wd.de/AM.WD/common/-/tree/main](https://git.am-wd.de/AM.WD/common/badges/main/coverage.svg?style=flat-square) |
## Documentation ## Documentation
@@ -22,8 +22,8 @@ Create a `nuget.config` file in your root project folder (where the `.sln` file
```xml ```xml
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<packageSources> <packageSources>
<add key="AM.WD" value="https://nuget.am-wd.de/v3/index.json" /> <add key="AM.WD" value="https://nuget.am-wd.de/v3/index.json" />
</packageSources> </packageSources>
</configuration> </configuration>
``` ```