51 lines
1.6 KiB
YAML
51 lines
1.6 KiB
YAML
stages:
|
|
- build
|
|
|
|
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:
|
|
# Set up the environment.
|
|
- npx npm install --ci
|
|
- npx commitlint-gitlab-ci -x @commitlint/config-conventional
|
|
|
|
# Build and test everything.
|
|
- dotnet restore
|
|
- dotnet build
|
|
- 'dotnet test --test-adapter-path:. --logger:"junit;LogFilePath=../artifacts/{assembly}-test-result.xml;MethodFormat=Default;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage"'
|
|
|
|
# Summarize the output for Gitlab CI reporting.
|
|
- dotnet new tool-manifest
|
|
- dotnet tool install dotnet-reportgenerator-globaltool
|
|
- dotnet tool run reportgenerator -reports:src/*/TestResults/*/coverage.cobertura.xml -targetdir:./coverage "-reporttypes:Cobertura;TextSummary"
|
|
- grep "Line coverage" coverage/Summary.txt
|
|
|
|
# Perform the release.
|
|
- npx semantic-release
|
|
|
|
rules:
|
|
- if: '$CI_COMMIT_TITLE =~ /^chore\(release\)/'
|
|
when: never
|
|
- if: '$CI_COMMIT_TAG'
|
|
when: never
|
|
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
|
when: never
|
|
- when: on_success
|
|
|
|
artifacts:
|
|
when: always
|
|
paths:
|
|
- ./**/*test-result.xml
|
|
- ./coverage/Cobertura.xml
|
|
- ./coverage/Summary.*
|
|
- ./**/*.nupkg
|
|
reports:
|
|
junit:
|
|
- ./**/*test-result.xml
|
|
cobertura:
|
|
- ./coverage/Cobertura.xml
|