-
Notifications
You must be signed in to change notification settings - Fork 0
208 lines (179 loc) · 6.9 KB
/
ci.yml
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: CakePHP Plugin CI
on:
push:
branches:
- cake4
pull_request:
branches:
- '*'
schedule:
- cron: "0 7 1 * *"
jobs:
testsuite:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
cakephp-version: ['4.5.*']
php-version: ['7.4', '8.0', '8.1', '8.2']
db-type: ['mysql']
prefer-lowest: ['']
coverage: ['no']
include:
- cakephp-version: '4.0.*'
php-version: '7.2'
db-type: 'mysql:5.7'
prefer-lowest: 'prefer-lowest'
coverage: 'no'
# - cakephp-version: '4.0.*'
# php-version: '8.0'
# db-type: 'mysql'
# prefer-lowest: ''
# coverage: 'no'
- cakephp-version: '4.1.*'
php-version: '7.2'
db-type: 'mysql:5.7'
prefer-lowest: 'prefer-lowest'
coverage: 'no'
- cakephp-version: '4.1.*'
php-version: '8.0'
db-type: 'mysql'
prefer-lowest: ''
coverage: 'no'
- cakephp-version: '4.2.*'
php-version: '7.2'
db-type: 'mysql:5.7'
prefer-lowest: 'prefer-lowest'
coverage: 'no'
- cakephp-version: '4.2.*'
php-version: '8.0'
db-type: 'mysql'
prefer-lowest: ''
coverage: 'no'
- cakephp-version: '4.3.*'
php-version: '7.2'
db-type: 'mysql:5.7'
prefer-lowest: 'prefer-lowest'
coverage: 'no'
- cakephp-version: '4.3.*'
php-version: '8.1'
db-type: 'mysql'
prefer-lowest: ''
coverage: 'no'
- cakephp-version: '4.4.*'
php-version: '7.4'
db-type: 'mysql:5.7'
prefer-lowest: 'prefer-lowest'
coverage: 'no'
- cakephp-version: '4.4.*'
php-version: '8.2'
db-type: 'mysql'
prefer-lowest: ''
coverage: 'no'
- php-version: '8.2'
cakephp-version: '4.5.*'
db-type: 'mysql'
prefer-lowest: ''
coverage: 'coverage'
steps:
- name: Setup MySQL latest
if: matrix.db-type == 'mysql'
run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp_test -p 3306:3306 -d mysql --default-authentication-plugin=mysql_native_password --disable-log-bin
- name: Setup MySQL 5.7
if: matrix.db-type == 'mysql:5.7'
run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp_test -p 3306:3306 -d mysql:5.7 --character-set-server=utf8 --default-authentication-plugin=mysql_native_password --disable-log-bin
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl, apcu, sqlite, pdo_mysql pdo_sqlite
ini-values: apc.enable_cli = 1
coverage: xdebug
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Get date part for cache key
id: key-date
run: echo "::set-output name=date::$(date +'%Y-%m')"
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
- name: Install packages
run: |
sudo locale-gen da_DK.UTF-8
sudo locale-gen de_DE.UTF-8
- name: Change CakePHP version
run: |
composer require cakephp/cakephp:${{ matrix.cakephp-version }}
- name: Composer install
run: |
if [[ ${{ matrix.php-version }} == '8.1' ]]; then
composer update --ignore-platform-reqs
elif ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
composer update --prefer-lowest --prefer-stable
else
composer update
fi
- name: Setup problem matchers for PHPUnit
if: matrix.php-version == '7.4' && matrix.db-type == 'mysql'
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Run PHPUnit
env:
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
MEMCACHED_PORT: ${{ job.services.memcached.ports['11211'] }}
run: |
if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_URL='sqlite:///:memory:'; fi
if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DB_DSN='mysql://root:root@127.0.0.1/cakephp_test?encoding=utf8mb4&init[]=SET sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"'; fi
if [[ ${{ matrix.db-type }} == 'mysql:5.7' ]]; then export DB_DSN='mysql://root:root@127.0.0.1/cakephp_test?encoding=utf8mb4&init[]=SET sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"'; fi
if [[ ${{ matrix.coverage }} == 'coverage' ]]; then
export CODECOVERAGE=1 && vendor/bin/phpunit --stderr --verbose --coverage-clover=coverage.xml
else
vendor/bin/phpunit --stderr
fi
- name: Submit code coverage
if: matrix.coverage == 'coverage'
uses: codecov/codecov-action@v3
cs-stan:
name: Coding Standard & Static Analysis
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, intl, apcu
coverage: none
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Get date part for cache key
id: key-date
run: echo "::set-output name=date::$(date +'%Y-%m')"
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
- name: Get CodeSniffer
run: composer require cakephp/cakephp-codesniffer:^4.0
#
# - name: composer install
# run: composer stan-setup
- name: Run PHP CodeSniffer
run: vendor/bin/phpcs --report=checkstyle -p .
#
# - name: Run psalm
# if: success() || failure()
# run: vendor/bin/psalm.phar --output-format=github
#
# - name: Run phpstan
# if: success() || failure()
# run: vendor/bin/phpstan.phar analyse --error-format=github