-
Notifications
You must be signed in to change notification settings - Fork 156
148 lines (124 loc) · 4.13 KB
/
tests.yml
File metadata and controls
148 lines (124 loc) · 4.13 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Tests
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
tests-ch21:
name: PHP ${{ matrix.php }} / ClickHouse 21.9
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
services:
clickhouse:
image: clickhouse/clickhouse-server:21.9
ports:
- 8123:8123
# The clickhouse-server image ships wget but NOT curl, so the health check
# must use wget — otherwise the service container never becomes healthy and
# GitHub Actions reports "container failed to start".
options: >-
--health-cmd "wget --no-verbose --tries=1 --spider http://127.0.0.1:8123/ping || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, json
coverage: none
- name: Install dependencies
run: composer install --no-progress --prefer-dist
- name: Run tests (ClickHouse 21.9)
run: ./vendor/bin/phpunit -c phpunit-ch21.xml
env:
CLICKHOUSE_HOST: 127.0.0.1
CLICKHOUSE_PORT: 8123
tests-ch26:
name: PHP ${{ matrix.php }} / ClickHouse 26.3
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
services:
clickhouse:
image: clickhouse/clickhouse-server:26.3.3.20
ports:
- 8124:8123
env:
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
CLICKHOUSE_PASSWORD: ""
# See the CH21 service above: the image has wget but not curl.
options: >-
--health-cmd "wget --no-verbose --tries=1 --spider http://127.0.0.1:8123/ping || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, json
coverage: none
- name: Install dependencies
run: composer install --no-progress --prefer-dist
- name: Copy ClickHouse config (deprecated syntax + embedded Keeper for ON CLUSTER)
run: |
CONTAINER_ID=$(docker ps -q --filter "ancestor=clickhouse/clickhouse-server:26.3.3.20")
docker cp tests/clickhouse-latest-config/allow_deprecated.xml "$CONTAINER_ID":/etc/clickhouse-server/users.d/allow_deprecated.xml
docker cp tests/clickhouse-latest-config/keeper.xml "$CONTAINER_ID":/etc/clickhouse-server/config.d/keeper.xml
docker restart "$CONTAINER_ID"
for i in $(seq 1 30); do
if curl -fs http://127.0.0.1:8124/ping > /dev/null; then
echo "ClickHouse ready"
exit 0
fi
sleep 2
done
echo "ClickHouse failed to become ready"
docker logs "$CONTAINER_ID"
exit 1
- name: Run tests (ClickHouse 26.3)
run: ./vendor/bin/phpunit -c phpunit-ch26.xml
env:
CLICKHOUSE_HOST: 127.0.0.1
CLICKHOUSE_PORT: 8124
phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: curl, json
coverage: none
- name: Install dependencies
run: composer install --no-progress --prefer-dist
- name: Run PHPStan
run: ./vendor/bin/phpstan analyse --memory-limit=512M
phpcs:
name: Code Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: curl, json
coverage: none
- name: Install dependencies
run: composer install --no-progress --prefer-dist
- name: Run PHPCS
run: ./vendor/bin/phpcs || true