1
0
Files
common/.gitlab-ci.yml
2023-10-17 07:32:47 +02:00

148 lines
3.8 KiB
YAML

# 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
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
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
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:
- 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:
- 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:
- 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:
- 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