From c95a07bc44379c6087704dbf4d9a658ca43852b6 Mon Sep 17 00:00:00 2001 From: Suchin Sapphasitthatha Date: Wed, 18 Dec 2024 08:40:29 +0000 Subject: [PATCH] modify CI --- .onedev-buildspec.yml | 68 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml index dda7d4b..4922bb2 100644 --- a/.onedev-buildspec.yml +++ b/.onedev-buildspec.yml @@ -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