modify CI

This commit is contained in:
Suchin Sapphasitthatha 2024-12-18 08:40:29 +00:00
parent ff8b517deb
commit c95a07bc44

View file

@ -68,3 +68,71 @@ jobs:
maxRetries: 3
retryDelay: 30
timeout: 14400
- name: CI for PROD
steps:
- !CheckoutStep
name: checkout code
cloneCredential: !DefaultCredential {}
withLfs: false
withSubmodules: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !GenerateChecksumStep
name: generate project checksum
files: '**/*.csproj'
targetFile: checksum
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetupCacheStep
name: set up nuget cache
key: nuget_packages_@file:checksum@
loadKeys:
- nuget_packages
paths:
- /root/.nuget/packages
uploadStrategy: UPLOAD_IF_NOT_HIT
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: test and analyze
runInContainer: true
image: mcr.microsoft.com/dotnet/sdk
interpreter: !DefaultInterpreter
commands: |
set -e
dotnet tool install -g roslynator.dotnet.cli
dotnet test -l trx --collect:"XPlat Code Coverage"
#/root/.dotnet/tools/roslynator analyze -o roslynator-analysis.xml
useTTY: true
condition: NEVER
- !PublishTRXReportStep
name: publish unit test report
reportName: Unit Test
filePatterns: '**/*.trx'
condition: NEVER
- !PublishCoberturaReportStep
name: publish code coverage report
reportName: Code Coverage
filePatterns: '**/coverage.cobertura.xml'
condition: NEVER
- !PublishRoslynatorReportStep
name: publish code problem report
reportName: Code Problems
filePatterns: roslynator-analysis.xml
failThreshold: HIGH
condition: NEVER
- !SetBuildVersionStep
name: set build version
buildVersion: '@tag@'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !BuildImageStep
name: build docker image
dockerfile: ./Dockerfile
output: !RegistryOutput
tags: hrms-git.bangkok.go.th/bma-hrms/hrms-api-exam:@build_version@ hrms-git.bangkok.go.th/bma-hrms/hrms-api-exam:latest
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers:
- !TagCreateTrigger
tags: uat-*
branches: main
retryCondition: never
maxRetries: 3
retryDelay: 30
timeout: 14400