This repository has been archived on 2023-02-02. You can view files and clone it, but cannot push or open issues or pull requests.
mfgames-toolbuilder-cil/.gitlab-ci.yml
2021-11-29 22:33:07 -06:00

56 lines
1.6 KiB
YAML

include:
- template: Security/SAST.gitlab-ci.yml
stages:
- build
- test
- release
default:
before_script:
- curl -sL https://deb.nodesource.com/setup_15.x | bash -
- apt-get install -y nodejs
build:
image: mcr.microsoft.com/dotnet/sdk:5.0
stage: build
script:
- npx npm install --ci
- npx commitlint-gitlab-ci -x @commitlint/config-conventional
- dotnet restore
- dotnet build
rules:
- if: $CI_COMMIT_BRANCH
test:
image: mcr.microsoft.com/dotnet/sdk:5.0
stage: test
script:
- 'dotnet test --test-adapter-path:. --logger:"junit;LogFilePath=../artifacts/{assembly}-test-result.xml;MethodFormat=Default;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage"'
- dotnet new tool-manifest
- dotnet tool install dotnet-reportgenerator-globaltool
- dotnet tool run reportgenerator -reports:tests/*/TestResults/*/coverage.cobertura.xml -targetdir:./coverage "-reporttypes:Cobertura;TextSummary"
- grep "Line coverage" coverage/Summary.txt
artifacts:
when: always
paths:
- ./**/*test-result.xml
- ./coverage/Cobertura.xml
- ./coverage/Summary.*
- ./**/*.nupkg
reports:
junit:
- ./**/*test-result.xml
cobertura:
- ./coverage/Cobertura.xml
publish:
image: mcr.microsoft.com/dotnet/sdk:5.0
stage: release
script:
- npm install --ci
- dotnet restore
- dotnet build
- npx semantic-release
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH