-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.travis.yml
212 lines (202 loc) · 8.08 KB
/
.travis.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
sudo: true
cache:
directories:
- $HOME/.composer/cache
addons:
hosts:
- kafka
jobs:
allow_failures:
- name: "librdkafka master, php 7.4"
- name: "librdkafka latest osx, php 7.4"
- name: "librdkafka latest windows, php 7.4"
- name: "rdkafka ext, librdkafka v1.4.4, php 7.4"
include:
- &STANDARD_TEST_JOB
stage: Test
os: linux
dist: xenial
language: minimal
services:
- docker
env:
- LIBRDKAFKA_VERSION=v1.5.2
- PHP_VERSION=74
name: "librdkafka v1.5.2, php 7.4"
before_script:
- |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter;
chmod +x ./cc-test-reporter;
if [ "$LIBRDKAFKA_VERSION" = "v1.5.2" ]; then ./cc-test-reporter before-build; fi;
script:
- |
set -e;
docker-compose build --pull --parallel --build-arg LIBRDKAFKA_VERSION="$LIBRDKAFKA_VERSION" php$PHP_VERSION;
docker-compose up -d kafka;
sleep 10s;
docker-compose run --user $(id -u):$(id -g) --rm --no-deps -v $HOME/.composer:/tmp php74 composer update --prefer-stable --no-interaction --ignore-platform-req=php;
docker-compose run --user $(id -u):$(id -g) --rm php74 php examples/create-topic.php -ttest -p1 -r1;
docker-compose run --user $(id -u):$(id -g) --rm php74 php examples/create-topic.php -ttest_partitions -p3 -r1;
docker-compose run --user $(id -u):$(id -g) --rm -e XDEBUG_MODE=coverage php74 vendor/bin/phpunit --coverage-text --coverage-clover=clover.xml;
if [ "$LIBRDKAFKA_VERSION" = "v1.5.2" ]; then docker-compose run --user $(id -u):$(id -g) --rm php74 composer prepare-docs; fi;
if [ "$LIBRDKAFKA_VERSION" = "v1.5.2" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then docker-compose run --user $(id -u):$(id -g) --rm mkdocs build; fi;
after_script:
- |
docker-compose down;
sed -i "s|/app/|`pwd`/|g" clover.xml;
if [ "$LIBRDKAFKA_VERSION" = "v1.5.2" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi;
deploy:
- provider: pages
local_dir: site
skip_cleanup: true
github_token: $GITHUB_TOKEN
keep_history: true
target_branch: gh-pages
on:
branch: main
condition: $LIBRDKAFKA_VERSION = "v1.5.2"
- <<: *STANDARD_TEST_JOB
env:
- LIBRDKAFKA_VERSION=v1.5.2
- PHP_VERSION=80
name: "librdkafka v1.5.2, php 8.0"
- <<: *STANDARD_TEST_JOB
env:
- LIBRDKAFKA_VERSION=v1.4.4
- PHP_VERSION=74
name: "librdkafka v1.4.4, php 7.4"
- <<: *STANDARD_TEST_JOB
env:
- LIBRDKAFKA_VERSION=v1.3.0
- PHP_VERSION=74
name: "librdkafka v1.3.0, php 7.4"
- <<: *STANDARD_TEST_JOB
env:
- LIBRDKAFKA_VERSION=v1.2.2
- PHP_VERSION=74
name: "librdkafka v1.2.2, php 7.4"
- <<: *STANDARD_TEST_JOB
env:
- LIBRDKAFKA_VERSION=v1.1.0
- PHP_VERSION=74
name: "librdkafka v1.1.0, php 7.4"
- <<: *STANDARD_TEST_JOB
env:
- LIBRDKAFKA_VERSION=v1.0.1
- PHP_VERSION=74
name: "librdkafka v1.0.1, php 7.4"
- <<: *STANDARD_TEST_JOB
env:
- LIBRDKAFKA_VERSION=master
- PHP_VERSION=74
name: "librdkafka master, php 7.4"
- env:
- LIBRDKAFKA_VERSION=v1.4.4
- PHP_VERSION=74
stage: Test
name: "rdkafka ext, librdkafka v1.4.4"
os: linux
dist: xenial
language: minimal
services:
- docker
script:
- |
set -e;
docker-compose build --pull --parallel --build-arg LIBRDKAFKA_VERSION="$LIBRDKAFKA_VERSION" php$PHP_VERSION;
docker-compose up -d kafka;
sleep 10s;
docker-compose run --user $(id -u):$(id -g) --rm --no-deps -v $HOME/.composer:/tmp/ php74 composer update -d /app/resources/test-extension --ignore-platform-reqs;
docker-compose exec kafka sh -c '/usr/bin/kafka-topics --create --bootstrap-server localhost:9092 --topic test --partitions 1 --replication-factor 1';
docker-compose exec kafka sh -c '/usr/bin/kafka-topics --create --bootstrap-server localhost:9092 --topic test_partitions --partitions 3 --replication-factor 1';
docker-compose run --user $(id -u):$(id -g) --rm php74 php -dextension=rdkafka.so resources/test-extension/vendor/bin/phpunit -c resources/test-extension/phpunit.xml;
after_script:
- |
docker-compose down;
- env: KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092
stage: Test
name: "librdkafka latest osx, php 7.4"
os: osx
osx_image: xcode12
cache:
directories:
- $HOME/Library/Caches/Homebrew
- /usr/local/Homebrew
before_cache:
- brew cleanup
before_script:
- php -v
- brew install [email protected]
- brew install composer librdkafka kafka
- brew link --overwrite --force [email protected]
- export PATH="/usr/local/opt/[email protected]/bin:$PATH" >> /Users/travis/.bash_profile
- source /Users/travis/.bash_profile
- php -v
script:
- |
set -e;
zookeeper-server-start -daemon /usr/local/etc/kafka/zookeeper.properties;
kafka-server-start -daemon /usr/local/etc/kafka/server.properties --override broker.id=111 --override advertised.listeners=PLAINTEXT://kafka:9092;
sleep 10s;
composer update --prefer-stable --no-interaction;
php examples/create-topic.php -ttest -p1 -r1;
php examples/create-topic.php -ttest_partitions -p3 -r1;
php vendor/bin/phpunit --verbose --colors;
after_script:
- |
kafka-server-stop;
zookeeper-server-stop;
find /usr/local/Homebrew \! -regex ".+\.git.+" -delete;
- env: KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092
stage: Test
name: "librdkafka latest windows, php 7.4"
os: windows
language: bash
before_script:
- |
choco upgrade curl;
choco install php --version 7.4.13 --package-parameters='"/InstallDir:C:\PHP"';
sed -i 's/;extension=ffi/extension=ffi/g' /c/PHP/php.ini;
export PATH=/c/PHP:$PATH;
php -i;
- |
choco install composer;
export PATH=/c/ProgramData/ComposerSetup/bin:$PATH;
composer --version;
- |
choco install nuget.commandline;
nuget install librdkafka.redist -Version 1.5.2;
export PATH=$PWD/librdkafka.redist.1.5.2/runtimes/win-x64/native:$PATH;
- |
choco install adoptopenjdk8 --version 8.275.1;
export JAVA_HOME=/c/Program\ Files/AdoptOpenJDK/jdk-8.0.275.1-hotspot;
wget -O kafka_2.13-2.6.0.tgz http://ftp.fau.de/apache/kafka/2.6.0/kafka_2.13-2.6.0.tgz;
tar -xzf kafka_2.13-2.6.0.tgz;
cp -pr kafka_2.13-2.6.0 /c/kafka;
sed -i "s|broker.id=0|broker.id=111|g" /c/kafka/config/server.properties;
cat /c/kafka/config/server.properties;
- |
choco install nssm;
nssm install zookeeper /c/kafka/bin/windows/zookeeper-server-start.bat /c/kafka/config/zookeeper.properties;
nssm set zookeeper AppExit Default Exit;
nssm install kafka /c/kafka/bin/windows/kafka-server-start.bat /c/kafka/config/server.properties;
nssm set kafka AppExit Default Exit;
printenv;
script:
- |
nssm start zookeeper;
nssm status zookeeper;
nssm start kafka;
nssm status kafka;
sleep 10s;
- |
composer update --prefer-stable --no-interaction --ignore-platform-reqs;
php examples/create-topic.php -ttest -p1 -r1 -b127.0.0.1:9092;
php examples/create-topic.php -ttest_partitions -p3 -r1 -b127.0.0.1:9092;
- |
export KAFKA_BROKERS=127.0.0.1:9092
vendor/bin/phpunit --verbose --debug;
after_script:
- |
nssm stop kafka;
nssm stop zookeeper;