E2E testing for EC-CUBE #717
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: E2E testing for EC-CUBE | |
run-name: E2E testing for EC-CUBE | |
on: | |
workflow_run: | |
workflows: [CI/CD for EC-CUBE] | |
types: [completed] | |
jobs: | |
run-on-linux: | |
name: Run on Linux | |
runs-on: ubuntu-22.04 | |
if: | | |
github.event.workflow_run.conclusion == 'success' | |
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@v4 | |
# - 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@v4 | |
with: | |
name: linux-php${{ matrix.tag }}-${{ matrix.db }}-evidence | |
path: 'test-results/' | |
- name: Upload logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-php${{ matrix.php }}-${{ matrix.db }}-logs | |
path: data/logs | |
installer: | |
name: Installer test | |
runs-on: ubuntu-22.04 | |
if: | | |
github.event.workflow_run.conclusion == 'success' | |
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', '8.2', '8.3' ] | |
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/debian-security" >> ${GITHUB_ENV} | |
- if: ${{ matrix.php == 5.5 }} | |
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/debian-security" >> ${GITHUB_ENV} | |
- if: ${{ 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 "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} | |
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.1 && 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} | |
echo "APT_REPO=deb.debian.org" >> ${GITHUB_ENV} | |
echo "APT_SECURITY_REPO=security.debian.org" >> ${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} | |
echo "APT_REPO=deb.debian.org" >> ${GITHUB_ENV} | |
echo "APT_SECURITY_REPO=security.debian.org" >> ${GITHUB_ENV} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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}" --build-arg FORCE_YES="${FORCE_YES}" --build-arg APT_REPO="${APT_REPO}" --build-arg APT_SECURITY_REPO="${APT_SECURITY_REPO}" . | |
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@v4 | |
with: | |
name: linux-php${{ matrix.php }}-${{ matrix.db }}-logs | |
path: html/install/temp/install.log* | |
- name: Upload evidence | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-php${{ matrix.php }}-${{ matrix.db }}-evidence | |
path: 'test-results/' |