-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (106 loc) · 3.82 KB
/
ci.yml
File metadata and controls
120 lines (106 loc) · 3.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: CI
on:
push:
branches:
- '*'
tags:
- '*'
paths:
- '**'
- '!*.md'
pull_request:
paths:
- '**'
- '!*.md'
jobs:
test:
name: PHPUnit Tests (PHP ${{ matrix.php-version }}, ${{ matrix.database }})
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.1', '8.3']
ec-cube-version: ['4.3']
database: ['mysql', 'postgresql']
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: eccube_test
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: eccube_test
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Checkout plugin repository
uses: actions/checkout@v6
with:
path: plugin
- name: Checkout EC-CUBE
uses: actions/checkout@v6
with:
repository: EC-CUBE/ec-cube
ref: ${{ matrix.ec-cube-version }}
path: eccube
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl, pdo_mysql, pdo_pgsql, curl, zip, opcache
coverage: none
- name: Install EC-CUBE dependencies
working-directory: eccube
run: |
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader --no-interaction
- name: Install plugin
run: |
mkdir -p eccube/app/Plugin/OrderStatusColor42
# プラグインリポジトリのルートがそのままプラグインディレクトリの場合
# .githubディレクトリと.gitディレクトリは除外
find plugin -mindepth 1 -maxdepth 1 ! -name '.github' ! -name '.git' -exec cp -r {} eccube/app/Plugin/OrderStatusColor42/ \;
- name: Setup database schema
working-directory: eccube
env:
APP_ENV: 'test'
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' }}
DATABASE_SERVER_VERSION: ${{ matrix.database == 'mysql' && '8.0' || '15' }}
DATABASE_CHARSET: ${{ matrix.database == 'mysql' && 'utf8mb4' || 'UTF8' }}
MAILER_URL: 'smtp://127.0.0.1:1025'
run: |
php bin/console doctrine:database:create --if-not-exists
php bin/console doctrine:schema:create
php bin/console eccube:fixtures:load
- name: Run PHPUnit tests
working-directory: eccube
env:
APP_ENV: 'test'
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' }}
DATABASE_SERVER_VERSION: ${{ matrix.database == 'mysql' && '8.0' || '15' }}
DATABASE_CHARSET: ${{ matrix.database == 'mysql' && 'utf8mb4' || 'UTF8' }}
MAILER_URL: 'smtp://127.0.0.1:1025'
run: |
vendor/bin/phpunit --exclude-group cache-clear,cache-clear-install,update-schema-doctrine,plugin-service app/Plugin/OrderStatusColor42/Tests/
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v6
with:
name: plugin-test-php${{ matrix.php-version }}-${{ matrix.database }}-logs
path: eccube/var/log/
retention-days: 7
if-no-files-found: ignore