forked from Leuchtfeuer/mautic-DOI-bundle
-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (101 loc) · 3.89 KB
/
tests.yml
File metadata and controls
124 lines (101 loc) · 3.89 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
120
121
122
123
124
name: Mautic Plugin tests
on:
push:
branches:
- 'main'
- 'feature/*'
- 'fix/*'
pull_request:
env:
PLUGIN_DIR: plugins/LeuchtfeuerDoiBundle
jobs:
phpunit:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']
db-types: ['mysql','mariadb']
mautic-versions: ['5.2.7']
name: Tests on PHP ${{ matrix.php-versions }}, ${{ matrix.db-types }}, Mautic ${{ matrix.mautic-versions }}
services:
database:
image: ${{ matrix.db-types == 'mysql' && 'mysql:5.7' || 'mariadb:10.3' }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: mautictest
ports:
- 3306
options: >-
--shm-size=2gb
--name=${{ matrix.db-types }}
--tmpfs=/var/lib/mysql
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Checkout Mautic
uses: actions/checkout@v4
with:
repository: mautic/mautic
ref: ${{ matrix.mautic-versions }}
- name: Checkout this plugin
uses: actions/checkout@v4
with:
path: ${{ env.PLUGIN_DIR }}
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
ini-values: -dpcov.enabled=0, pcov.directory=."
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql, pdo_mysql
coverage: pcov
- name: add MySQL config file
run: |
mysqldump --version
mysqldump --print-defaults
cp .github/ci-files/.my.cnf ~/.my.cnf
mysqldump --print-defaults
- name: Set SYMFONY_ENV to test
run: |
echo "SYMFONY_ENV=test" >> $GITHUB_ENV
echo "MAUTIC_ENV=test" >> $GITHUB_ENV
echo "MAUTIC_TABLE_PREFIX=mautic_" >> $GITHUB_ENV
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install
- name: Install Mautic
env:
DB_PORT: ${{ job.services.database.ports[3306] }}
run: |
cp ./.github/ci-files/local.php ./config/local.php
php bin/console mautic:install --force http://localhost
- name: Install Plugins
env:
DB_PORT: ${{ job.services.database.ports[3306] }}
run: php bin/console mautic:plugins:install --env=dev
- name: Run Code Style check
run: bin/php-cs-fixer fix ${{ env.PLUGIN_DIR }} --config=.php-cs-fixer.php -v --dry-run --show-progress=dots --diff
- name: PHPSTAN
run: composer phpstan -- ${{ env.PLUGIN_DIR }}
- name: Rector
run: composer rector -- --dry-run --no-progress-bar ${{ env.PLUGIN_DIR }}
- name: Twig Lint
run: bin/console lint:twig ${{ env.PLUGIN_DIR }}
- name: Run PHPUNIT tests
env:
DB_PORT: ${{ job.services.database.ports[3306] }}
run: XDEBUG_MODE=coverage APP_DEBUG=0 php -dpcov.enabled=1 -dpcov.directory=. -dpcov.exclude="~tests|themes|vendor~" bin/phpunit -d memory_limit=1G --bootstrap vendor/autoload.php --configuration ${{ env.PLUGIN_DIR }}/phpunit.xml --coverage-clover=${{ env.PLUGIN_DIR }}/coverage.xml --coverage-text
- name: Upload logs as artifacts
uses: actions/upload-artifact@v4
with:
name: mautic-logs-php${{ matrix.php-versions }}-${{ matrix.db-types }}-mautic${{ matrix.mautic-versions }}
path: var/logs/