-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
237 lines (229 loc) · 7.44 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
stages:
- lint
- test
- mirror
- release
lint-php:
stage: lint
image: registry.gitlab.com/codemonkey1988/docker-composer-image:2-php$PHP_VERSION
except:
- master
script:
- find . -name \*.php ! -path "./.Build/*" -exec php -d display_errors=stderr -l {} > /dev/null \;
parallel:
matrix:
- PHP_VERSION: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
codestyle-php:
stage: lint
except:
- master
image: registry.gitlab.com/codemonkey1988/docker-composer-image:2-php8.1
before_script:
- mkdir -p .composer/cache
- COMPOSER_CACHE_DIR=.composer/cache composer install
script:
- composer phpcsfixer
cache:
key: composer-cache
paths:
- .composer/cache
php:phpstan:
stage: lint
except:
- master
image: registry.gitlab.com/codemonkey1988/docker-composer-image:2-php$PHP_VERSION
before_script:
- mkdir -p .composer/cache
# Remove typo3-console because it is not needed here and currently not compatible with v12.
- COMPOSER_CACHE_DIR=.composer/cache composer remove --dev --no-update helhum/typo3-console && rm -f composer.lock
- COMPOSER_CACHE_DIR=.composer/cache composer require typo3/cms-core="$TYPO3_VERSION"
script:
- composer phpstan
cache:
key: composer-cache
paths:
- .composer/cache
parallel:
matrix:
- TYPO3_VERSION: '^12.4'
PHP_VERSION: [ '8.1', '8.2', '8.3' ]
- TYPO3_VERSION: '^13.4'
PHP_VERSION: [ '8.3' ]
unit-tests:
stage: test
except:
- master
image: registry.gitlab.com/codemonkey1988/docker-composer-image:2-php$PHP_VERSION
before_script:
- docker-php-ext-enable xdebug
- echo -e "xdebug.mode=coverage" > /usr/local/etc/php/conf.d/xdebug_coverage.ini
- mkdir -p .composer/cache
# Remove typo3-console because it is not needed here and currently not compatible with v12.
- COMPOSER_CACHE_DIR=.composer/cache composer remove --dev --no-update helhum/typo3-console && rm -f composer.lock
- COMPOSER_CACHE_DIR=.composer/cache composer require typo3/cms-core="$TYPO3_VERSION "
script:
- |
.Build/bin/phpunit \
-c UnitTests.xml \
--colors \
--testdox \
--coverage-html build/reports/coverage-unit-html/ \
--coverage-cobertura build/reports/cobertura-unit.xml \
--coverage-clover build/reports/clover-unit.xml
parallel:
matrix:
- TYPO3_VERSION: '^12.4'
PHP_VERSION: [ '8.1', '8.2', '8.3' ]
- TYPO3_VERSION: '^13.4'
PHP_VERSION: [ '8.3' ]
cache:
key: composer-cache
paths:
- .composer/cache
artifacts:
expire_in: 1 day
paths:
- build/reports/
when: always
reports:
junit: build/reports/phpunit-unit.xml
coverage_report:
coverage_format: cobertura
path: build/reports/cobertura-unit.xml
functional-tests:
stage: test
except:
- master
image: registry.gitlab.com/codemonkey1988/docker-composer-image:2-php$PHP_VERSION
services:
- mysql:8.0
variables:
MYSQL_ROOT_PASSWORD: root
typo3DatabaseHost: mysql
typo3DatabaseUsername: root
typo3DatabasePassword: $MYSQL_ROOT_PASSWORD
typo3DatabaseName: typo3_test
typo3DatabaseDriver: mysqli
before_script:
- docker-php-ext-install mysqli
- docker-php-ext-enable xdebug
- echo -e "xdebug.mode=coverage" > /usr/local/etc/php/conf.d/xdebug_coverage.ini
- mkdir -p .composer/cache
- COMPOSER_CACHE_DIR=.composer/cache composer require typo3/cms-core="$TYPO3_VERSION"
script:
- |
.Build/bin/phpunit \
-c FunctionalTests.xml \
--colors \
--testdox \
--coverage-html build/reports/coverage-functional-html/ \
--coverage-cobertura build/reports/cobertura-functional.xml \
--coverage-clover build/reports/clover-functional.xml
parallel:
matrix:
- TYPO3_VERSION: '^12.4'
PHP_VERSION: [ '8.1', '8.2', '8.3' ]
- TYPO3_VERSION: '^13.4'
PHP_VERSION: [ '8.3' ]
cache:
key: composer-cache
paths:
- .composer/cache
artifacts:
expire_in: 1 day
paths:
- build/reports/
when: always
reports:
junit: build/reports/phpunit-functional.xml
coverage_report:
coverage_format: cobertura
path: build/reports/cobertura-functional.xml
cypress-tests:
stage: test
except:
- master
interruptible: true
resource_group: ddev
variables:
GIT_STRATEGY: clone
GIT_CLONE_PATH: $CI_BUILDS_DIR/responsive-images/packages/responsive-images
CI_PROJECT_ROOT_DIR: $CI_BUILDS_DIR/responsive-images
tags:
- ddev
before_script:
- ddev rm -RO t3ext-responsive-images || true
- cd $CI_PROJECT_ROOT_DIR
- cp $CI_PROJECT_DIR/Tests/Cypress/Fixtures/Composer/$COMPOSER_FILE $CI_PROJECT_ROOT_DIR/composer.json
- |
ddev config \
--auto \
--php-version=$PHP_VERSION \
--database=$DATABASE \
--project-name="t3ext-responsive-images" \
--docroot="public" \
--project-type="typo3" \
--nodejs-version=18 \
--web-environment="TYPO3_DB_DRIVER=mysqli,TYPO3_DB_USERNAME=db,TYPO3_DB_PASSWORD=db,TYPO3_DB_DBNAME=db,TYPO3_DB_HOST=db,TYPO3_DB_PORT=3306,[email protected],TYPO3_SETUP_ADMIN_USERNAME=administrator,TYPO3_SETUP_ADMIN_PASSWORD=P@ssw0rd,TYPO3_INSTALL_SITE_NAME=responsive-images-cypress,TYPO3_SETUP_CREATE_SITE=https://t3ext-responsive-images.ddev.site,TYPO3_SERVER_TYPE=other"
- ddev start -y
- ddev composer update
- ddev typo3 setup --no-interaction --force
- ddev mysql < $CI_PROJECT_DIR/Tests/Cypress/Fixtures/test-data.sql
- source $HOME/.nvm/nvm.sh
- nvm install 18 && nvm use 18
- cd $CI_PROJECT_DIR/build/ && npm ci && npx cypress install
script:
# Restarting ddev again - this needs to be done for some reason.
- cd $CI_PROJECT_ROOT_DIR && ddev start
- cd $CI_PROJECT_DIR/build/ && npx cypress run --headless --e2e --browser chrome
after_script:
- ddev rm -RO t3ext-responsive-images || true
parallel:
matrix:
- TYPO3_VERSION: '^12'
PHP_VERSION: [ '8.2' ]
DATABASE: [ 'mariadb:10.8' ]
COMPOSER_FILE: 'v12.json'
- TYPO3_VERSION: '^13'
PHP_VERSION: [ '8.3' ]
DATABASE: [ 'mariadb:10.11' ]
COMPOSER_FILE: 'v13.json'
artifacts:
expire_in: 1 day
paths:
- build/cypress/screenshots/
- build/reports/
when: always
reports:
junit: build/reports/cypress-integration*.xml
mirror:
stage: mirror
image: registry.gitlab.com/codemonkey1988/docker-composer-image:2-php8.1
only:
- main
- tags
variables:
GIT_STRATEGY: none
script:
- git clone $CI_REPOSITORY_URL -b main repo && cd repo
- git config user.name "$GIT_USER_NAME"
- git config user.email "$GIT_USER_EMAIL"
- git push -f --mirror https://$GITHUB_USERNAME:ghp_$GITHUB_TOKEN@$GITHUB_REPOSITORY
publish:ter:
stage: release
image: composer:2
only:
- tags
before_script:
- composer global require typo3/tailor
script:
- >
if [ -n "$CI_COMMIT_TAG" ] && [ -n "$TYPO3_API_TOKEN" ] && [ -n "$TYPO3_EXTENSION_KEY" ]; then
echo -e "Preparing upload of release ${CI_COMMIT_TAG} to TER\n"
# Cleanup before we upload
git reset --hard HEAD && git clean -fx
# Upload
TAG_MESSAGE=`git tag -n10 -l $CI_COMMIT_TAG | sed 's/^[0-9.]*[ ]*//g'`
echo "Uploading release ${CI_COMMIT_TAG} to TER"
/tmp/vendor/bin/tailor ter:publish --comment "$TAG_MESSAGE" "$CI_COMMIT_TAG" "$TYPO3_EXTENSION_KEY"
fi;