-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (127 loc) · 4.92 KB
/
test.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
name: Test
on:
push:
branches:
- 'main'
- '2.x'
- 'e2e'
jobs:
ci:
runs-on: ubuntu-latest
strategy:
max-parallel: 15
fail-fast: false
matrix:
include:
# versions <= 5.5 use ant build process instead of Makefile
#- shopware-version: 'v5.2.27'
# php-version: '5.6'
#- shopware-version: 'v5.3.7'
# php-version: '7.0'
#- shopware-version: 'v5.4.6'
# php-version: '7.1'
#- shopware-version: 'v5.5.10'
# php-version: '7.2'
- shopware-version: 'v5.7.6'
php-version: '7.4'
# throws: Child process error (exit code 255): PHP Fatal error: Cannot declare
# class ReflectionEnum, because the name is already in use in
# /opt/shopware/vendor/laminas/laminas-code/polyfill/ReflectionEnumPolyfill.php
# on line 8
#- shopware-version: 'v5.7.11'
# php-version: '8.0'
- shopware-version: 'v5.7.13'
php-version: '8.1'
- shopware-version: 'v5.7.17'
php-version: '8.2'
- shopware-version: '5.7'
php-version: '8.3'
name: Shopware ${{ matrix.shopware-version }} @ ${{ matrix.php-version }}
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: shopware
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
env:
PLUGIN_DIR: /opt/shopware/engine/Shopware/Plugins/Local/Frontend/NetzkollektivEasyCredit
SW_DIR: /opt/shopware
steps:
- name: Checkout
uses: actions/checkout@master
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, curl, dom, fileinfo, gd, iconv, intl, json, xml, mbstring, pdo, phar, zip, sodium
tools: composer:2.1.5
coverage: none
- name: Debug
run: |
php -v
php -m
composer -V
env
- name: Initialize
run: |
chmod +x $GITHUB_WORKSPACE/bin/*
$GITHUB_WORKSPACE/bin/setup-shopware ${{ matrix.shopware-version }}
cp $GITHUB_WORKSPACE/etc/router.php $SW_DIR/
# Set API credentials
mysql -h 127.0.0.1 -u root -proot shopware -e "update s_core_auth Set apiKey = 'dVHnNzuVi4wvTcwV36K12D0OFgqvVzTxsRvTmRqC';"
cd $SW_DIR
- name: Link plugin with shopware installation and install composer deps
run: |
composer update --working-dir=$GITHUB_WORKSPACE -n
cp -r $GITHUB_WORKSPACE/src/Frontend/NetzkollektivEasyCredit $PLUGIN_DIR
- name: Install & activate Plugin
run: |
cd $SW_DIR
$GITHUB_WORKSPACE/bin/setup-plugin
php bin/console sw:plugin:config:set NetzkollektivEasyCredit easycreditApiKey ${{ secrets.EASYCREDITAPIKEY }}
php bin/console sw:plugin:config:set NetzkollektivEasyCredit easycreditApiPassword ${{ secrets.EASYCREDITAPIPASSWORD }}
php bin/console sw:plugin:config:set NetzkollektivEasyCredit easycreditApiSignature ${{ secrets.EASYCREDITAPISIGNATURE }}
php bin/console sw:cache:clear
php bin/console sw:generate:attributes
php bin/console orm:generate:proxies
- name: Static Analyze
run: |
cd $PLUGIN_DIR
REVISION=`basename $SW_DIR/var/cache/production_* | sed 's/production_//g'`
sed "s/__REVISION__/$REVISION/g" phpstan.neon.dist > phpstan.neon
find . -maxdepth 1 -type l -delete
php vendor/bin/phpstan -v analyze .
- name: Setup Playwright
run: |
npm install --global yarn
yarn install --frozen-lockfile
yarn playwright install --with-deps chromium
- name: Playwright E2E Tests
run: |
cd $GITHUB_WORKSPACE
VERSION=${{ matrix.shopware-version }} yarn playwright test -c tests/
- name: Save Logs for Debugging
if: always()
run: |
LOG_DIR=playwright-report/logs
mkdir $LOG_DIR
cp -r $SW_DIR/var/log/* $LOG_DIR/
for i in $LOG_DIR/*; do
echo "<a href=\"$(basename $i)\">$i</a><br />" >> $LOG_DIR/index.html
done;
- name: Deploy Error Reports
if: always()
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy playwright-report/ --project-name=easycredit-playwright-reports
- name: Deactivate & uninstall Plugin
if: always()
run: |
cd $SW_DIR
php bin/console sw:plugin:deactivate NetzkollektivEasyCredit
php bin/console sw:plugin:uninstall NetzkollektivEasyCredit