-
Notifications
You must be signed in to change notification settings - Fork 18
373 lines (341 loc) · 13 KB
/
development.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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
name: Development
on: [ push, pull_request ]
env:
PACKAGE_NAME: 'oxid-solution-catalysts/paypal-module'
CLIENT_PACKAGE_NAME: 'oxid-solution-catalysts/paypal-client'
CLIENT_REPO_NAME: 'https://github.com/OXID-eSales/paypal-client.git'
MODULE_PATH: 'osc/paypal'
SONARCLOUD_ORGANIZATION: 'oxid-esales'
SONARCLOUD_PROJECT_KEY: 'OXID-eSales_module-paypal_checkout'
PHP_VERSION: '8.0'
MYSQL_VERSION: '5.7'
TEMPLATE_ENGINE: 'twig'
jobs:
install_shop_with_module:
runs-on: ubuntu-latest
steps:
- name: Print run parameters
run: |
echo "Running job with:\
PHP version: ${{ env.PHP_VERSION }}\
MySQL version: ${{ env.MYSQL_VERSION }}\
Template engine: ${{ env.TEMPLATE_ENGINE }}\
Trigger event: ${{ github.event_name }}"
- name: Cleanup workspace
run: |
ls -la ./
sudo rm -rf ./* || true
sudo rm -rf ./.??* || true
ls -la ./
- name: Clone testing environment
run: git clone https://github.com/OXID-eSales/docker-eshop-sdk.git .
- name: Clone the shop
run: git clone --depth 1 https://github.com/OXID-eSales/oxideshop_ce.git --branch b-7.0.x --single-branch source
- name: Cache current installation
uses: actions/cache@v4.1.1
with:
path: |
./*
key: installation-${{ env.PHP_VERSION }}-${{ env.MYSQL_VERSION }}-${{ env.TEMPLATE_ENGINE }}-${{ github.run_number }}-${{ github.run_attempt }}
- name: Prepare container configuration
run: |
make setup
make addbasicservices
make file=services/selenium-chrome.yml addservice
perl -pi\
-e 's#PHP_VERSION=.*#PHP_VERSION=${{ env.PHP_VERSION }}#g;'\
-e "s#MYSQL_VERSION=.*#MYSQL_VERSION=${{ env.MYSQL_VERSION }}#g;"\
.env
perl -pi\
-e 's#display_errors =.*#display_errors = false#g;'\
-e 's#error_reporting = .*#error_reporting = E_ALL ^ E_WARNING ^ E_DEPRECATED#g;'\
-e 'print "xdebug.max_nesting_level=1000\nxdebug.mode=coverage\n\n"'\
containers/php/custom.ini
perl -pi\
-e 's#/var/www/#/var/www/source/#g;'\
containers/httpd/project.conf
- name: Prepare shop configuration
run: |
cp source/source/config.inc.php.dist source/source/config.inc.php
sed -i "1s+^+SetEnvIf Authorization "\(.*\)" HTTP_AUTHORIZATION=\$1\n\n+" source/source/.htaccess
sed -i -e 's/<dbHost>/mysql/'\
-e 's/<dbUser>/root/'\
-e 's/<dbName>/example/'\
-e 's/<dbPwd>/root/'\
-e 's/<dbPort>/3306/'\
-e 's/<sShopURL>/http:\/\/localhost.local\//'\
-e 's/<sShopDir>/\/var\/www\/source\//'\
-e 's/<sCompileDir>/\/var\/www\/source\/tmp\//'\
source/source/config.inc.php
- name: Start containers
run: |
make up
sleep 2
- name: Checkout current module
uses: actions/checkout@v3
with:
path: source/test-module
- name: Install module
run: |
docker compose exec -T \
php composer config repositories.${{ env.PACKAGE_NAME }} \
--json '{"type":"path", "url":"./test-module", "options": {"symlink": true}}'
docker compose exec -T \
php composer require ${{ env.PACKAGE_NAME }}:* --no-interaction --no-update
- name: Install demodata
run: |
docker compose exec -T \
php composer config repositories.oxid-esales/oxideshop-demodata-ce \
--json '{"type":"git", "url":"https://github.com/OXID-eSales/oxideshop_demodata_ce"}'
docker compose exec -T php composer require oxid-esales/oxideshop-demodata-ce:dev-master --no-update
- name: Install dependencies and reset shop
run: |
docker compose exec -T php composer update --no-interaction
docker compose exec -T php bin/oe-console oe:database:reset \
--db-host=mysql --db-port=3306 --db-name=example --db-user=root --db-password=root --force
docker compose exec -T php bin/oe-console oe:module:activate osc_paypal
- name: Put module settings
continue-on-error: true
run: |
mkdir -p source/var/configuration/environment/shops/1/modules
echo "${{ secrets.MODULE_SETTINGS_OXID7 }}" > source/var/configuration/environment/shops/1/modules/osc_paypal.yaml
echo "${{ secrets.MODULE_ENV }}" > source/vendor/${{ env.PACKAGE_NAME }}/tests/.env
docker compose exec -T php php bin/oe-console oe:module:activate osc_paypal
- name: Show docker log
if: always()
run: |
docker compose logs
- name: Stop containers
if: always()
run: |
docker compose down
sleep 2
- name: Upload configuration artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: Configs-${{ env.PHP_VERSION }}-${{ env.MYSQL_VERSION }}-${{ env.TEMPLATE_ENGINE }}
path: |
docker-compose.yml
source/composer.json
source/composer.lock
source/config.inc.php
source/var/configuration/shops/1/modules/osc-unzer.yaml
data/php/logs/error_log.txt
styles:
strategy:
matrix:
php: [ '8.0' ]
runs-on: ubuntu-latest
steps:
- name: Checkout current module
uses: actions/checkout@v4
with:
path: source/test-module
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
extensions: gd, zip
- name: Install module dependencies
id: dependencies
working-directory: source/test-module
run: composer install
- name: Run phpcs
id: phpcs
if: always()
working-directory: source/test-module
run: composer phpcs
- name: Run phpstan
id: phpstan
if: always()
working-directory: source/test-module
run: composer phpstan-report || composer phpstan
# to many errors currently
# - name: Run phpmd
# id: phpmd
# if: always()
# working-directory: source/test-module
# run: composer phpmd-report || composer phpmd
- name: Upload log artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: StylesLog-${{ matrix.php }}
path: |
source/test-module/tests/reports/phpstan.report.json
source/test-module/tests/reports/phpmd.report.json
unit_tests:
strategy:
fail-fast: false
matrix:
php: [ '8.0', '8.1' ]
needs: [ install_shop_with_module ]
runs-on: ubuntu-latest
steps:
- name: Load current installation from cache
uses: actions/cache@v4.1.1
with:
path: |
./*
key: installation-${{ env.PHP_VERSION }}-${{ env.MYSQL_VERSION }}-${{ env.TEMPLATE_ENGINE }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
installation-${{ env.PHP_VERSION }}-${{ env.MYSQL_VERSION }}-${{ env.TEMPLATE_ENGINE }}-${{ github.run_number }}-${{ github.run_attempt }}
- name: Start containers
run: |
make up
sleep 2
- name: Run tests
run: |
pwd \
docker exec -T \
php vendor/bin/phpunit -c /home/runner/work/paypal-module/paypal-module/source/test-module/tests/phpunit.xml --testsuite RunningTests
- name: Upload log artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: TestsLog-${{ matrix.php }}
path: |
source/coverage.xml
source/phpunit.xml
cypress_tests:
needs: [install_shop_with_module]
runs-on: ubuntu-latest
steps:
- name: Load current installation from cache
uses: actions/cache@v4.1.1
with:
path: |
./*
key: installation-${{ env.PHP_VERSION }}-${{ env.MYSQL_VERSION }}-${{ env.TEMPLATE_ENGINE }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
installation-${{ env.PHP_VERSION }}-${{ env.MYSQL_VERSION }}-${{ env.TEMPLATE_ENGINE }}-${{ github.run_number }}-${{ github.run_attempt }}
- name: Start containers
run: |
make up
sleep 2
- name: Debug containers
run: docker ps -a
- name: install npm
run: |
docker compose exec php sudo apt update && DEBIAN_FRONTEND=noninteractive sudo apt -y install npm
- name: install cypress dependencies
run: |
docker compose exec php cd /var/www/source/vendor/oxid-solution-catalysts/paypal-module/tests/CypressTests && npm install
- name: Cypress run
run: |
docker compose exec php cd /var/www/source/vendor/oxid-solution-catalysts/paypal-module/tests/CypressTests && npx cypress run
env:
CYPRESS_TESTS_SHOP_DOMAIN: "localhost.local"
CYPRESS_TESTS_SHOP_USER_NAME: "test@shop.de"
CYPRESS_TESTS_SHOP_USER_PASSWORD: "oxidoxid"
CYPRESS_TESTS_SHOP_USER_FIRST_NAME: "Test"
CYPRESS_TESTS_SHOP_USER_LAST_NAME: "Shoper"
CYPRESS_TESTS_SHOP_USER_STREET: "Teststreet"
CYPRESS_TESTS_SHOP_USER_STREET_NUMBER: "1"
CYPRESS_TESTS_SHOP_USER_ZIP: "12345"
CYPRESS_TESTS_SHOP_USER_LOCATION: "Testcity"
# codeception_tests:
# strategy:
# fail-fast: false
# matrix:
# php: [ '7.4', '8.0', '8.1' ]
# group:
# - 'oe_moduletemplate'
# needs: [ install_shop_with_module ]
# runs-on: ubuntu-latest
# steps:
# - name: Load current installation from cache
# uses: actions/cache@v4.1.1
# with:
# path: |
# ./*
# key: moduleDevelopmentInstallation-${{ matrix.php }}-${{ github.sha }}
# restore-keys: |
# moduleDevelopmentInstallation-${{ matrix.php }}-${{ github.sha }}
#
# - name: Start containers
# run: |
# make up
# sleep 2
#
# - name: Install codeception dependencies
# run: |
# docker compose exec -T php composer require codeception/module-rest:^1.4.2 --dev --no-update
# docker compose exec -T php composer require codeception/module-phpbrowser:^1.0.2 --dev --no-update
# docker compose exec -T php composer update
#
# - name: Run tests
# run: |
# docker compose exec -T \
# -e PARTIAL_MODULE_PATHS=${{ env.MODULE_PATH }} \
# -e ACTIVATE_ALL_MODULES=1 \
# -e RUN_TESTS_FOR_SHOP=0 \
# -e RUN_TESTS_FOR_MODULES=0 \
# -e ADDITIONAL_TEST_PATHS='/var/www/vendor/${{ env.PACKAGE_NAME }}/tests' \
# php php vendor/bin/runtests-codeception
#
# - name: Stop containers
# if: always()
# run: |
# docker compose down
# sleep 2
# - name: Upload log artifact
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: CodeceptionTestsLog-${{ matrix.php }}
# path: |
# source/vendor/${{ env.PACKAGE_NAME }}/tests/Codeception/_output/
# source/source/log/oxideshop.log
# source/data/php/logs/error_log.txt
# sonarcloud:
# needs: [ styles, unit_tests ]
# if: always()
# runs-on: ubuntu-latest
# steps:
# - name: Checkout current module
# uses: actions/checkout@v4
#
# - name: Download phpunit artifacts
# continue-on-error: true
# uses: actions/download-artifact@v4
# with:
# name: TestsLog-7.4
# path: ./tests/
#
# - name: Fix paths in unit logs
# continue-on-error: true
# run: |
# sed -i 's+/var/www/test-module/++' tests/coverage.xml
# sed -i 's+/var/www/test-module/++' tests/phpunit.xml
#
# - name: Download styles artifacts
# uses: actions/download-artifact@v4
# with:
# name: StylesLog-8.0
# path: ./styles/
#
# - name: Fix paths in styles logs
# continue-on-error: true
# run: |
# sed -i 's+\/home\/runner\/work\/.*?\/.*?\/source\/test-module\/++' styles/phpstan.report.json
#
# - name: SonarCloud Scan
# uses: sonarsource/sonarcloud-github-action@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# with:
# args: >
# -Dsonar.organization=${{ env.SONARCLOUD_ORGANIZATION }}
# -Dsonar.projectKey=${{ env.SONARCLOUD_PROJECT_KEY }}
# -Dsonar.sources=src
# -Dsonar.tests=tests
# -Dsonar.sourceEncoding=UTF-8
# -Dsonar.php.coverage.reportPaths=tests/coverage.xml
# -Dsonar.php.phpstan.reportPaths=styles/phpstan.report.json
# -Dsonar.php.phpmd.reportPaths=styles/phpmd.report.json
# -Dsonar.cpd.php.minimumTokens=25
# -Dsonar.cpd.php.minimumLines=5