From 28bd720de1289576b906e37f00f35a2859a94762 Mon Sep 17 00:00:00 2001
From: Jeff Sturek <jsturek8@unl.edu>
Date: Fri, 19 Nov 2021 13:33:11 -0600
Subject: [PATCH] Update .gitlab-ci.yml file validate PHP

---
 .gitlab-ci.yml | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000..d6ae90da
--- /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
-- 
GitLab