diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..d6ae90daed0898321ddbfc6448a559e6e8245c85 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,51 @@ +# To use this script, you must have the following variables defined +# You can define them at the project or the group level +# +# SONAR_URL: Full URL to the SonarQube server +# SONAR_TOKEN: API token for SonarQube + + +stages: + - Test + - Security + - QA + + +PHP Lint: + stage: Test + image: its-registry.unl.edu/unl-its/docker-ci/php-lint:7.3 + tags: + - docker + script: + - php-lint -d . -e .php -e .phtml + +Dependency Check: + stage: Security + image: its-registry.unl.edu/unl-its/docker-ci/dependency-check + tags: + - docker + cache: + policy: push + paths: + - dep_check + script: + - dependency-check -noupdate -f JSON -f XML -f HTML -s . -o ./dep_check --project "$CI_PROJECT_TITLE" --enableExperimental + +SonarQube: + stage: QA + image: its-registry.unl.edu/unl-its/docker-ci/static-code-analysis:php + tags: + - docker + only: + - master + cache: + policy: pull + paths: + - dep_check + script: + - sonar-scanner -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN + -Dsonar.projectKey=$CI_PROJECT_PATH_SLUG -Dsonar.projectName="$CI_PROJECT_TITLE" + -Dsonar.sources=. + -Dsonar.dependencyCheck.reportPath=./dep_check/dependency-check-report.xml + -Dsonar.dependencyCheck.jsonReportPath=./dep_check/dependency-check-report.json + -Dsonar.dependencyCheck.htmlReportPath=./dep_check/dependency-check-report.html