Skip to content

Commit

Permalink
Merge pull request #65 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 d633035 + 1a62e78 commit 6a07f35
Show file tree
Hide file tree
Showing 14 changed files with 152 additions and 157 deletions.
235 changes: 113 additions & 122 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI for SalesReport4
name: CI for SalesReport42
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: [ 'SalesReport4' ]
php: [ '7.4', '8.0', '8.1' ]
db: [ 'mysql', 'mysql8', 'pgsql' ]
eccube_version: [ '4.2' ]
plugin_code: [ 'SalesReport42' ]
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:[email protected]:3306/eccube_db
database_server_version: 5.7
database_charset: utf8mb4
- db: mysql8
database_url: mysql://root:[email protected]: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:[email protected]: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 All @@ -68,110 +72,97 @@ jobs:
- 1080:1080
- 1025:1025
steps:
- run: sudo apt-get purge -y hhvm
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: nanasess/setup-php@master
with:
php-version: ${{ matrix.php }}

- name: Archive Plugin
env:
PLUGIN_CODE: ${{ matrix.plugin_code }}
run: |
tar cvzf ${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz ./*
- name: Checkout EC-CUBE
uses: actions/checkout@v2
with:
repository: 'EC-CUBE/ec-cube'
ref: ${{ matrix.eccube_version }}
path: 'ec-cube'

- name: Get Composer Cache Directory
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
- run: sudo apt-get purge -y hhvm
- name: Checkout
uses: actions/checkout@v2

- name: Install to composer
working-directory: 'ec-cube'
run: composer install --no-interaction -o --apcu-autoloader
- name: Setup PHP
uses: nanasess/setup-php@master
with:
php-version: ${{ matrix.php }}

- 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
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=smtp://127.0.0.1:1025" >> .env
echo "HTTP_SITEURL=https://localhost" >> .env
echo "USE_SELFSIGNED_SSL_CERTIFICATE=1" >> .env
cat .env
bin/console doctrine:schema:create
bin/console eccube:fixtures:load
- name: Setup Plugin
env:
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 eccube:plugin:enable --code=${PLUGIN_CODE}
rm codeception/_support/*Tester.php
- name: Archive Plugin
env:
PLUGIN_CODE: ${{ matrix.plugin_code }}
run: |
tar cvzf ${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz ./*
- name: Checkout EC-CUBE
uses: actions/checkout@v2
with:
repository: 'EC-CUBE/ec-cube'
ref: ${{ matrix.eccube_version }}
path: 'ec-cube'

- 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: Get Composer Cache Directory
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-
- name: Install to composer
working-directory: 'ec-cube'
run: composer install --no-interaction -o --apcu-autoloader

- name: Run PHPUnit
if: matrix.composer == 'v1'
env:
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
- name: Setup 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 }}
working-directory: 'ec-cube'
run: |
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}
- name: Run PHPUnit
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 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:
PLUGIN_CODE: ${{ matrix.plugin_code }}
run: bin/console eccube:plugin:disable --code=${PLUGIN_CODE}
- 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:
PLUGIN_CODE: ${{ matrix.plugin_code }}
working-directory: 'ec-cube'
run: bin/console eccube:plugin:uninstall --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}
8 changes: 4 additions & 4 deletions Controller/SalesReportController.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\SalesReport4\Controller;
namespace Plugin\SalesReport42\Controller;

use Eccube\Controller\AbstractController;
use Plugin\SalesReport4\Form\Type\SalesReportType;
use Plugin\SalesReport4\Service\SalesReportService;
use Plugin\SalesReport42\Form\Type\SalesReportType;
use Plugin\SalesReport42\Service\SalesReportService;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\Routing\Annotation\Route;
Expand Down Expand Up @@ -200,7 +200,7 @@ private function response(Request $request, $reportType = null)
log_info('SalesReport Plugin : render ', ['template' => $template]);

return $this->render(
'@SalesReport4/admin/'.$template.'.twig',
'@SalesReport42/admin/'.$template.'.twig',
[
'form' => $form->createView(),
'graphData' => json_encode($data['graph']),
Expand Down
2 changes: 1 addition & 1 deletion Form/Type/SalesReportType.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\SalesReport4\Form\Type;
namespace Plugin\SalesReport42\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
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\SalesReport4;
namespace Plugin\SalesReport42;

use Eccube\Plugin\AbstractPluginManager;

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 売上集計プラグイン

[![CI for SalesReport4](https://github.com/EC-CUBE/sales-report-plugin/actions/workflows/main.yml/badge.svg)](https://github.com/EC-CUBE/sales-report-plugin/actions/workflows/main.yml)
[![CI for SalesReport42](https://github.com/EC-CUBE/sales-report-plugin/actions/workflows/main.yml/badge.svg)](https://github.com/EC-CUBE/sales-report-plugin/actions/workflows/main.yml)

## 概要
売上を集計し、結果をグラフと一覧で確認できます。
Expand Down
4 changes: 2 additions & 2 deletions Resource/template/admin/age.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ Copyright (C) EC-CUBE CO.,LTD. All Rights Reserved.
file that was distributed with this source code.
#}

{% extends 'SalesReport4/Resource/template/admin/index.twig' %}
{% extends 'SalesReport42/Resource/template/admin/index.twig' %}
{% block sub_title %}{{ 'sales_report.admin.sub.title.age'|trans }}{% endblock %}

{% set report_title = 'sales_report.admin.report_title'|trans %}
{% set action = url('sales_report_admin_age') %}
{% set menus = ['SalesReport4', 'sales_report_admin_age'] %}
{% set menus = ['SalesReport42', 'sales_report_admin_age'] %}

{% block stylesheet %}
<link rel="stylesheet" href="{{ asset('assets/css/tempusdominus-bootstrap-4.min.css', 'admin') }}">
Expand Down
4 changes: 2 additions & 2 deletions Resource/template/admin/product.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ Copyright (C) EC-CUBE CO.,LTD. All Rights Reserved.
file that was distributed with this source code.
#}

{% extends 'SalesReport4/Resource/template/admin/index.twig' %}
{% extends 'SalesReport42/Resource/template/admin/index.twig' %}
{% block sub_title %}{{ 'sales_report.admin.sub.title.product'|trans }}{% endblock %}

{% set report_title = 'sales_report.admin.product.report_title'|trans %}
{% set action = url('sales_report_admin_product') %}
{% set menus = ['SalesReport4', 'sales_report_admin_product'] %}
{% set menus = ['SalesReport42', 'sales_report_admin_product'] %}

{% block stylesheet %}
<link rel="stylesheet" href="{{ asset('assets/css/tempusdominus-bootstrap-4.min.css', 'admin') }}">
Expand Down
4 changes: 2 additions & 2 deletions Resource/template/admin/term.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ Copyright (C) EC-CUBE CO.,LTD. All Rights Reserved.
file that was distributed with this source code.
#}

{% extends 'SalesReport4/Resource/template/admin/index.twig' %}
{% extends 'SalesReport42/Resource/template/admin/index.twig' %}
{% block sub_title %}{{ 'sales_report.admin.sub.title.term'|trans }}{% endblock %}

{% set report_title = 'sales_report.admin.term.report_title'|trans %}
{% set action = url('sales_report_admin_term') %}
{% set menus = ['SalesReport4', 'sales_report_admin_term'] %}
{% set menus = ['SalesReport42', 'sales_report_admin_term'] %}

{% block stylesheet %}
<link rel="stylesheet" href="{{ asset('assets/css/tempusdominus-bootstrap-4.min.css', 'admin') }}">
Expand Down
4 changes: 2 additions & 2 deletions SalesReportNav.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\SalesReport4;
namespace Plugin\SalesReport42;

use Eccube\Common\EccubeNav;

Expand All @@ -25,7 +25,7 @@ class SalesReportNav implements EccubeNav
public static function getNav()
{
return [
'SalesReport4' => [
'SalesReport42' => [
'name' => 'sales_report.admin.nav.001',
'icon' => 'fa-chart-bar',
'children' => [
Expand Down
Loading

0 comments on commit 6a07f35

Please sign in to comment.