1 Star 2 Fork 1

中恒/opentcs-integration-example

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
.gitlab-ci.yml 3.34 KB
一键复制 编辑 原始数据 按行查看 历史
image: adoptopenjdk:13-jdk-hotspot
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "web"
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
DO_DEPLOY:
value: "false"
description: "Whether (true) or not (false) to deploy."
NO_BUILD_NUMBER:
value: "false"
description: "Whether (true) or not (false) to exclude the build number from the artifacts' version numbers."
before_script:
# Put GRADLE_USER_HOME into the cache directory so the wrapper is not
# re-downloaded for every job.
- export GRADLE_USER_HOME=/cache/.gradle
cache:
key: ${CI_COMMIT_REF_SLUG}
stages:
- build
- test
build:
stage: build
tags:
- opentcs-runner
script:
- echo "CI_PIPELINE_IID is $CI_PIPELINE_IID"
- echo "DO_DEPLOY is $DO_DEPLOY"
- echo "NO_BUILD_NUMBER is $NO_BUILD_NUMBER"
- 'if [ "$DO_DEPLOY" = "true" ]; then
echo "Executing build with deployment...";
./gradlew clean build publish jacocoLogAggregatedCoverage -PNO_BUILD_NUMBER="$NO_BUILD_NUMBER";
else
echo "Executing build without deployment...";
./gradlew clean build jacocoLogAggregatedCoverage -PNO_BUILD_NUMBER="$NO_BUILD_NUMBER";
fi'
coverage: '/Branch Coverage: ([0-9.]+)%/'
artifacts:
paths:
- build/distributions/*.zip
- openTCS-*/build/reports/checkstyle/*.xml
- openTCS-*/build/test-results/test/TEST-*.xml
reports:
junit: openTCS-*/build/test-results/test/TEST-*.xml
when: always
expire_in: 1 week
ensure_tests_passed:
stage: test
tags:
- opentcs-runner
variables:
CONCATENATED_REPORT_FILE: concatenated-test-reports.xml
script:
- echo "Checking test reports for failures..."
- rm -f $CONCATENATED_REPORT_FILE
- find . -name "TEST-*.xml" -exec cat '{}' + >> $CONCATENATED_REPORT_FILE
# There are examples of simply using 'grep -L "<failure", but the
# grep we have here doesn't provide the expected exit status with
# that, so we stick to plain grep and an if-else clause.
- 'if grep "<failure" $CONCATENATED_REPORT_FILE ; then
echo "There are failed tests - failing this job...";
false;
else
echo "No failed tests here.";
true;
fi'
code_quality:
stage: test
tags:
- opentcs-runner
variables:
CODE_CLIMATE_FILE: gl-code-quality-report.json
script:
- echo "Installing dependencies required for violations-command-line..."
- apt update && apt upgrade -y
- apt install -y nodejs npm
- npm install -g npx
- echo "Converting CheckStyle reports to CodeClimate report..."
- npx violations-command-line@1.21.0 -cc $CODE_CLIMATE_FILE -print-violations false -diff-print-violations true -v "CHECKSTYLE" "." ".*checkstyle/.*\.xml$" "Checkstyle"
- sed -i.bak -e "s,$CI_PROJECT_DIR/,,g" $CODE_CLIMATE_FILE
artifacts:
reports:
codequality: $CODE_CLIMATE_FILE
rules:
- if: '$CODE_QUALITY_DISABLED'
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' # Run code quality job in merge request pipelines
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' # Run code quality job in pipelines on the master branch (but not in other branch pipelines)
- if: '$CI_COMMIT_TAG' # Run code quality job in pipelines for tags
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/yuanji1020/opentcs-integration-example.git
git@gitee.com:yuanji1020/opentcs-integration-example.git
yuanji1020
opentcs-integration-example
opentcs-integration-example
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385