-
-
Notifications
You must be signed in to change notification settings - Fork 234
172 lines (152 loc) · 4.74 KB
/
phpunits.yaml
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
name: phpunits
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
MEMCACHED_HOST: localhost
REDIS_HOST: localhost
REDIS_PORT: 6379
MEMCACHED_PORT: 11211
jobs:
units:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [8.2, 8.3]
databases: [testing, pgsql, mysql, mariadb]
caches: [array, redis, memcached, database]
locks: [redis, memcached]
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 6379:6379
memcached:
image: memcached
options: >-
--health-cmd "timeout 5 bash -c 'cat < /dev/null > /dev/udp/127.0.0.1/11211'"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 11211:11211
pgsql:
image: postgres
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: wallet
POSTGRES_DB: wallet
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 5432:5432
mysql:
image: bitnami/mysql:8.0
env:
MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
MYSQL_ROOT_PASSWORD: wallet
MYSQL_DATABASE: wallet
options: >-
--health-cmd="mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 3306:3306
mariadb:
image: mariadb:10.5
env:
MYSQL_ROOT_PASSWORD: wallet
MYSQL_DATABASE: wallet
options: >-
--health-cmd="mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 3307:3306
steps:
- name: Checkout
id: git-checkout
uses: actions/checkout@v4
- name: Setup PHP
id: php-install
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, pgsql, mysql, sqlite, redis, memcached, bcmath
coverage: pcov
env:
runner: self-hosted
- name: Validate composer.json and composer.lock
id: composer-validate
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
id: composer-dependencies
run: composer install --prefer-dist --no-progress
- name: Check codeclimate
id: codeclimate-check
run: echo "execute=${{ matrix.php-versions == '8.2' && matrix.caches == 'array' && matrix.databases == 'testing' }}" >> $GITHUB_OUTPUT
- name: Prepare codeclimate
id: codeclimate-prepare
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
if: ${{ steps.codeclimate-check.outputs.execute == 'true' }}
- name: Prepare run test suite
id: unit-prepare
run: |
mkdir build
- name: Run test suite
id: unit-run
run: |
if [[ $DB_CONNECTION == "mariadb" ]]; then
composer unit
else
composer parabench
fi
env:
WALLET_CACHE_DRIVER: ${{ matrix.caches }}
WALLET_LOCK_DRIVER: ${{ matrix.locks }}
DB_CONNECTION: ${{ matrix.databases }}
- name: Run mutation test suite
id: infect-run
run: composer infect
env:
WALLET_CACHE_DRIVER: ${{ matrix.caches }}
WALLET_LOCK_DRIVER: ${{ matrix.locks }}
DB_CONNECTION: ${{ matrix.databases }}
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
if: ${{ steps.codeclimate-check.outputs.execute == 'true' }}
- name: Send coverage
id: codeclimate-send
uses: nick-fields/retry@v3
with:
timeout_seconds: 15
max_attempts: 3
command: >-
./cc-test-reporter after-build --coverage-input-type clover --exit-code 0;
bash <(curl -s https://codecov.io/bash)
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
if: ${{ steps.codeclimate-check.outputs.execute == 'true' }}