Skip to content

EC-CUBE4.3対応

EC-CUBE4.3対応 #17

Workflow file for this run

name: CI/CD for EC-CUBE4 Plugin
on: [ workflow_dispatch, pull_request ]
env:
PLUGIN_CODE: ResizeImage42
PACKAGE_NAME: 'ec-cube/resizeimage42'
WORKING_DIRECTORY: 'ec-cube'
APP_ENV: 'test'
APP_DEBUG: 0
jobs:
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
eccube-versions: [ '4.2', '4.3' ]
php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
database: [ 'mysql', 'mysql8', 'pgsql' ]
include:
- database: mysql
database_url: mysql://root:password@127.0.0.1:3306/eccube_db
database_server_version: 5.7
database_charset: utf8mb4
- database: mysql8
database_url: mysql://root:password@127.0.0.1:3308/eccube_db
database_server_version: 8
database_charset: utf8mb4
- database: pgsql
database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db
database_server_version: 14
database_charset: utf8
exclude:
- eccube-versions: 4.2
php-versions: 8.2
- eccube-versions: 4.2
php-versions: 8.3
- eccube-versions: 4.3
php-versions: 7.4
- eccube-versions: 4.3
php-versions: 8.0
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: password
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
mysql8:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: password
ports:
- 3308:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Archive Plugin
run: |
tar cvzf ${GITHUB_WORKSPACE}/${{ env.PLUGIN_CODE }}.tar.gz ./*
- name: Setup mock-package-api
run: |
mkdir -p /tmp/repos
cp ${GITHUB_WORKSPACE}/${{ env.PLUGIN_CODE }}.tar.gz /tmp/repos/${{ env.PLUGIN_CODE }}.tgz
docker run --name package-api -d -v /tmp/repos:/repos -e MOCK_REPO_DIR=/repos -p 8080:8080 eccube/mock-package-api:composer2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, mysql, intl, :xdebug
tools: composer:v2
- name: Checkout EC-CUBE
uses: actions/checkout@v4
with:
repository: EC-CUBE/ec-cube
ref: ${{ matrix.eccube-versions }}
path: ${{ env.WORKING_DIRECTORY }}
- name: Initialize Composer
uses: ./.github/actions/composer
- name: Setup EC-CUBE
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
bin/console doctrine:database:create
bin/console doctrine:schema:create
bin/console eccube:fixtures:load
env:
APP_ENV: ${{ env.APP_ENV }}
APP_DEBUG: ${{ env.APP_DEBUG }}
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
DATABASE_CHARSET: ${{ matrix.database_charset }}
- name: Setup Plugin
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
bin/console doctrine:query:sql "update dtb_base_info set authentication_key='dummy'"
bin/console eccube:composer:require ${{ env.PACKAGE_NAME }}
bin/console cache:clear --no-warmup
bin/console eccube:plugin:enable --code ${{ env.PLUGIN_CODE }}
bin/console cache:clear --no-warmup
env:
APP_ENV: ${{ env.APP_ENV }}
APP_DEBUG: ${{ env.APP_DEBUG }}
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
DATABASE_CHARSET: ${{ matrix.database_charset }}
ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080'
USE_SELFSIGNED_SSL_CERTIFICATE: '1'
- name: Run PHPUnit
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
bin/console cache:clear --no-warmup
./vendor/bin/phpunit -c app/Plugin/${{ env.PLUGIN_CODE }}/phpunit.xml.dist app/Plugin/${{ env.PLUGIN_CODE }}/Tests
env:
APP_ENV: ${{ env.APP_ENV }}
APP_DEBUG: ${{ env.APP_DEBUG }}
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
DATABASE_CHARSET: ${{ matrix.database_charset }}
- name: Update Plugin
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
bin/console cache:clear --no-warmup
bin/console eccube:plugin:update ${{ env.PLUGIN_CODE }}
env:
APP_ENV: ${{ env.APP_ENV }}
APP_DEBUG: ${{ env.APP_DEBUG }}
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
DATABASE_CHARSET: ${{ matrix.database_charset }}
- name: Uninstall Plugin
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
bin/console cache:clear --no-warmup
bin/console eccube:plugin:uninstall --code=${{ env.PLUGIN_CODE }}
env:
APP_ENV: ${{ env.APP_ENV }}
APP_DEBUG: ${{ env.APP_DEBUG }}
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
DATABASE_CHARSET: ${{ matrix.database_charset }}