-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
240 lines (219 loc) · 7.79 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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
cache:
key: "$CI_JOB_STAGE-$CI_COMMIT_REF_NAME"
paths:
- .composer/
- .php_cs.cache
variables:
COMPOSER_CACHE_DIR: ".composer"
TYPO3_PATH_WEB: "$CI_PROJECT_DIR/.build/public"
MYSQL_DATABASE: "typo3"
MYSQL_ROOT_PASSWORD: "joh316"
typo3DatabaseName: "typo3"
typo3DatabaseHost: "mysql"
typo3DatabaseUsername: "root"
typo3DatabasePassword: "joh316"
before_script:
- apk add git --update
stages:
- lint
- test
- documentation
- analysis
lint:cgl:
image: $CI_REGISTRY/containers/phpunit-with-php-8.1:main
stage: lint
before_script:
- sed -i -e "s#ssh://git@code.extco.de:22722#https://gitlab-ci-token:$CI_JOB_TOKEN@code.extco.de#g" composer.json
- composer config platform.php 8.1
- composer remove typo3/cms-core --no-update
- composer install --no-progress --no-ansi --no-interaction
script:
- vendor/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --using-cache=no --path-mode=intersection ./
lint:typoscriptcgl:
image: php:8.1-alpine
stage: lint
before_script:
- apk add --no-cache bash curl git mercurial openssh openssl parallel subversion tini zlib-dev libzip-dev zip icu-dev g++
- docker-php-ext-install mysqli && docker-php-ext-install zip && docker-php-ext-configure intl && docker-php-ext-install intl && docker-php-ext-enable intl
- wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php -r "if (hash_file('SHA384', 'composer-setup.php') === trim(file_get_contents('installer.sig'))) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
- php composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer
- php -r "unlink('composer-setup.php'); unlink('installer.sig');"
- sed -i -e "s#ssh://git@code.extco.de:22722#https://gitlab-ci-token:$CI_JOB_TOKEN@code.extco.de#g" composer.json
- composer config platform.php 8.1
- composer remove typo3/cms-core --no-update
- composer install --no-progress --no-ansi --no-interaction
script:
- vendor/bin/typoscript-lint -c Build/typoscriptlint.yaml Configuration
lint:yaml:
stage: lint
image: python:alpine3.7
before_script:
- pip install yamllint==1.10.0
script:
- yamllint -c Build/yamllint.yaml Configuration/ Resources/
lint:php81:
stage: lint
image: php:8.1-alpine
script:
- find . -name \*.php -exec php -l "{}" \;
lint:php82:
stage: lint
image: php:8.2-alpine
script:
- find . -name \*.php -exec php -l "{}" \;
lint:php83:
stage: lint
image: php:8.3-alpine
script:
- find . -name \*.php -exec php -l "{}" \;
phpstan:analyse:
image: $CI_REGISTRY/containers/phpunit-with-php-8.1:main
stage: lint
before_script:
- sed -i -e "s#ssh://git@code.extco.de:22722#https://gitlab-ci-token:$CI_JOB_TOKEN@code.extco.de#g" composer.json
- composer config platform.php 8.1
- composer install --no-progress --no-ansi --no-interaction
script:
- vendor/bin/phpstan analyse -c Build/phpstan.neon --memory-limit 256M
.test_php: &test_php
stage: test
services:
- mysql:5
image: $CONTAINER_IMAGE
only:
- branches
before_script:
- composer config --no-plugins allow-plugins.typo3/cms-composer-installers true
- composer config --no-plugins allow-plugins.typo3/class-alias-loader true
- composer require typo3/cms-core="${TYPO3_VERSION}"
script:
- >
if [[ "$COVERAGE" == "0" ]]; then
vendor/bin/phpunit -c Build/UnitTests.xml
fi
- >
if [[ "$COVERAGE" == "1" ]]; then
XDEBUG_MODE=coverage TYPO3_PATH_WEB=${TYPO3_PATH_WEB} vendor/bin/phpunit --coverage-clover=phpunit.coverage.xml --log-junit=phpunit.report.xml -c Build/UnitTests.xml Tests/Unit
fi
- typo3DatabaseDriver=pdo_sqlite vendor/bin/phpunit -c Build/FunctionalTests.xml
artifacts:
paths:
- phpunit.coverage.xml
- phpunit.report.xml
expire_in: 1 day
when: always
# Build in PHP 8.1 and TYPO3 12.4
test:php81:typo3_12:
<<: *test_php
variables:
CONTAINER_IMAGE: $CI_REGISTRY/containers/phpunit-with-php-8.1:main
TYPO3_VERSION: ^12.4
COVERAGE: 0
# Build in PHP 8.2 and TYPO3 12.4
test:php82:typo3_12:
<<: *test_php
variables:
CONTAINER_IMAGE: $CI_REGISTRY/containers/phpunit-with-php-8.2:main
TYPO3_VERSION: ^12.4
COVERAGE: 0
# Build in PHP 8.3 and TYPO3 12.4
test:php83:typo3_12:
<<: *test_php
variables:
CONTAINER_IMAGE: $CI_REGISTRY/containers/phpunit-with-php-8.3:main
TYPO3_VERSION: ^12.4
COVERAGE: 1
.test_codeception: &test_codeception
stage: test
image: $CONTAINER_IMAGE
only:
- branches
before_script:
- sed -i -e "s#ssh://git@code.extco.de:22722#https://gitlab-ci-token:$CI_JOB_TOKEN@code.extco.de#g" composer.json
- composer config --no-plugins allow-plugins.typo3/cms-composer-installers true
- composer config --no-plugins allow-plugins.typo3/class-alias-loader true
- composer require typo3/cms-core="${TYPO3_VERSION}"
script:
- mkdir -p .build/public/typo3temp/var/tests/acceptance-sqlite-dbs
- export typo3DatabaseDriver=pdo_sqlite
- export PROJECT_ROOT="$(pwd)"
- export INSTANCE_PATH="$(pwd)/.build/web/typo3temp/var/tests/acceptance"
- mkdir -p "$INSTANCE_PATH"
- mkdir -p "$PROJECT_ROOT/.build/web/typo3temp/var/tests/acceptance-logs/"
- vendor/bin/codecept run
artifacts:
paths:
- .build
expire_in: 1 day
when: always
# Build in PHP 8.1 and TYPO3 12.4
test:codception:php81:typo3_12:
<<: *test_codeception
variables:
CONTAINER_IMAGE: $CI_REGISTRY/containers/codeception-with-php-8.1:main
TYPO3_VERSION: ^12.4
GECKODRIVER_VERSION: v0.34.0
# Build in PHP 8.2 and TYPO3 12.4
test:codception:php82:typo3_12:
<<: *test_codeception
needs:
- test:codception:php81:typo3_12
variables:
CONTAINER_IMAGE: $CI_REGISTRY/containers/codeception-with-php-8.2:main
TYPO3_VERSION: ^12.4
GECKODRIVER_VERSION: v0.34.0
# Build in PHP 8.3 and TYPO3 12.4
test:codception:php83:typo3_12:
<<: *test_codeception
needs:
- test:codception:php82:typo3_12
variables:
CONTAINER_IMAGE: $CI_REGISTRY/containers/codeception-with-php-8.3:main
TYPO3_VERSION: ^12.4
GECKODRIVER_VERSION: v0.34.0
documentation:
stage: documentation
image:
name: t3docs/render-documentation:v2.4.0
entrypoint: [""]
before_script:
- cp -a ${CI_PROJECT_DIR}/. /PROJECT
- mkdir -p ${CI_PROJECT_DIR}/Documentation-GENERATED-temp
script:
- cd /ALL/venv
- /ALL/Menu/mainmenu.sh makehtml-no-cache -c resultdir ${CI_PROJECT_DIR}/Documentation-GENERATED-temp
artifacts:
paths:
- ${CI_PROJECT_DIR}/Documentation-GENERATED-temp/Result/project/0.0.0
expire_in: 1 day
when: always
sonarqube:
stage: analysis
image: ciricihq/gitlab-sonar-scanner
variables:
SONAR_URL: "https://sonar.extco.de"
SONAR_PROJECT_NAME: "$CI_PROJECT_NAME"
SONAR_TOKEN: "$SONAR_TOKEN"
SONAR_PROJECT_VERSION: "$CI_JOB_ID"
SONAR_ANALYSIS_MODE: "issues"
SONAR_SOURCES: "./Classes"
SONAR_GITLAB_PROJECT_ID: "$CI_PROJECT_ID"
script:
- echo "sonar.projectKey=cart-books-5.x" > sonar-project.properties
- gitlab-sonar-scanner -Dsonar.php.coverage.reportPath=phpunit.coverage.xml -Dsonar.php.tests.reportPath=phpunit.report.xml
allow_failure: true
sonarqube-reports:
stage: analysis
image: ciricihq/gitlab-sonar-scanner
variables:
SONAR_URL: "https://sonar.extco.de"
SONAR_PROJECT_NAME: "$CI_PROJECT_NAME"
SONAR_TOKEN: "$SONAR_TOKEN"
SONAR_PROJECT_VERSION: "$CI_JOB_ID"
SONAR_ANALYSIS_MODE: "publish"
SONAR_SOURCES: "./Classes"
script:
- echo "sonar.projectKey=cart-books-5.x" > sonar-project.properties
- gitlab-sonar-scanner -Dsonar.php.coverage.reportPath=phpunit.coverage.xml -Dsonar.php.tests.reportPath=phpunit.report.xml