forked from imiphp/imi
-
Notifications
You must be signed in to change notification settings - Fork 0
223 lines (220 loc) · 6.8 KB
/
codecov.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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: Codecov
on:
push:
paths-ignore:
- "doc/**"
- "mddoc/**"
- "res/**"
- "split-repository/**"
- "website/**"
- ".markdownlint.json"
- "README.md"
pull_request:
env:
PHP_VERSION: 8.1
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
testType: [core, swoole, components]
services:
zookeeper:
image: zookeeper:3.4
ports:
- 2181:2181
options: >-
--health-cmd="echo stat | nc localhost 2181 | grep Mode"
--health-interval=10s
--health-timeout=5s
--health-retries=3
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: root
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
postgres:
image: postgres:13
env:
POSTGRES_USER: root
POSTGRES_DB: db_imi_test
POSTGRES_PASSWORD: root
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready"
--health-interval=10s
--health-timeout=5s
--health-retries=3
rabbitmq:
image: rabbitmq:3.11-management
env:
RABBITMQ_DEFAULT_VHOST: "/"
RABBITMQ_DEFAULT_USER: "guest"
RABBITMQ_DEFAULT_PASS: "guest"
ports:
- 4369:4369
- 15672:15672
- 5672:5672
- 25672:25672
options: >-
--health-cmd="rabbitmq-diagnostics -q ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
kafka1:
image: wurstmeister/kafka:2.13-2.7.0
env:
KAFKA_BROKER_ID: 1
KAFKA_ADVERTISED_HOST_NAME: kafka1
KAFKA_ADVERTISED_PORT: 9092
KAFKA_HOST_NAME: kafka1
KAFKA_PORT: 9092
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
HOSTNAME_COMMAND: hostname -i
KAFKA_LISTENERS: PLAINTEXT://kafka1:9092
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka1:9092
KAFKA_NUM_PARTITIONS: 3
ports:
- 9092:9092
options: >-
--hostname=kafka1
--health-cmd="kafka-topics.sh --list --zookeeper zookeeper:2181"
--health-interval=10s
--health-timeout=5s
--health-retries=3
env:
TEST_TYPE: ${{ matrix.testType }}
SWOOLE_VERSION: v5.1.1
ROADRUNNER_VERSION: 2.7.*
IMI_ROADRUNNER_BINARY: ${{ github.workspace }}/rr
AMQP_SERVER_HOST: 127.0.0.1
KAFKA_BOOTSTRAP_SERVERS: kafka1:9092
SWOOLE_CONFIGURE_OPTS: >
--enable-openssl
--enable-http2
--enable-mysqlnd
--enable-sockets
--enable-swoole-json
--enable-swoole-curl
--enable-swoole-pgsql
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install libs
run: sudo apt update && sudo apt install -y libevent-dev libcurl4-openssl-dev libc-ares-dev libpq-dev postgresql-client
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: pecl
coverage: xdebug
extensions: >
apcu, bcmath, curl, openssl, mbstring, intl, json, redis, mysqli, pdo, pdo_mysql, pdo_pgsql,
sockets, zip, inotify, event
swoole-swoole/swoole-src@${{ env.SWOOLE_VERSION }}
- name: Check Version
run: |
php -v
php -m
php --ri swoole
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache vendor
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Prepare
run: |
printf "127.0.0.1\tkafka1\n" | sudo tee -a /etc/hosts
mysql -h 127.0.0.1 -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS db_imi_test;'
composer update --prefer-dist --no-progress
tests/db/install-db.sh
PGPASSWORD=root psql -h 127.0.0.1 -d db_imi_test -U root -f ./.github/pgsql.sql
src/Components/roadrunner/vendor/bin/rr get-binary -f $ROADRUNNER_VERSION
./rr -v
- name: Run test suite
id: run-test-suite
run: ./dev/test-coverage-actions.sh php $TEST_TYPE
- name: Upload coverage file
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.testType }}-coverage
path: tests/coverage.php
- name: Upload log files
if: always()
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.testType }}-logs
path: |
tests/unit/Component/logs/*.log
src/Components/*/tests/*/*/logs/*.log
src/Components/*/example/.runtime/logs/*.log
upload-coverage:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: pecl
extensions: >
bcmath, curl, openssl, mbstring, intl, json, sockets, zip, event
- name: Check Version
run: |
php -v
php -m
- name: Prepare
run: |
composer update --prefer-dist --no-progress
mkdir -p ./dev/cover
- name: Download core coverage
uses: actions/download-artifact@v3
with:
name: core-coverage
path: ./dev/cover/core-coverage.php
- name: Download swoole coverage
uses: actions/download-artifact@v3
with:
name: swoole-coverage
path: ./dev/cover/swoole-coverage.php
- name: Download components coverage
uses: actions/download-artifact@v3
with:
name: components-coverage
path: ./dev/cover/components-coverage.php
- name: Parse coverage data
run: php ./dev/merge-coverage.php clover
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: "./tests/coverage.xml"
- name: Upload coverage reports to artifact
uses: actions/upload-artifact@v3
with:
name: coverage
path: tests/coverage.xml