1
0
Files
common/.gitlab-ci.yml
2025-11-13 20:30:44 +01:00

189 lines
4.2 KiB
YAML

# The image should use the same version as the UnitTests are
image: mcr.microsoft.com/dotnet/sdk:8.0
variables:
TZ: Europe/Berlin
LANG: de
stages:
- build
- test
- deploy
build-debug:
stage: build
tags:
- docker
- lnx
- 64bit
rules:
- if: $CI_COMMIT_TAG == null
script:
- shopt -s globstar
- mkdir ./artifacts
- dotnet build -c Debug --nologo
- mv ./**/*.nupkg ./artifacts/
- mv ./**/*.snupkg ./artifacts/
artifacts:
paths:
- artifacts/*.nupkg
- artifacts/*.snupkg
expire_in: 7 days
test-debug:
stage: test
dependencies:
- build-debug
tags:
- docker
- lnx
- 64bit
rules:
- if: $CI_COMMIT_TAG == null
coverage: /Branch coverage[\s\S].+%/
before_script:
- dotnet tool install dotnet-reportgenerator-globaltool --tool-path /dotnet-tools
script:
- dotnet test -c Debug --nologo /p:CoverletOutputFormat=Cobertura
- /dotnet-tools/reportgenerator "-reports:${CI_PROJECT_DIR}/**/coverage.cobertura.xml" "-targetdir:/reports" "-reportType:TextSummary"
after_script:
- cat /reports/Summary.txt
artifacts:
when: always
reports:
coverage_report:
coverage_format: cobertura
path: ./**/coverage.cobertura.xml
test-deploy:
stage: deploy
dependencies:
- build-debug
- test-debug
tags:
- docker
- lnx
- 64bit
rules:
- if: $CI_COMMIT_TAG == null
script:
- dotnet nuget push -k $BAGET_APIKEY -s https://nuget.home.am-wd.de/v3/index.json artifacts/*.nupkg
build-release:
stage: build
tags:
- docker
- lnx
- 64bit
rules:
- if: $CI_COMMIT_TAG != null
script:
- shopt -s globstar
- mkdir ./artifacts
- dotnet build -c Release --nologo
- mv ./**/*.nupkg ./artifacts/
- mv ./**/*.snupkg ./artifacts/
artifacts:
paths:
- artifacts/*.nupkg
- artifacts/*.snupkg
expire_in: 1 days
test-release:
stage: test
dependencies:
- build-release
tags:
- docker
- lnx
- 64bit
rules:
- if: $CI_COMMIT_TAG != null
coverage: /Branch coverage[\s\S].+%/
before_script:
- dotnet tool install dotnet-reportgenerator-globaltool --tool-path /dotnet-tools
script:
- dotnet test -c Release --nologo /p:CoverletOutputFormat=Cobertura
- /dotnet-tools/reportgenerator "-reports:${CI_PROJECT_DIR}/**/coverage.cobertura.xml" "-targetdir:/reports" "-reportType:TextSummary"
after_script:
- cat /reports/Summary.txt
artifacts:
when: always
reports:
coverage_report:
coverage_format: cobertura
path: ./**/coverage.cobertura.xml
deploy-common:
stage: deploy
dependencies:
- build-release
- test-release
tags:
- docker
- lnx
- 64bit
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:
- build-release
- test-release
tags:
- docker
- lnx
- 64bit
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-efcore:
stage: deploy
dependencies:
- build-release
- test-release
tags:
- docker
- lnx
- 64bit
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-msgpack:
stage: deploy
dependencies:
- build-release
- test-release
tags:
- docker
- lnx
- 64bit
rules:
- if: $CI_COMMIT_TAG =~ /^msgpack\/v[0-9.]+/
script:
- dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/AMWD.Common.MessagePack.*.nupkg
deploy-test:
stage: deploy
dependencies:
- build-release
- test-release
tags:
- docker
- lnx
- 64bit
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