Skip to content

Commit 9d60139

Browse files
committed
ci: EC-CUBE標準に合わせてCI設定を更新
- MySQL/PostgreSQLセットアップをDockerサービスに変更 - shogo82148/actions-setup-postgresが見つからないエラーを解消 - EC-CUBE標準のDockerサービス方式に統一 - データベーススキーマのセットアップステップを追加 - doctrine:database:create と doctrine:schema:create を実行 - PHPUnitテスト実行コマンドをEC-CUBE標準に合わせて更新 - --exclude-groupオプションを追加(cache-clear,cache-clear-install,update-schema-doctrine,plugin-service) - actions/upload-artifactをv6に更新
1 parent cb941d0 commit 9d60139

1 file changed

Lines changed: 42 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,34 @@ jobs:
2525
ec-cube-version: ['4.3']
2626
database: ['mysql', 'postgresql']
2727

28+
services:
29+
mysql:
30+
image: mysql:8.0
31+
env:
32+
MYSQL_ROOT_PASSWORD: root
33+
MYSQL_DATABASE: eccube_test
34+
ports:
35+
- 3306:3306
36+
options: >-
37+
--health-cmd="mysqladmin ping"
38+
--health-interval=10s
39+
--health-timeout=5s
40+
--health-retries=3
41+
42+
postgres:
43+
image: postgres:15
44+
env:
45+
POSTGRES_USER: postgres
46+
POSTGRES_PASSWORD: postgres
47+
POSTGRES_DB: eccube_test
48+
ports:
49+
- 5432:5432
50+
options: >-
51+
--health-cmd="pg_isready -U postgres"
52+
--health-interval=10s
53+
--health-timeout=5s
54+
--health-retries=3
55+
2856
steps:
2957
- name: Checkout plugin repository
3058
uses: actions/checkout@v6
@@ -45,23 +73,6 @@ jobs:
4573
extensions: mbstring, intl, pdo_mysql, pdo_pgsql, curl, zip, opcache
4674
coverage: none
4775

48-
- name: Setup MySQL
49-
if: matrix.database == 'mysql'
50-
uses: shogo82148/actions-setup-mysql@v1
51-
with:
52-
mysql-version: '8.0'
53-
root-password: 'root'
54-
database: 'eccube_test'
55-
56-
- name: Setup PostgreSQL
57-
if: matrix.database == 'postgresql'
58-
uses: shogo82148/actions-setup-postgres@v1
59-
with:
60-
postgres-version: '15'
61-
postgres-user: 'postgres'
62-
postgres-password: 'postgres'
63-
postgres-db: 'eccube_test'
64-
6576
- name: Install EC-CUBE dependencies
6677
working-directory: eccube
6778
run: |
@@ -74,6 +85,18 @@ jobs:
7485
# .githubディレクトリと.gitディレクトリは除外
7586
find plugin -mindepth 1 -maxdepth 1 ! -name '.github' ! -name '.git' -exec cp -r {} eccube/app/Plugin/OrderStatusColor42/ \;
7687
88+
- name: Setup database schema
89+
working-directory: eccube
90+
env:
91+
APP_ENV: 'test'
92+
DATABASE_URL: ${{ matrix.database == 'mysql' && 'mysql://root:root@127.0.0.1:3306/eccube_test' || 'postgresql://postgres:postgres@127.0.0.1:5432/eccube_test' }}
93+
DATABASE_SERVER_VERSION: ${{ matrix.database == 'mysql' && '8.0' || '15' }}
94+
DATABASE_CHARSET: ${{ matrix.database == 'mysql' && 'utf8mb4' || 'UTF8' }}
95+
MAILER_URL: 'smtp://127.0.0.1:1025'
96+
run: |
97+
php bin/console doctrine:database:create --if-not-exists --no-interaction
98+
php bin/console doctrine:schema:create --no-interaction
99+
77100
- name: Run PHPUnit tests
78101
working-directory: eccube
79102
env:
@@ -83,11 +106,11 @@ jobs:
83106
DATABASE_CHARSET: ${{ matrix.database == 'mysql' && 'utf8mb4' || 'UTF8' }}
84107
MAILER_URL: 'smtp://127.0.0.1:1025'
85108
run: |
86-
vendor/bin/phpunit app/Plugin/OrderStatusColor42/tests/
109+
vendor/bin/phpunit --exclude-group cache-clear,cache-clear-install,update-schema-doctrine,plugin-service app/Plugin/OrderStatusColor42/tests/
87110
88111
- name: Upload logs
89112
if: failure()
90-
uses: actions/upload-artifact@v4
113+
uses: actions/upload-artifact@v6
91114
with:
92115
name: plugin-test-php${{ matrix.php-version }}-${{ matrix.database }}-logs
93116
path: eccube/var/log/

0 commit comments

Comments
 (0)