Skip to content

Commit

Permalink
EC-CUBE4.3対応
Browse files Browse the repository at this point in the history
  • Loading branch information
kurozumi committed May 8, 2024
1 parent 65f1028 commit e9ec6d8
Show file tree
Hide file tree
Showing 36 changed files with 679 additions and 2,957 deletions.
20 changes: 20 additions & 0 deletions .github/actions/composer/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
runs:
using: "Composite"
steps:
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
shell: bash

- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: composer install
working-directory: ${{ env.WORKING_DIRECTORY }}
run: composer install --dev --no-interaction -o --apcu-autoloader
shell: bash
87 changes: 29 additions & 58 deletions .github/workflows/phpstan.yaml
Original file line number Diff line number Diff line change
@@ -1,80 +1,51 @@
name: PHPStan
on: [workflow_dispatch, pull_request]
env:
DATABASE_URL: mysql://root:root@127.0.0.1:3306/eccube_db
DATABASE_SERVER_VERSION: 5

PLUGIN_CODE: EccubeMakerBundle
PLUGIN_BRANCH: '4.3'
jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest
strategy:
fail-fast: false

services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_USER: root
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: eccube_db
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
matrix:
eccube-versions: ['4.2', '4.3']
php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
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

steps:
- name: Checkout
uses: actions/checkout@master
- name: Checkout EC-CUBE
uses: actions/checkout@v4
with:
repository: EC-CUBE/ec-cube
ref: ${{ matrix.eccube-versions }}

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
with:
php-version: 7.4
extensions: mbstring, xml, ctype, iconv, mysql, intl
tools: composer:v1
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, mysql, intl, :xdebug
tools: composer:v2

- name: Clone EC-CUBE
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tar cvzf $HOME/${{ github.event.repository.name }}.tar.gz ./*
git clone https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/EC-CUBE/ec-cube.git -b 4.1 --depth=1
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Initialize Composer
uses: ./.github/actions/composer

- name: Cache composer dependencies
uses: actions/cache@v2
- name: Checkout
uses: actions/checkout@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install Composer dependencies
run: |
cd ec-cube
composer install --no-progress --prefer-dist --optimize-autoloader
composer require api
- name: Setup EC-CUBE
run: |
cd ec-cube
bin/console doctrine:schema:create
bin/console eccube:fixtures:load
- name: Install Plugin
run: |
cd ec-cube
bin/console eccube:plugin:install --path=$HOME/${{ github.event.repository.name }}.tar.gz
bin/console cache:clear --no-warmup
bin/console eccube:plugin:enable --code=${{ github.event.repository.name }}
path: app/Plugin/${{ env.PLUGIN_CODE }}
ref: ${{ github.event.pull_request.head.sha }}

- name: PHPStan
run: |
cd ec-cube
composer require phpstan/phpstan --dev
vendor/bin/phpstan analyze -l 0 app/Plugin/${{ github.event.repository.name }} --error-format=github
./vendor/bin/phpstan analyze app/Plugin/${{ env.PLUGIN_CODE }} -c "app/Plugin/${{ env.PLUGIN_CODE }}/phpstan.neon" --error-format=github
12 changes: 8 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@

name: Packaging for EC-CUBE Plugin
on:
release:
types: [ published ]
env:
PLUGIN_CODE: EccubeMakerBundle
jobs:
deploy:
name: Build
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -17,12 +20,13 @@ jobs:
find $GITHUB_WORKSPACE -name ".git*" -and ! -name ".gitkeep" -print0 | xargs -0 rm -rf
chmod -R o+w $GITHUB_WORKSPACE
cd $GITHUB_WORKSPACE
tar cvzf ../${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz ./*
tar cvzf ../${{ env.PLUGIN_CODE }}-${{ github.event.release.tag_name }}.tar.gz ./*
- name: Upload binaries to release of TGZ
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ runner.workspace }}/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz
asset_name: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz
file: ${{ runner.workspace }}/${{ env.PLUGIN_CODE }}-${{ github.event.release.tag_name }}.tar.gz
asset_name: ${{ env.PLUGIN_CODE }}-${{ github.event.release.tag_name }}.tar.gz
tag: ${{ github.ref }}
overwrite: true

164 changes: 91 additions & 73 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,135 +1,153 @@
name: CI/CD for EC-CUBE4 Plugin with Composer:v1
name: CI/CD for EC-CUBE4 Plugin
on: [workflow_dispatch, pull_request]
env:
PLUGIN_CODE: EccubeMakerBundle
PACKAGE_NAME: 'ec-cube/eccubemakerbundle'
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.0','4.1']
php-versions: [7.1,7.2,7.3,7.4]
composer: ['v1', 'v2']
database: [mysql, pgsql]
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:root@127.0.0.1:3306/eccube_db
database_server_version: 5
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: 11
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_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_USER: root
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: eccube_db
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
POSTGRES_DB: eccube_db
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 EC-CUBE
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v4
with:
repository: EC-CUBE/ec-cube
ref: ${{ matrix.eccube-versions }}
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup PHP, with composer and extensions
if: matrix.eccube-versions == '4.0'
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, mysql, intl
tools: composer:v1
- 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
if: matrix.eccube-versions != '4.0'
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, mysql, intl
tools: composer:${{ matrix.composer }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install Composer dependencies
run: |
composer install --no-progress --prefer-dist --optimize-autoloader
- name: Install Composer dependencies for EC-CUBE4.0
if: matrix.eccube-versions == '4.0'
run: |
composer require --dev kiy0taka/eccube4-test-fixer
extensions: mbstring, xml, ctype, iconv, mysql, intl, :xdebug
tools: composer:v2

- name: Checkout
uses: actions/checkout@v2
- name: Checkout EC-CUBE
uses: actions/checkout@v4
with:
path: app/Plugin/${{ github.event.repository.name }}
repository: EC-CUBE/ec-cube
ref: ${{ matrix.eccube-versions }}
path: ${{ env.WORKING_DIRECTORY }}

- name: Setup EC-CUBE and Plugin
run: |
composer compile
bin/console eccube:plugin:install --code ${{ github.event.repository.name }}
bin/console cache:clear --no-warmup
bin/console eccube:plugin:enable --code ${{ github.event.repository.name }}
env:
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
- name: Initialize Composer
uses: ./.github/actions/composer

- name: Run Tests for EC-CUBE4.0
if: matrix.eccube-versions == '4.0'
- name: Setup EC-CUBE
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
find app/Plugin/${{ github.event.repository.name }}/Tests -name "*Test.php" | while read TESTCASE
do
bin/phpunit --include-path vendor/kiy0taka/eccube4-test-fixer/src --loader 'Eccube\PHPUnit\Loader\Eccube4CompatTestSuiteLoader' ${TESTCASE}
done
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: Run Tests
if: matrix.eccube-versions != '4.0'
- name: Setup Plugin
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
bin/phpunit app/Plugin/${{ github.event.repository.name }}/Tests
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: Update Plugin
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
bin/console eccube:plugin:update ${{ github.event.repository.name }}
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 eccube:plugin:uninstall --code=${{ github.event.repository.name }}
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 }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.tar.gz
!.gitkeep
.php-cs-fixer.cache
Loading

0 comments on commit e9ec6d8

Please sign in to comment.