Skip to content

Commit

Permalink
Merge pull request #53 from chihiro-adachi/4.2
Browse files Browse the repository at this point in the history
CIの更新
  • Loading branch information
chihiro-adachi authored Jun 24, 2022
2 parents 645c7ab + 9a4d300 commit f6aecc0
Show file tree
Hide file tree
Showing 17 changed files with 128 additions and 218 deletions.
117 changes: 54 additions & 63 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI for Maker4
name: CI for Maker42
on:
push:
branches:
Expand All @@ -22,38 +22,42 @@ jobs:
fail-fast: false
matrix:
operating-system: [ ubuntu-18.04 ]
php: [ '7.1', '7.2', '7.3', '7.4' ]
db: [ mysql, pgsql ]
eccube_version: [ '4.0.6-p1', '4.1' ]
plugin_code: [ 'Maker4' ]
php: [ '7.4', '8.0', '8.1' ]
db: [ 'mysql', 'mysql8', 'pgsql' ]
eccube_version: [ '4.2' ]
plugin_code: [ 'Maker42' ]
include:
- eccube_version: '4.0.6-p1'
composer: 'v1'
- eccube_version: '4.1'
composer: 'v2'
- db: mysql
dbport: '3306'
dbuser: 'root'
dbpass: 'root'
dbname: 'myapp_test'
dbversion: 5.7
database_url: mysql://root:password@127.0.0.1:3306/eccube_db
database_server_version: 5.7
database_charset: utf8mb4
- db: mysql8
database_url: mysql://root:password@127.0.0.1:3308/eccube_db
database_server_version: 8
database_charset: utf8mb4
- db: pgsql
dbport: '5432'
dbuser: 'postgres'
dbpass: 'password'
dbname: 'myapp_test'
dbversion: 9.5
database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db
database_server_version: 14
database_charset: utf8
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: ${{ matrix.dbname }}
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
MYSQL_DATABASE: ${{ matrix.dbname }}
ports:
- 3308:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres:9.5
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
Expand Down Expand Up @@ -93,85 +97,72 @@ jobs:
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- if: matrix.composer == 'v1'
run: sudo composer selfupdate --1

- name: Install to composer
working-directory: 'ec-cube'
run: composer install --no-interaction -o --apcu-autoloader

- if: matrix.composer == 'v1'
working-directory: 'ec-cube'
run: composer require kiy0taka/eccube4-test-fixer "dev-main@dev"

- name: Setup EC-CUBE
env:
DB: ${{ matrix.db }}
USER: ${{ matrix.dbuser }}
DBUSER: ${{ matrix.dbuser }}
DBPASS: ${{ matrix.dbpass }}
DBNAME: ${{ matrix.dbname }}
DBPORT: ${{ matrix.dbport }}
DBSERVER: 127.0.0.1
DBVERSION: ${{ matrix.dbversion }}
ROOT_URLPATH: /ec-cube/html
APP_ENV: 'test'
APP_DEBUG: 0
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
DATABASE_CHARSET: ${{ matrix.database_charset }}
working-directory: 'ec-cube'
run: |
export PGPASSWORD=${DBPASS}
echo "APP_ENV=prod" > .env
echo "APP_DEBUG=0" >> .env
echo "DATABASE_URL=${DB}://${DBUSER}:${DBPASS}@${DBSERVER}/${DBNAME}" >> .env
echo "DATABASE_SERVER_VERSION=${DBVERSION}" >> .env
echo "MAILER_URL=null://localhost" >> .env
echo "HTTP_SITEURL=https://localhost" >> .env
echo "USE_SELFSIGNED_SSL_CERTIFICATE=1" >> .env
cat .env
bin/console doctrine:database:create
bin/console doctrine:schema:create
bin/console eccube:fixtures:load
- name: Setup Plugin
env:
APP_ENV: 'test'
APP_DEBUG: 0
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
DATABASE_CHARSET: ${{ matrix.database_charset }}
PLUGIN_CODE: ${{ matrix.plugin_code }}
working-directory: 'ec-cube'
run: |
bin/console eccube:plugin:install --code=${PLUGIN_CODE} --path=${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz
bin/console cache:clear --no-warmup
bin/console eccube:plugin:enable --code=${PLUGIN_CODE}
rm codeception/_support/*Tester.php
- name: Run PHPUnit
if: matrix.composer == 'v2'
env:
PLUGIN_CODE: ${{ matrix.plugin_code }}
working-directory: 'ec-cube'
run: bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests

- name: Run PHPUnit
if: matrix.composer == 'v1'
env:
APP_ENV: 'test'
APP_DEBUG: 0
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
DATABASE_CHARSET: ${{ matrix.database_charset }}
PLUGIN_CODE: ${{ matrix.plugin_code }}
working-directory: 'ec-cube'
run: |
find app/Plugin/${PLUGIN_CODE}/Tests -name "*Test.php" | while read TESTCASE
do
./vendor/bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist --include-path vendor/kiy0taka/eccube4-test-fixer/src --loader 'Eccube\PHPUnit\Loader\Eccube4CompatTestSuiteLoader' ${TESTCASE}
done
bin/console cache:clear --no-warmup
bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests
- name: Disable Plugin
working-directory: 'ec-cube'
env:
APP_ENV: 'test'
APP_DEBUG: 0
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
DATABASE_CHARSET: ${{ matrix.database_charset }}
PLUGIN_CODE: ${{ matrix.plugin_code }}
run: bin/console eccube:plugin:disable --code=${PLUGIN_CODE}

- name: Uninstall Plugin
env:
APP_ENV: 'test'
APP_DEBUG: 0
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
DATABASE_CHARSET: ${{ matrix.database_charset }}
PLUGIN_CODE: ${{ matrix.plugin_code }}
working-directory: 'ec-cube'
run: bin/console eccube:plugin:uninstall --code=${PLUGIN_CODE}
10 changes: 5 additions & 5 deletions Controller/MakerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
* file that was distributed with this source code.
*/

namespace Plugin\Maker4\Controller;
namespace Plugin\Maker42\Controller;

use Eccube\Controller\AbstractController;
use Plugin\Maker4\Entity\Maker;
use Plugin\Maker4\Form\Type\MakerType;
use Plugin\Maker4\Repository\MakerRepository;
use Plugin\Maker42\Entity\Maker;
use Plugin\Maker42\Form\Type\MakerType;
use Plugin\Maker42\Repository\MakerRepository;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -54,7 +54,7 @@ public function __construct(MakerRepository $makerRepository)
* @throws \Doctrine\ORM\OptimisticLockException
*
* @Route("/%eccube_admin_route%/maker", name="maker_admin_index")
* @Template("@Maker4/admin/maker.twig")
* @Template("@Maker42/admin/maker.twig")
*/
public function index(Request $request)
{
Expand Down
4 changes: 2 additions & 2 deletions Entity/Maker.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* file that was distributed with this source code.
*/

namespace Plugin\Maker4\Entity;
namespace Plugin\Maker42\Entity;

use Doctrine\ORM\Mapping as ORM;
use Eccube\Entity\AbstractEntity;
Expand All @@ -22,7 +22,7 @@
* Class Maker.
*
* @ORM\Table(name="plg_maker")
* @ORM\Entity(repositoryClass="Plugin\Maker4\Repository\MakerRepository")
* @ORM\Entity(repositoryClass="Plugin\Maker42\Repository\MakerRepository")
*/
class Maker extends AbstractEntity
{
Expand Down
6 changes: 3 additions & 3 deletions Entity/ProductTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* file that was distributed with this source code.
*/

namespace Plugin\Maker4\Entity;
namespace Plugin\Maker42\Entity;

use Doctrine\ORM\Mapping as ORM;
use Eccube\Annotation as Eccube;
Expand All @@ -22,9 +22,9 @@
trait ProductTrait
{
/**
* @var \Plugin\Maker4\Entity\Maker
* @var \Plugin\Maker42\Entity\Maker
*
* @ORM\ManyToOne(targetEntity="Plugin\Maker4\Entity\Maker")
* @ORM\ManyToOne(targetEntity="Plugin\Maker42\Entity\Maker")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="maker_id", referencedColumnName="id")
* })
Expand Down
6 changes: 3 additions & 3 deletions Form/Extension/ProductTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
* file that was distributed with this source code.
*/

namespace Plugin\Maker4\Form\Extension;
namespace Plugin\Maker42\Form\Extension;

use Eccube\Common\EccubeConfig;
use Eccube\Form\Type\Admin\ProductType;
use Plugin\Maker4\Entity\Maker;
use Plugin\Maker4\Repository\MakerRepository;
use Plugin\Maker42\Entity\Maker;
use Plugin\Maker42\Repository\MakerRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\TextType;
Expand Down
2 changes: 1 addition & 1 deletion Form/Type/MakerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* file that was distributed with this source code.
*/

namespace Plugin\Maker4\Form\Type;
namespace Plugin\Maker42\Form\Type;

use Eccube\Common\EccubeConfig;
use Symfony\Component\Form\AbstractType;
Expand Down
4 changes: 2 additions & 2 deletions MakerEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* file that was distributed with this source code.
*/

namespace Plugin\Maker4;
namespace Plugin\Maker42;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Eccube\Event\TemplateEvent;
Expand All @@ -37,6 +37,6 @@ public static function getSubscribedEvents()
*/
public function onTemplateProductDetail(TemplateEvent $templateEvent)
{
$templateEvent->addSnippet('@Maker4/default/maker.twig');
$templateEvent->addSnippet('@Maker42/default/maker.twig');
}
}
2 changes: 1 addition & 1 deletion MakerNav.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* file that was distributed with this source code.
*/

namespace Plugin\Maker4;
namespace Plugin\Maker42;

use Eccube\Common\EccubeNav;

Expand Down
2 changes: 1 addition & 1 deletion PluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* file that was distributed with this source code.
*/

namespace Plugin\Maker4;
namespace Plugin\Maker42;

use Eccube\Plugin\AbstractPluginManager;

Expand Down
10 changes: 5 additions & 5 deletions Repository/MakerRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
* file that was distributed with this source code.
*/

namespace Plugin\Maker4\Repository;
namespace Plugin\Maker42\Repository;

use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Plugin\Maker4\Entity\Maker;
use Symfony\Bridge\Doctrine\RegistryInterface;
use Plugin\Maker42\Entity\Maker;
use Doctrine\Persistence\ManagerRegistry;

/**
* Maker.
Expand All @@ -28,10 +28,10 @@ class MakerRepository extends ServiceEntityRepository
/**
* MakerRepository constructor.
*
* @param RegistryInterface $registry
* @param ManagerRegistry $registry
* @param string $entityClass
*/
public function __construct(RegistryInterface $registry, $entityClass = Maker::class)
public function __construct(ManagerRegistry $registry, $entityClass = Maker::class)
{
parent::__construct($registry, $entityClass);
}
Expand Down
Loading

0 comments on commit f6aecc0

Please sign in to comment.