-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
148 lines (106 loc) · 2.63 KB
/
.gitlab-ci.yml
File metadata and controls
148 lines (106 loc) · 2.63 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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
stages:
- lint
- test
- functional-test
variables:
ATOUM_COVERAGE_FILENAME: coverage.xml
ATOUM_XUNIT_FILENAME: xunit.xml
DOCKER_REGISTRY: wearestancer
PHP_BUILD_FILENAME: "lib-php-${CI_COMMIT_TAG}.tar.gz"
workflow:
rules:
- if: '$CI_COMMIT_REF_PROTECTED == "true"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
when: never
- when: always
.php::base:
image: ${DOCKER_REGISTRY}/php:$VERSION
before_script:
- php -v
- composer --version
- composer install --no-progress
cache:
key:
files:
- composer.json
paths:
- vendor/
.php::all-versions:
extends:
- .php::base
parallel:
matrix:
- VERSION: ['8.1','8.2','8.3','8.4','8.5']
API_VERSION: ['1','2']
.php::stable-version:
extends:
- .php::base
variables:
VERSION: '8.1'
atoum-UT:
extends:
- .php::all-versions
stage: test
variables:
TEST_ENV: 'UNIT'
rules:
- if: $VERSION == "8.5"
allow_failure: true
- if: $VERSION == "8.4"
allow_failure: true
- when: on_success
script:
- composer run test -- --max-children-number 1
coverage: '/Code coverage value: \d+\.\d+%/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: $ATOUM_COVERAGE_FILENAME
junit: $ATOUM_XUNIT_FILENAME
atoum-functional:
extends:
- .php::all-versions
stage: functional-test
variables:
TEST_ENV: "FUNCTIONAL"
rules:
- if: $API_VERSION == "1"
allow_failure: true
- if: $VERSION == "8.5"
allow_failure: true
- if: $VERSION == "8.4"
allow_failure: true
- when: on_success
script:
- composer run test -- --max-children-number 1
coverage: '/Code coverage value: \d+\.\d+%/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: $ATOUM_COVERAGE_FILENAME
junit: $ATOUM_XUNIT_FILENAME
php-cs-fixer:
extends:
- .php::stable-version
stage: lint
script:
- composer run php-cs-check || true
# We want to check for method chaining indentation but only in source we use a custom rule in test.
- composer run php-cs-check -- --rules=method_chaining_indentation ./src
- composer run php-cs-check -- --format=gitlab > codequality.json
artifacts:
reports:
codequality: codequality.json
phpstan:
extends:
- .php::stable-version
stage: lint
script:
- composer run phpstan || true
- composer run phpstan -- --error-format=gitlab > codequality.json
artifacts:
reports:
codequality: codequality.json