-
Notifications
You must be signed in to change notification settings - Fork 27
/
.gitlab-ci.yml
199 lines (188 loc) · 6.63 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
variables:
PLUGIN_NAME: SwagMigrationAssistant
PLATFORM_MIN_VERSION: 'v6.6.1.0'
PLATFORM_DEFAULT_VERSION: 'trunk'
PLATFORM_BRANCH: $PLATFORM_DEFAULT_VERSION
DEV_IMAGE:
value: ${CI_REGISTRY}/infrastructure/docker-base/ci-build:latest
NODE_VERSION: 20
include:
- project: 'shopware/6/product/platform'
ref: 'trunk'
file: '.gitlab/templates/plugin.yml'
- component: gitlab.shopware.com/infrastructure/ci-component-library/kaniko-amd64@trunk
inputs:
job-suffix: ""
stage: E2E
destination-image: "${CI_REGISTRY_IMAGE}/ci-e2e"
destination-tag: "${PLATFORM_BRANCH}-${CI_PIPELINE_ID}"
dockerfile: .gitlab/Dockerfile
enable-scan: "false"
cache: "false"
build-arg: "BASE_IMAGE=$PLATFORM_BASE_IMAGE"
extra-args: "--build-arg CI_JOB_TOKEN=$CI_JOB_TOKEN"
Danger:
stage: test
image:
name: ghcr.io/shyim/danger-php:latest
entrypoint: [ "" ]
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
before_script: [ ]
script:
- danger ci
ecs:
stage: test
script:
- composer ecs
Eslint (administration):
stage: test
variables:
APP_ENV: prod
ADMIN_PATH: $CI_PROJECT_DIR/src/Administration/Resources/app/administration
STOREFRONT_PATH: $CI_PROJECT_DIR/src/Storefront/Resources/app/storefront
script:
- '(cd $ADMIN_PATH && npm ci)'
- $CI_PROJECT_DIR/bin/console framework:schema -s 'entity-schema' $ADMIN_PATH/test/_mocks_/entity-schema.json
- npm --prefix $ADMIN_PATH run unit-setup
- composer admin:install
- composer admin:lint
jest (administration):
rules:
# exists does not support variables, so we cannot use ${PLUGIN_SOURCE_DIR} here
- exists:
- tests/Jest/jest.config.js
variables:
APP_ENV: prod
ADMIN_PATH: $CI_PROJECT_DIR/src/Administration/Resources/app/administration
STOREFRONT_PATH: $CI_PROJECT_DIR/src/Storefront/Resources/app/storefront
script:
- '(cd $ADMIN_PATH && npm ci)'
- $CI_PROJECT_DIR/bin/console framework:schema -s 'entity-schema' $ADMIN_PATH/test/_mocks_/entity-schema.json
- npm --prefix $ADMIN_PATH run unit-setup
- composer admin:install
- composer admin:unit -- --ci
coverage: '/^\s?All files[^|]*\|[^|]*\s+([\d\.]+)/'
artifacts:
paths:
# allow inspection of the coverage report, otherwise it's not accessible
- custom/plugins/SwagMigrationAssistant/coverage/cobertura-coverage.xml
reports:
junit:
- custom/plugins/SwagMigrationAssistant/coverage/junit.xml
coverage_report:
coverage_format: cobertura
path: custom/plugins/SwagMigrationAssistant/coverage/cobertura-coverage.xml
phpunit:
script:
- apt-get update && apt-get --assume-yes install default-mysql-client
- cd tests
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.shopware.com/shopware/6/services/testdata.git testData
- cd -
- mysql -uroot -p"$MYSQL_ROOT_PASSWORD" --host mysql < tests/testData/Migration/sw55.sql
- php
-d pcov.enabled=1 -d pcov.directory=$PWD -d pcov.exclude='~(vendor|tests|node_modules)~'
${PROJECT_ROOT}/vendor/bin/phpunit
--configuration phpunit.xml.dist
--log-junit ${CI_PROJECT_DIR}/phpunit.junit.xml
--colors=never
--coverage-cobertura ${CI_PROJECT_DIR}/cobertura.xml
--coverage-text #| grep -v -E '^Shopware\\|^ Methods:' # do not output covered files lines
parallel:
matrix:
- PLATFORM_BRANCH: [ $PLATFORM_MIN_VERSION, $PLATFORM_DEFAULT_VERSION ]
phpstan:
script:
- composer dump-autoload --dev
- composer phpstan
smoke-test:
stage: test
needs: []
rules:
- !reference [.rules, skip]
- when: always
script:
- cd ../../..
- php bin/console plugin:refresh
- php bin/console plugin:install --activate --clearCache ${PLUGIN_NAME}
- php bin/console plugin:uninstall ${PLUGIN_NAME}
build image:
variables:
PLATFORM_BASE_IMAGE: ${CI_REGISTRY}/shopware/6/product/platform/ci-e2e:${PLATFORM_BRANCH}
rules:
# not supported, the downstream pipeline should find any issues anyway
- if: "$CI_MERGE_REQUEST_LABELS =~ /.*branch::platform::match.*/"
when: never
- if: "$PARENT_PIPELINE_ID"
when: never
- when: always
needs: []
parallel:
matrix:
- PLATFORM_BRANCH: [ $PLATFORM_MIN_VERSION, $PLATFORM_DEFAULT_VERSION ]
build image downstream:
extends: build image
rules:
- if: "$PARENT_PIPELINE_ID"
needs:
- pipeline: $PARENT_PIPELINE_ID
job: build image
artifacts: false
acceptance:
image: mcr.microsoft.com/playwright:v1.44.0-jammy
stage: E2E
needs:
- job: build image
optional: true
- job: build image downstream
optional: true
rules:
# not supported, the downstream pipeline should find any issues anyway
- if: "$CI_MERGE_REQUEST_LABELS =~ /.*branch::platform::match.*/"
when: never
- when: always
services:
- name: mysql:8.3
alias: database
entrypoint:
[
"sh",
"-c",
"docker-entrypoint.sh mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --default-authentication-plugin=mysql_native_password --sql-require-primary-key=ON",
]
- name: redis:7.0
alias: redis
- name: "${CI_REGISTRY_IMAGE}/ci-e2e:${PLATFORM_BRANCH}-${CI_PIPELINE_ID}"
alias: shopware.test
variables:
DATABASE_URL: mysql://root:app@database:3306/root
parallel:
matrix:
- PLATFORM_BRANCH: [ $PLATFORM_MIN_VERSION, $PLATFORM_DEFAULT_VERSION ]
variables:
# CI_DEBUG_SERVICES: "true" # This can be used to display the output of all service containers for debugging
APP_ENV: prod
SHOPWARE_HTTP_CACHE_ENABLED: 0
SHOPWARE_DISABLE_UPDATE_CHECK: "true"
PROJECT_ROOT: /var/www/html
MYSQL_ROOT_PASSWORD: app
DATABASE_URL: mysql://root:app@database:3306/root
APP_URL: http://shopware.test:8000
APP_DEBUG: 1
before_script:
- cd tests/acceptance
- npm ci
script:
- npx playwright test --workers=1
after_script:
- |
echo "Link to HTML report"
echo "-------------------------------------------------------------------------------------------------------------------------------------------------------"
echo "https://shopware.pages.apps.shopware.io/-/6/services/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/tests/acceptance/playwright-report/index.html"
echo "-------------------------------------------------------------------------------------------------------------------------------------------------------"
artifacts:
expire_in: 1 day
when: always
paths:
- $CI_PROJECT_DIR/tests/acceptance/test-results/*
- $CI_PROJECT_DIR/tests/acceptance/playwright-report/*