forked from final-gene/zf2-uri-template-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
95 lines (88 loc) · 2.62 KB
/
.gitlab-ci.yml
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# define stages
types:
- test:basis
- test:run
- test:analyse
########################################################################################################################
# test stages
# run composer and load (dev) dependencies
test:composer:
type: test:basis
tags:
- docker
image: finalgene/composer
script:
- composer validate --no-check-all --no-check-publish
- composer install --no-interaction --ignore-platform-reqs
artifacts:
paths:
- vendor/
expire_in: 1 hour
# run unit tests
test:phpunit:5.6:
type: test:run
tags:
- docker
dependencies:
- test:composer
image: finalgene/php-cli:5.6
script:
# lint php files
- find src/ -name '*.php' -print0 | xargs -0 php -l
- find tests/ -name '*.php' -print0 | xargs -0 php -l
# run unit tests
- vendor/bin/phpunit --colors=never
# run unit tests
test:phpunit:7.0:
type: test:run
tags:
- docker
dependencies:
- test:composer
image: finalgene/php-cli:7.0
script:
# lint php files
- find src/ -name '*.php' -print0 | xargs -0 php -l
- find tests/ -name '*.php' -print0 | xargs -0 php -l
# run unit tests
- vendor/bin/phpunit --colors=never
# run unit tests
test:phpunit:7.1:
type: test:run
tags:
- docker
dependencies:
- test:composer
image: finalgene/php-cli:7.1-xdebug
script:
# lint php files
- find src/ -name '*.php' -print0 | xargs -0 php -l
- find tests/ -name '*.php' -print0 | xargs -0 php -l
# run unit tests
- vendor/bin/phpunit --coverage-clover .report/phpunit.coverage.xml --log-junit .report/phpunit.xml --coverage-text --colors=never
artifacts:
paths:
- tests/.report/
expire_in: 1 hour
# run sonar scanner to add comments into gitlab
test:analyze:
type: test:analyse
tags:
- docker
dependencies:
- test:phpunit:7.1
image: finalgene/sonar-scanner:2.8
script:
# use preview mode to send comments to gitlab
- sonar-scanner -Dsonar.analysis.mode=issues -Dsonar.gitlab.project_id=${CI_PROJECT_PATH} -Dsonar.gitlab.commit_sha=${CI_COMMIT_SHA} -Dsonar.gitlab.ref_name=${CI_COMMIT_REF_NAME} -Dsonar.projectKey=${CI_PROJECT_PATH_SLUG}
# run sonar scanner to analyse code
test:sonar:
type: test:analyse
tags:
- docker
dependencies:
- test:phpunit:7.1
image: finalgene/sonar-scanner:2.8
script:
# start scan - use git tag as version
- sonar-scanner -Dsonar.branch=${CI_COMMIT_REF_NAME} -Dsonar.projectVersion=${CI_COMMIT_TAG} -Dsonar.links.homepage=${CI_PROJECT_URL} -Dsonar.links.issue=${CI_PROJECT_URL}/issues -Dsonar.projectKey=${CI_PROJECT_PATH_SLUG} -Dsonar.projectName=${CI_PROJECT_PATH}