-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
226 lines (211 loc) · 6.8 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
image: hub.tollwerk.net/tollwerk/php-ci:7.4
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .npm/
- vendor/
include:
- template: Code-Quality.gitlab-ci.yml
variables:
FF_NETWORK_PER_BUILD: 1
stages:
- prepare
- analyze
- build
# - test
- deploy
composer:
stage: prepare
before_script:
- git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.tollwerk.net/".insteadOf "git@gitlab.tollwerk.net:"
script:
- php -v
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
- cp .env.example .env
- echo "PROJECT_KEY=$PROJECT_KEY" >> .env
- echo "TYPO3_PROJECT_EXTENSION=$TYPO3_PROJECT_EXTENSION" >> .env
artifacts:
paths:
- vendor/
- .env
expire_in: 1 days
when: always
cache:
paths:
- vendor/
lint:
stage: prepare
before_script:
- rm -f package-lock.json
- npm --version
- npm install --cache .npm --prefer-offline eslint eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react-hooks eslint-plugin-react stylelint stylelint-config-standard stylelint-order stylelint-selector-bem-pattern postcss
script:
- npm run lint-js
- npm run lint-css
cache:
paths:
- .npm/
code_quality:
stage: analyze
tags:
- code_quality
artifacts:
paths: [ gl-code-quality-report.json ]
rules:
- if: '$CODE_QUALITY_DISABLED'
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' # Run code quality job in merge request pipelines
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' # Run code quality job in pipelines on the default branch (but not in other branch pipelines)
- if: '$CI_COMMIT_TAG' # Run code quality job in pipelines for tags
needs:
- job: composer
artifacts: true
code_sniffer:
stage: analyze
script:
- ~/.composer/vendor/bin/phpcs --version
- ~/.composer/vendor/bin/phpcs --standard=phpcs.xml --extensions=php public/typo3conf/ext/tw_blueprint
needs:
- job: composer
artifacts: true
copy_paste:
stage: analyze
script:
- ~/.composer/vendor/bin/phpcpd -v
- ~/.composer/vendor/bin/phpcpd public/typo3conf/ext/tw_blueprint/ --min-lines=50
needs:
- job: composer
artifacts: true
mess_detector:
stage: analyze
script:
- ~/.composer/vendor/bin/phpmd --version
- ~/.composer/vendor/bin/phpmd public/typo3conf/ext/tw_blueprint text phpmd.xml
needs:
- job: composer
artifacts: true
build_assets:
stage: build
needs:
- code_sniffer
- copy_paste
- mess_detector
- lint
before_script:
- git --version
- npm --version
- npm ci --cache .npm --prefer-offline
- gulp --version
script:
- gulp build
- gulp css:combine
artifacts:
paths:
- components
- public/typo3conf/ext/tw_blueprint/Resources/Public/
- public/typo3temp/assets/
- public/serviceworker.js
expire_in: 1 days
when: always
#unit_tests:
# stage: test
# services:
# - name: mysql:8.0
# command: [ "--default-authentication-plugin=mysql_native_password" ]
# tags:
# - mysql
# needs:
# - job: composer
# artifacts: true
# - job: build_assets
# artifacts: true
# script:
# - php -v
# - mysql --host="${DB_HOST}" --user="${MYSQL_USER}" --password="${MYSQL_PASSWORD}" "${MYSQL_DATABASE}" < tests/fixture/directus/database/directus-*.sql
# - ./vendor/phpunit/phpunit/phpunit --version
# - php -d short_open_tag=off ./vendor/phpunit/phpunit/phpunit -v --configuration phpunit.xml --coverage-text --colors=never
# artifacts:
# paths:
# - public/assets/
# - storage/logs/
# expire_in: 1 days
# when: on_failure
# coverage: '/^\s*Lines:\s*\d+.\d+\%/'
preview:
stage: deploy
needs:
# - job: unit_tests
# artifacts: false
- job: build_assets
artifacts: true
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$PREVIEW_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- chmod 0755 ./dev/deploy-archive-commit.sh
script:
- >
./dev/deploy-archive-commit.sh --dev --fractal="blueprint" --extension="$TYPO3_PROJECT_EXTENSION"
--repository="ssh://git@gitlab.tollwerk.net/blueprint/blueprint-projekt.git" --branch="$CI_DEFAULT_BRANCH" --commit="$CI_COMMIT_SHA"
--host="$PREVIEW_HOST" --user="$PREVIEW_USER" --port="$PREVIEW_PORT"
--target="$PREVIEW_TARGET_DIRECTORY" --artifacts="fractal.config.js public/typo3conf/ext/tw_blueprint/Resources/Public public/typo3temp/assets"
environment:
name: staging
url: https://preview.blueprint.dev
when: on_success
only:
- develop
#staging:
# stage: deploy
# needs:
## - job: unit_tests
## artifacts: false
# - job: build_assets
# artifacts: true
# before_script:
# - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# - eval $(ssh-agent -s)
# - ssh-add <(echo "$STAGING_PRIVATE_KEY")
# - mkdir -p ~/.ssh
# - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
# - chmod 0755 ./dev/deploy-archive-commit.sh
# script:
# - >
# ./dev/deploy-archive-commit.sh --sync
# --repository="ssh://git@gitlab.tollwerk.net/blueprint/blueprint-projekt.git" --branch="$CI_DEFAULT_BRANCH" --commit="$CI_COMMIT_SHA"
# --host="$STAGING_HOST" --user="$STAGING_USER" --port="$STAGING_PORT"
# --target="$STAGING_TARGET_DIRECTORY" --artifacts="public/typo3conf/ext/tw_blueprint/Resources/Public public/typo3temp/assets public/serviceworker.js"
# environment:
# name: staging
# url: https://stage.blueprint.dev
# when: manual
# only:
# - develop
#production:
# stage: deploy
# needs:
## - job: unit_tests
## artifacts: false
# - job: build_assets
# artifacts: true
# before_script:
# - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# - eval $(ssh-agent -s)
# - ssh-add <(echo "$PRODUCTION_PRIVATE_KEY")
# - mkdir -p ~/.ssh
# - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
# - chmod 0755 ./dev/deploy-archive-commit.sh
# script:
# - >
# ./dev/deploy-archive-commit.sh
# --repository="ssh://git@gitlab.tollwerk.net/blueprint/blueprint-projekt.git" --branch="$CI_DEFAULT_BRANCH" --commit="$CI_COMMIT_SHA"
# --host="$PRODUCTION_HOST" --user="$PRODUCTION_USER" --port="$PRODUCTION_PORT"
# --target="$PRODUCTION_TARGET_DIRECTORY" --artifacts="public/typo3conf/ext/tw_blueprint/Resources/Public public/typo3temp/assets public/serviceworker.js"
# environment:
# name: production
# url: https://blueprint.com
# when: manual
# only:
# - develop