Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c0bf432

Browse files
ArunTejChmpenick
authored andcommitted
PHP-204: update build.yaml to include a connection test
1 parent 5fea7d8 commit c0bf432

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

‎build.yaml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ schedules:
66
architecture:
77
- x64
88
os:
9-
- ubuntu/trusty64/cpp
9+
- ubuntu/trusty64/cpp-php
1010
- ubuntu/xenial64
1111
- centos/6-64
1212
- centos/7-64
@@ -102,7 +102,31 @@ release:
102102
find build -type f -name "*.${PACKAGE_TYPE}" -exec mv {} packages \;
103103
rm -rf build
104104
PHP_TOKENS=($(echo ${PHP_VERSION} | tr "-" " "))
105-
sudo ${PACKAGE_UTILITY_REMOVE} ${PHP_TOKENS[0]}-common
105+
106+
# Installing packaging and testing connection
107+
sudo ${PACKAGE_INSTALL} packages/${PHP_TOKENS[0]}*.${PACKAGE_TYPE}
108+
109+
# Checking if cassandra php module is installed
110+
php -m | grep -q cassandra
111+
if [ $? -ne 0 ] ; then
112+
echo "cassandra php module not installed. Marking build as failure"
113+
exit 1
114+
fi
115+
PROGRAM_OUTPUT=$(php <<EOF
116+
<?php
117+
try{
118+
Cassandra::cluster()->build()->connect();
119+
} catch (Cassandra\\Exception\\RuntimeException \$e) {
120+
echo 'Success'.PHP_EOL."";
121+
}
122+
EOF
123+
)
124+
# Throw error if connection test fails
125+
if [ $PROGRAM_OUTPUT != "Success" ]; then
126+
echo "Connection test failed. Marking build as failure."
127+
exit 1
128+
fi
129+
sudo ${PACKAGE_UTILITY_REMOVE} ${PHP_TOKENS[0]}-common "${PHP_TOKENS[0]}-cassandra*"
106130
done
107131
pushd packages
108132
# Uploading driver packages

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /