1. 集成完整流水线脚本

This commit is contained in:
黄昕 2024-03-14 17:38:19 +08:00
parent ac3ac21d1c
commit c9895a957d
1 changed files with 54 additions and 5 deletions

View File

@ -1,10 +1,12 @@
stages :
stages :
- compile
- test
- check
- package
- release
# 编译
compile :
compile :
stage : compile
tags :
- linux-maven
@ -14,9 +16,56 @@ compile :
- echo "=============== 开始编译任务 ==============="
- mvn clean compile -DskipTests
# 集成测试
integration-test:
stage : test
tags :
- linux-maven
only :
- master
script :
- echo "=============== 开始集成测试 ==============="
- mvn test
artifacts :
when : always
reports:
junit:
- cs-base/target/surefire-reports/TEST-*.xml
- cs-crypto/target/surefire-reports/TEST-*.xml
- cs-protocol/target/surefire-reports/TEST-*.xml
- cs-database/target/surefire-reports/TEST-*.xml
- cs-authentication/target/surefire-reports/TEST-*.xml
- cs-restful/target/surefire-reports/TEST-*.xml
- cs-integrate-test/target/surefire-reports/TEST-*.xml
dependencies:
- compile
# 代码质量检查
sonarqube-check :
stage : check
tags :
- linux-maven
image : maven:3-eclipse-temurin-17
variables :
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH : "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache :
key : "${CI_JOB_NAME}"
paths:
- .sonar/cache
script :
- mvn verify sonar:sonar -Dsonar.exclusions=target/generated-sources/**/* -Dsonar.qualitygate.wait=true -Dsonar.qualitygate.timeout=600
allow_failure: true
only :
- merge_requests
- master
- main
- develop
dependencies :
- integration-test
# 打包
package :
package :
stage : package
tags :
- linux-maven
@ -27,13 +76,13 @@ package :
- mvn clean package -DskipTests
# 发布
release_job:
release_job :
stage : release
image : registry.gitlab.com/gitlab-org/release-cli:latest
tags :
- linux-maven
rules :
- if : $CI_COMMIT_TAG # Run this job when a tag is created
- if: $CI_COMMIT_TAG # Run this job when a tag is created
script :
- echo "running release_job"
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties