add CI
This commit is contained in:
parent
9896434871
commit
ff8b517deb
1 changed files with 35 additions and 67 deletions
|
|
@ -9,36 +9,54 @@ jobs:
|
||||||
withSubmodules: false
|
withSubmodules: false
|
||||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||||
- !GenerateChecksumStep
|
- !GenerateChecksumStep
|
||||||
name: generate package checksum
|
name: generate project checksum
|
||||||
files: package-lock.json yarn.lock
|
files: '**/*.csproj'
|
||||||
targetFile: checksum
|
targetFile: checksum
|
||||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||||
- !SetupCacheStep
|
- !SetupCacheStep
|
||||||
name: set up npm cache
|
name: set up nuget cache
|
||||||
key: node_modules_@file:checksum@
|
key: nuget_packages_@file:checksum@
|
||||||
loadKeys:
|
loadKeys:
|
||||||
- node_modules
|
- nuget_packages
|
||||||
paths:
|
paths:
|
||||||
- node_modules
|
- /root/.nuget/packages
|
||||||
uploadStrategy: UPLOAD_IF_NOT_HIT
|
uploadStrategy: UPLOAD_IF_NOT_HIT
|
||||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
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
|
- !SetBuildVersionStep
|
||||||
name: set build version
|
name: set build version
|
||||||
buildVersion: '@tag@'
|
buildVersion: '@tag@'
|
||||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||||
- !CommandStep
|
|
||||||
name: build & test
|
|
||||||
runInContainer: true
|
|
||||||
image: node
|
|
||||||
interpreter: !DefaultInterpreter
|
|
||||||
commands: |
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
useTTY: true
|
|
||||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
|
||||||
- !BuildImageStep
|
- !BuildImageStep
|
||||||
name: build docker image
|
name: build docker image
|
||||||
dockerfile: ./docker/Dockerfile
|
dockerfile: ./Dockerfile
|
||||||
output: !RegistryOutput
|
output: !RegistryOutput
|
||||||
tags: hrms-git.chin.in.th/bma-hrms/hrms-api-exam:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-api-exam:latest
|
tags: hrms-git.chin.in.th/bma-hrms/hrms-api-exam:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-api-exam:latest
|
||||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||||
|
|
@ -50,53 +68,3 @@ jobs:
|
||||||
maxRetries: 3
|
maxRetries: 3
|
||||||
retryDelay: 30
|
retryDelay: 30
|
||||||
timeout: 14400
|
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 package checksum
|
|
||||||
files: package-lock.json yarn.lock
|
|
||||||
targetFile: checksum
|
|
||||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
|
||||||
- !SetupCacheStep
|
|
||||||
name: set up npm cache
|
|
||||||
key: node_modules_@file:checksum@
|
|
||||||
loadKeys:
|
|
||||||
- node_modules
|
|
||||||
paths:
|
|
||||||
- node_modules
|
|
||||||
uploadStrategy: UPLOAD_IF_NOT_HIT
|
|
||||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
|
||||||
- !SetBuildVersionStep
|
|
||||||
name: set build version
|
|
||||||
buildVersion: '@tag@'
|
|
||||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
|
||||||
- !CommandStep
|
|
||||||
name: build & test
|
|
||||||
runInContainer: true
|
|
||||||
image: node
|
|
||||||
interpreter: !DefaultInterpreter
|
|
||||||
commands: |
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
useTTY: true
|
|
||||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
|
||||||
- !BuildImageStep
|
|
||||||
name: build docker image
|
|
||||||
dockerfile: ./docker/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: prod-*
|
|
||||||
branches: main
|
|
||||||
retryCondition: never
|
|
||||||
maxRetries: 3
|
|
||||||
retryDelay: 30
|
|
||||||
timeout: 14400
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue