diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000..46537ee9e5 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,68 @@ +stages: + - sonarqube + - unit-test + - ui-test + - package + - cleanup-packages + - notify + +program-static-analysis: + stage: sonarqube + image: + name: sonarsource/sonar-scanner-cli:latest + entrypoint: [""] + 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: + - sonar-scanner -Dsonar.inclusions=$(git diff --name-only HEAD~1|tr '\n' ',') -Dsonar.analysis.user=${GITLAB_USER_LOGIN} + allow_failure: true + only: + - master # or the name of your main branch + +unit-test: + stage: unit-test + script: + - "/home/gitlab-runner/bin/zentao-unittest.sh ${CI_PROJECT_DIR}" + allow_failure: true + only: + - master + - merge_requests + +ui-test: + stage: ui-test + script: + - "/home/gitlab-runner/bin/zentao-uitest.sh ${CI_PROJECT_DIR}" + allow_failure: true + only: + - master + - merge_requests + +package: + stage: package + script: + - make cizip + allow_failure: true + only: + - master + +cleanup-packages: + stage: cleanup-packages + script: + - make clean + when: on_failure + only: + - master + +notify: + stage: notify + script: + - "/home/gitlab-runner/bin/ci-notify.php" + when: on_success + only: + - master + - merge_requests