IntegrateService/.gitlab-ci.yml

105 lines
2.7 KiB
YAML
Raw Normal View History

2024-03-14 09:38:19 +00:00
stages :
2024-03-07 09:03:46 +00:00
- compile
2024-03-14 09:38:19 +00:00
- test
- check
2024-03-07 09:03:46 +00:00
- package
2024-03-13 09:46:05 +00:00
- release
2024-03-07 09:03:46 +00:00
# 编译
2024-03-14 09:38:19 +00:00
compile :
2024-03-07 09:03:46 +00:00
stage : compile
tags :
- linux-maven
only :
- master
script:
- echo "=============== 开始编译任务 ==============="
- mvn clean compile -DskipTests
2024-03-14 09:38:19 +00:00
# 集成测试
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
2024-03-21 03:06:34 +00:00
security-test-job:
stage: test
tags:
- linux-maven
script:
- echo "do opensca scan..."
- /root/.config/opensca-cli/opensca-cli -path $CI_PROJECT_DIR -token glpat-8LV_ERinz1jsKFf9prg_ -out $CI_PROJECT_DIR/results/result.html,$CI_PROJECT_DIR/results/result.dsdx.json
artifacts:
paths:
- results/
untracked: false
when: on_success
expire_in: 30 days
2024-03-14 09:38:19 +00:00
# 代码质量检查
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 :
2024-03-15 09:16:37 +00:00
- mvn verify sonar:sonar -Dsonar.exclusions=target/generated-sources/**/*
2024-03-14 09:38:19 +00:00
allow_failure: true
only :
- merge_requests
- master
- main
- develop
dependencies :
- integration-test
2024-03-12 03:05:49 +00:00
2024-03-07 09:03:46 +00:00
# 打包
2024-03-14 09:38:19 +00:00
package :
2024-03-07 09:03:46 +00:00
stage : package
tags :
- linux-maven
only :
- master
script:
- echo "=============== 开始打包任务 ==============="
2024-03-14 01:47:03 +00:00
- mvn clean package -DskipTests
2024-03-13 09:46:05 +00:00
2024-03-13 09:51:59 +00:00
# 发布
2024-03-14 09:38:19 +00:00
release_job :
2024-03-14 01:58:32 +00:00
stage : release
image : registry.gitlab.com/gitlab-org/release-cli:latest
tags :
2024-03-14 01:46:53 +00:00
- linux-maven
2024-03-14 01:58:32 +00:00
rules :
2024-03-14 09:38:19 +00:00
- if: $CI_COMMIT_TAG # Run this job when a tag is created
2024-03-14 01:58:32 +00:00
script :
2024-03-14 01:43:03 +00:00
- echo "running release_job"
2024-03-14 01:58:32 +00:00
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name : '$CI_COMMIT_TAG'
2024-03-14 02:08:22 +00:00
name : 'Release: $CI_COMMIT_TAG'
2024-03-14 01:58:32 +00:00
description: './CHANGELOG.md'