Select Git revision
-
Jose Raul Barreras authoredJose Raul Barreras authored
PHP examples of .gitlab-ci.yml
Standard PHP app with lint and SonarQube analysis
- One 'test' stage with two jobs.
- The jobs needs a runner with docker-host capabilities.
- The job SonarQube is executed only in the branch
develop
.
# 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
variables:
GITLAB_CI: 1
stages:
- test
PHP Lint:
stage: test
image: its-registry.unl.edu/unl-its/docker-ci/php-lint:7.0
tags:
- docker
script:
- php-lint -d ./
SonarQube:
stage: test
image: its-registry.unl.edu/unl-its/docker-ci/static-code-analysis:php
tags:
- docker
only:
- develop
script:
- sonar-scanner -Dsonar.host.url=$SONAR_URL -Dsonar.projectKey=$CI_PROJECT_PATH_SLUG -Dsonar.sources=. -Dsonar.login=$SONAR_TOKEN