-
Notifications
You must be signed in to change notification settings - Fork 99
209 lines (198 loc) · 7.75 KB
/
e2e-tests.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
name: E2E testing for EC-CUBE
on:
push:
branches:
- '*'
tags:
- '*'
paths:
- '**'
- '!*.md'
pull_request:
paths:
- '**'
- '!*.md'
jobs:
run-on-linux:
name: Run on Linux
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
pattern:
- 'test:e2e'
- 'test:e2e-extends'
group:
- 'test/front_login'
- 'test/front_guest'
- 'test/admin'
steps:
- name: Checkout
uses: actions/checkout@v3
# - name: Create ADMIN_DIR
# run: |
# sudo apt-fast install -y sharutils
# echo "ADMIN_DIR=$(head -c 10 < /dev/random | uuencode -m - | tail -n 2 |head -n 1 | sed 's,[/+],_,g' | head -c10)/" >> $GITHUB_ENV
- name: Setup environment
run: echo "COMPOSE_FILE=docker-compose.yml:docker-compose.pgsql.yml:docker-compose.dev.yml:docker-compose.owaspzap.yml:docker-compose.owaspzap.daemon.yml" >> $GITHUB_ENV
- if: matrix.pattern == 'test:e2e-extends'
run: cp -rp tests/class/fixtures/page_extends/* data/class_extends/page_extends
- name: Setup to EC-CUBE
run: |
sudo chown -R 1001:1000 zap
sudo chmod -R g+w zap
docker build -t ec-cube2 --build-arg PHP_VERSION_TAG=7.4 .
docker tag ec-cube2 ghcr.io/ec-cube/ec-cube2-php:7.4-apache
TAG=7.4-apache docker-compose up -d
docker-compose exec -T ec-cube composer install
docker-compose exec -T ec-cube composer require ec-cube2/cli "dev-master@dev" --ignore-platform-req=php -W
docker-compose exec -T ec-cube composer update 'symfony/*' --ignore-platform-req=php -W
docker-compose exec -T ec-cube php data/vendor/bin/eccube eccube:fixtures:generate --products=5 --customers=1 --orders=5
docker-compose exec -T postgres psql --user=eccube_db_user eccube_db -c "UPDATE dtb_customer SET email = '[email protected]' WHERE customer_id = (SELECT MAX(customer_id) FROM dtb_customer WHERE status = 2 AND del_flg = 0);"
- run: sleep 1
- run: |
yarn install
yarn run playwright install --with-deps chromium
yarn playwright install-deps chromium
- name: Run to E2E testing
env:
GROUP: ${{ matrix.group }}
PATTERN: ${{ matrix.pattern }}
HTTPS_PROXY: 'localhost:8090'
HTTP_PROXY: 'localhost:8090'
CI: 1
FORCE_COLOR: 1
run: yarn ${PATTERN} e2e-tests/${GROUP}
- name: Upload evidence
if: failure()
uses: actions/upload-artifact@v3
with:
name: linux-php${{ matrix.tag }}-${{ matrix.db }}-evidence
path: 'test-results/'
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: linux-php${{ matrix.php }}-${{ matrix.db }}-logs
path: data/logs
installer:
name: Installer test
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
db: [ 'pgsql', 'mysql' ]
php: [ '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]
include:
- db: mysql
dbport: '3306'
dbuser: 'eccube_db_user'
dbpass: 'password'
dbname: 'eccube_db'
dbhost: 'mysql'
- db: pgsql
dbport: '5432'
dbuser: 'eccube_db_user'
dbpass: 'password'
dbname: 'eccube_db'
dbhost: 'postgres'
steps:
## TODO GitHub Container Registry が使えるようになったら workflow_run で書き直す
- if: ${{ matrix.php == 5.4 }}
run: |
echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql mbstring" >> ${GITHUB_ENV}
echo "APCU=apcu-4.0.11" >> ${GITHUB_ENV}
echo "FORCE_YES=--force-yes" >> ${GITHUB_ENV}
echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
- if: ${{ matrix.php == 5.5 || matrix.php == 5.6 }}
run: |
echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
echo "APCU=" >> ${GITHUB_ENV}
echo "FORCE_YES=--force-yes" >> ${GITHUB_ENV}
echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
- if: ${{ matrix.php == 7.0 }}
run: |
echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
- if: ${{ matrix.php >= 7.0 && matrix.php <= 7.3 }}
run: |
echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
echo "APCU=apcu" >> ${GITHUB_ENV}
echo "FORCE_YES=" >> ${GITHUB_ENV}
- if: ${{ matrix.php >= 7.4 }}
run: |
echo "GD_OPTIONS=--with-freetype --with-jpeg" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
echo "APCU=apcu" >> ${GITHUB_ENV}
echo "FORCE_YES=" >> ${GITHUB_ENV}
- name: Checkout
uses: actions/checkout@v3
- name: Setup environment
env:
DB_TYPE: ${{ matrix.db }}
run: echo "COMPOSE_FILE=docker-compose.yml:docker-compose.${DB_TYPE}.yml:docker-compose.dev.yml:docker-compose.owaspzap.yml:docker-compose.owaspzap.daemon.yml" >> $GITHUB_ENV
- name: Setup to EC-CUBE
env:
HTTP_URL: https://127.0.0.1:8085/
HTTPS_URL: https://127.0.0.1:8085/
PHP_VERSION_TAG: ${{ matrix.php }}
run: |
sudo chown -R 1001:1000 zap
sudo chmod -R g+w zap
sh -c 'echo "<?php" >> data/config/config.php'
docker build -t ec-cube2 --build-arg PHP_VERSION_TAG="${PHP_VERSION_TAG}" --build-arg GD_OPTIONS="${GD_OPTIONS}" --build-arg EXT_INSTALL_ARGS="${EXT_INSTALL_ARGS}" --build-arg APCU="${APCU}" .
docker tag ec-cube2 ghcr.io/ec-cube/ec-cube2-php:${PHP_VERSION_TAG}-apache
TAG=${PHP_VERSION_TAG}-apache docker-compose up -d
- run: sleep 1
- run: |
yarn install
yarn run playwright install --with-deps chromium
yarn playwright install-deps chromium
- run: |
rm data/config/config.php
chmod -R o+w html
chmod o+w data
chmod -R o+w data/Smarty
chmod -R o+w data/cache
chmod -R o+w data/class
chmod -R o+w data/class_extends
chmod o+w data/config
chmod -R o+w data/download
chmod -R o+w data/downloads
chmod o+w data/fonts
chmod o+w data/include
chmod o+w data/logs
chmod -R o+w data/module
chmod o+w data/smarty_extends
chmod o+w data/upload
chmod o+w data/upload/csv
- name: Run to E2E testing
env:
HTTP_PROXY: 'localhost:8090'
HTTPS_PROXY: 'localhost:8090'
CI: 1
FORCE_COLOR: 1
DB_TYPE: ${{ matrix.db }}
DB_USER: ${{ matrix.dbuser }}
DB_PASSWORD: ${{ matrix.dbpass }}
DB_NAME: ${{ matrix.dbname }}
DB_PORT: ${{ matrix.dbport }}
DB_SERVER: ${{ matrix.dbhost }}
run: yarn test:e2e e2e-tests/test/installer/installer.test.ts
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: linux-php${{ matrix.php }}-${{ matrix.db }}-logs
path: html/install/temp/install.log*
- name: Upload evidence
if: failure()
uses: actions/upload-artifact@v3
with:
name: linux-php${{ matrix.php }}-${{ matrix.db }}-evidence
path: 'test-results/'