forked from extcode/cart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
158 lines (146 loc) · 5.13 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
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/Web"
MYSQL_DATABASE: "typo3"
MYSQL_ROOT_PASSWORD: "joh316"
typo3DatabaseName: "typo3"
typo3DatabaseHost: "mysql"
typo3DatabaseUsername: "root"
typo3DatabasePassword: "joh316"
before_script:
- apk add git --update
stages:
- lint
- test
- analysis
- upload
lint:cgl:
image: composer:1.6
stage: lint
before_script:
- composer remove typo3/cms-core --no-update
- composer install --no-progress --no-ansi --no-interaction
script:
- .Build/bin/php-cs-fixer fix --config=Build/.php_cs.dist -v --dry-run --using-cache=no --path-mode=intersection ./
lint:typoscriptcgl:
stage: lint
image: composer:1.6
script:
- composer remove typo3/cms-core --no-update
- composer install --no-progress --no-ansi --no-interaction
- .Build/bin/typoscript-lint -c tslint.yaml
lint:yaml:
stage: lint
image: python:alpine3.7
before_script:
- pip install yamllint==1.10.0
script:
- yamllint -c Build/yamllint.yaml Configuration/ Resources/ .travis.yml
lint:php72:
stage: lint
image: php:7.2-alpine
script:
- find . -name \*.php -exec php -l "{}" \;
.test: &test_php
stage: test
services:
- mysql:5
image: php:$DOCKER_TAG
only:
- branches
before_script:
- apk add --no-cache bash curl git mercurial openssh openssl parallel subversion tini
- >
if [[ "$COVERAGE" == "1" ]]; then
apk add --no-cache $PHPIZE_DEPS
pecl install xdebug && docker-php-ext-enable xdebug
fi
- docker-php-ext-install mysqli
- 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');"
- composer require typo3/cms-core="${TYPO3_VERSION}"
script:
- >
if [[ "$COVERAGE" == "0" ]]; then
.Build/bin/phpunit -c Build/UnitTests.xml Tests/Unit
fi
- >
if [[ "$COVERAGE" == "1" ]]; then
.Build/bin/phpunit --coverage-clover=phpunit.coverage.xml --log-junit=phpunit.report.xml -c Build/UnitTests.xml Tests/Unit
fi
# - find 'Tests/Functional' -wholename '*Test.php' | parallel --gnu 'echo; echo "Running functional test suite {}"; .Build/bin/phpunit --colors -c .Build/vendor/nimut/testing-framework/res/Configuration/FunctionalTests.xml {}'
artifacts:
paths:
- phpunit.coverage.xml
- phpunit.report.xml
expire_in: 1 day
when: always
# Build in PHP 7.2 and TYPO3 9.2
test:php72:typo3_9:
<<: *test_php
variables:
DOCKER_TAG: 7.2-alpine
TYPO3_VERSION: ^9.3
COVERAGE: 1
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-6.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"
SONAR_TESTS: "./Tests"
script:
- echo "sonar.projectKey=cart-6.x" > sonar-project.properties
- gitlab-sonar-scanner -Dsonar.php.coverage.reportPath=phpunit.coverage.xml -Dsonar.php.tests.reportPath=phpunit.report.xml
ter-upload:
image: php:7.1-alpine
stage: upload
only:
- tags
when: manual
before_script:
- apk --no-cache add git zlib-dev libxml2-dev
- docker-php-ext-install mbstring zip soap
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- export COMPOSER_CACHE_DIR=.composer
script:
- composer install --no-progress --no-ansi --no-interaction
- composer require namelesscoder/typo3-repository-client
- export TYPO3_PATH_WEB="$PWD/.Build/Web"
- >
if [ -n "$CI_COMMIT_TAG" ] && [ -n "$T3O_USERNAME" ] && [ -n "$T3O_PASSWORD" ]; 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"
.Build/bin/upload . "$T3O_USERNAME" "$T3O_PASSWORD" "$TAG_MESSAGE"
fi;