-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
68 lines (66 loc) · 1.66 KB
/
.gitlab-ci.yml
File metadata and controls
68 lines (66 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
stages:
- phpunit
- sonarqube
phpunit:
stage: phpunit
image:
name: php:8.0
before_script:
- apt-get update -yqq
- apt-get install git unzip -yqq
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php composer-setup.php --install-dir=/usr/bin --filename=composer --version=2.0.11
- php -r "unlink('composer-setup.php');"
- pecl install xdebug-3.0.0
- docker-php-ext-enable xdebug
cache:
key: ${CI_JOB_NAME}
paths:
- vendor
variables:
XDEBUG_MODE: "coverage"
script:
- composer install
- |
./vendor/bin/phpunit \
--whitelist src/Domain \
--log-junit build/phpunit.xml \
--coverage-text \
--coverage-clover build/coverage.xml \
--colors=never \
tests
artifacts:
paths:
- build
reports:
junit: build/phpunit.xml
expire_in: 30 min
only:
- merge_requests
- master
sonarqube:
stage: sonarqube
image:
name: sonarsource/sonar-scanner-cli:4.6
entrypoint: [""]
variables:
IP_SONAR_MACHINE: "10.1.1.1"
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
- .scannerwork
script:
- |
sonar-scanner \
-Dsonar.language=php \
-Dsonar.qualitygate.wait=true \
-Dsonar.sources=src/Domain \
-Dsonar.host.url=http://${IP_SONAR_MACHINE}:9000 \
-Dsonar.php.tests.reportPath=build/phpunit.xml \
-Dsonar.php.coverage.reportPaths=build/coverage.xml \
-Dsonar.projectKey=demo-php-code-quality-testing-sonar-gitlab-ci \
-Dsonar.login=69dd65b4abb7fbd11ff3c05b03eef80bfe191743
only:
- merge_requests
- master