forked from datastax/php-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from qkdreyer/master
feat: add php 8.1 support
- Loading branch information
Showing
107 changed files
with
1,189 additions
and
866 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
**/.git | ||
Dockerfile | ||
Makefile | ||
ext/configure.ac | ||
.github | ||
bin | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: build | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
env: | ||
BUILDKIT_PROGRESS: plain | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
- run: make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,9 @@ | ||
language: php | ||
dist: trusty | ||
sudo: true | ||
addons: | ||
apt: | ||
packages: | ||
- libssl-dev | ||
- oracle-java8-installer | ||
cache: | ||
ccache: true | ||
directories: | ||
- ${HOME}/dependencies | ||
php: | ||
- 5.6 | ||
- 7.0 | ||
- 7.1 | ||
- 7.2 | ||
- 7.3 | ||
|
||
dist: xenial | ||
services: | ||
- docker | ||
env: | ||
global: | ||
# Configure the .phpt tests to be Travis friendly | ||
- REPORT_EXIT_STATUS=1 | ||
- TEST_PHP_ARGS="-q -s output.txt -g XFAIL,FAIL,BORK,WARN,LEAK,SKIP -x --show-diff" | ||
# Add the pip installation folder to the PATH, until https://github.com/travis-ci/travis-ci/issues/3563 is fixed | ||
- PATH=${HOME}/.local/bin:${PATH} | ||
# Indicate the cached dependencies directory | ||
- CACHED_DEPENDENCIES_DIRECTORY=${HOME}/dependencies | ||
# Add libuv source build for container based TravisCI | ||
- LIBUV_VERSION=1.14.1 | ||
- LIBUV_ROOT_DIR=${CACHED_DEPENDENCIES_DIRECTORY}/libuv/${LIBUV_VERSION} | ||
- PHP_DRIVER_BUILD_DIRECTORY=/tmp/php-driver/build | ||
- CPP_DRIVER_SOURCE_DIRECTORY=${TRAVIS_BUILD_DIR}/lib/cpp-driver | ||
- CPP_DRIVER_BUILD_DIRECTORY=${PHP_DRIVER_BUILD_DIRECTORY}/cpp-driver | ||
- CPP_DRIVER_INSTALL_DIRECTORY=${CACHED_DEPENDENCIES_DIRECTORY}/cpp-driver | ||
|
||
before_install: | ||
# Configure, build, install (or used cached libuv) | ||
- if [ ! -d "${LIBUV_ROOT_DIR}" ]; then | ||
pushd /tmp; | ||
wget -q http://dist.libuv.org/dist/v${LIBUV_VERSION}/libuv-v${LIBUV_VERSION}.tar.gz; | ||
tar xzf libuv-v${LIBUV_VERSION}.tar.gz; | ||
pushd /tmp/libuv-v${LIBUV_VERSION}; | ||
sh autogen.sh; | ||
./configure --prefix=${LIBUV_ROOT_DIR}; | ||
make -j$(nproc) install; | ||
popd; | ||
popd; | ||
else echo "Using Cached libuv v${LIBUV_VERSION}. Dependency does not need to be re-compiled"; | ||
fi | ||
### Build and configure the PHP driver extension ### | ||
- mkdir -p ${PHP_DRIVER_BUILD_DIRECTORY} | ||
# Determine the version number for the C/C++ driver dependency | ||
- export CPP_DRIVER_VERSION_MAJOR=$(grep CASS_VERSION_MAJOR ${CPP_DRIVER_SOURCE_DIRECTORY}/include/cassandra.h | sed 's/[^0-9]*//g') | ||
- export CPP_DRIVER_VERSION_MINOR=$(grep CASS_VERSION_MINOR ${CPP_DRIVER_SOURCE_DIRECTORY}/include/cassandra.h | sed 's/[^0-9]*//g') | ||
- export CPP_DRIVER_VERSION_PATCH=$(grep CASS_VERSION_PATCH ${CPP_DRIVER_SOURCE_DIRECTORY}/include/cassandra.h | sed 's/[^0-9]*//g') | ||
- export CPP_DRIVER_VERSION=${CPP_DRIVER_VERSION_MAJOR}.${CPP_DRIVER_VERSION_MINOR}.${CPP_DRIVER_VERSION_PATCH} | ||
- pushd lib/cpp-driver; export CPP_DRIVER_VERSION_SHA=$(git rev-parse --short HEAD); popd | ||
# Build the C/C++ driver dependency (or used cached C/C++ driver) | ||
- if [ ! -d "${CPP_DRIVER_INSTALL_DIRECTORY}/${CPP_DRIVER_VERSION}/${CPP_DRIVER_VERSION_SHA}" ]; then | ||
mkdir -p ${CPP_DRIVER_BUILD_DIRECTORY}; | ||
pushd ${CPP_DRIVER_BUILD_DIRECTORY}; | ||
cmake -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_INSTALL_PREFIX:PATH=${CPP_DRIVER_INSTALL_DIRECTORY}/${CPP_DRIVER_VERSION}/${CPP_DRIVER_VERSION_SHA} -DCASS_BUILD_STATIC=ON -DCASS_BUILD_SHARED=OFF -DCMAKE_BUILD_TYPE=RELEASE -DCASS_USE_ZLIB=ON ${CPP_DRIVER_SOURCE_DIRECTORY}; | ||
make -j$(nproc) install; | ||
pushd ${CPP_DRIVER_INSTALL_DIRECTORY}/${CPP_DRIVER_VERSION}/${CPP_DRIVER_VERSION_SHA}/lib; | ||
rm -f libcassandra.{dylib,so}; | ||
mv libcassandra_static.a libcassandra.a; | ||
popd; | ||
popd; | ||
else echo "Using Cached C/C++ driver v${CPP_DRIVER_VERSION}-${CPP_DRIVER_VERSION_SHA}. Dependency does not need to be re-compiled"; | ||
fi | ||
# PHPize the extension for configuration and building | ||
- pushd ${TRAVIS_BUILD_DIR}/ext && phpize && popd | ||
# Configure, build, and install the extension | ||
- pushd ${PHP_DRIVER_BUILD_DIRECTORY} | ||
- LIBS="-lssl -lz -luv -lm -lstdc++" LDFLAGS="-L${CPP_DRIVER_INSTALL_DIRECTORY}/${CPP_DRIVER_VERSION}/${CPP_DRIVER_VERSION_SHA}/lib -L${LIBUV_ROOT_DIR}/lib" ${TRAVIS_BUILD_DIR}/ext/configure --with-cassandra=${CPP_DRIVER_INSTALL_DIRECTORY}/${CPP_DRIVER_VERSION}/${CPP_DRIVER_VERSION_SHA} --with-uv=${LIBUV_ROOT_DIR} | ||
- make -j$(nproc) install | ||
- popd | ||
# Enable the extension | ||
- echo "extension=cassandra.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` | ||
### Install CCM for Behat testing ### | ||
- pip install --user ccm | ||
|
||
before_script: | ||
# Install composer dependencies | ||
- composer self-update | ||
- composer install -n | ||
# Use the BEHAT_EXTRA_OPTIONS to supply options to Behat runs | ||
- BEHAT_EXTRA_OPTIONS= | ||
# Use the BEHAT_SKIP_TAGS to skip tests on TravisCI | ||
- BEHAT_SKIP_TAGS=~@skip-ci | ||
- export BEHAT_EXTRA_OPTIONS BEHAT_SKIP_TAGS | ||
# Switch to Java 8 for non-java projects | ||
- if [ $(uname -a | grep x86_64 >/dev/null) ]; then | ||
ARCH_SUFFIX=amd64; | ||
else ARCH_SUFFIX=i386; | ||
fi | ||
- if [ -d "/usr/lib/jvm/java-8-oracle-$ARCH_SUFFIX" ]; then | ||
export JAVA_HOME="/usr/lib/jvm/java-8-oracle-$ARCH_SUFFIX"; | ||
else export JAVA_HOME="/usr/lib/jvm/java-8-oracle"; | ||
fi | ||
- export PATH=${JAVA_HOME}/bin:${PATH} | ||
|
||
- BUILDKIT_PROGRESS=plain | ||
script: | ||
# Execute .phpt tests | ||
- pushd ${PHP_DRIVER_BUILD_DIRECTORY} && make test && popd | ||
# Execute the unit tests | ||
- ./bin/phpunit --testsuite unit | ||
# Execute the Behat tests | ||
- ./bin/behat --tags="${BEHAT_SKIP_TAGS}" ${BEHAT_EXTRA_OPTIONS} | ||
- make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
FROM php:8.1 | ||
WORKDIR /tmp/cassandra-php-driver | ||
|
||
RUN apt update -y \ | ||
&& apt install python3 pip cmake unzip mlocate build-essential git libuv1-dev libssl-dev libgmp-dev openssl zlib1g-dev libpcre3-dev openjdk-11-jre openjdk-11-jdk -y \ | ||
&& pip install git+https://github.com/riptano/ccm.git@master | ||
|
||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin | ||
RUN docker-php-source extract \ | ||
&& install-php-extensions @composer intl zip pcntl gmp ast xdebug yaml | ||
|
||
COPY lib lib | ||
RUN cmake -DCMAKE_CXX_FLAGS="-fPIC" -DCASS_BUILD_STATIC=OFF -DCASS_BUILD_SHARED=ON -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_LIBDIR:PATH=lib -DCASS_USE_ZLIB=ON lib/cpp-driver \ | ||
&& make -j$(nproc) \ | ||
&& make install | ||
|
||
RUN docker-php-source extract | ||
|
||
COPY ext ext | ||
ENV NO_INTERACTION true | ||
RUN cd ext \ | ||
&& phpize \ | ||
&& LDFLAGS="-L/usr/local/lib" LIBS="-lssl -lz -luv -lm -lgmp -lstdc++" ./configure --with-cassandra=/usr/local \ | ||
&& make -j$(nproc) \ | ||
&& make test \ | ||
&& make install \ | ||
&& mv cassandra.ini /usr/local/etc/php/conf.d/docker-php-ext-cassandra.ini \ | ||
&& cd .. | ||
|
||
RUN ext/doc/generate_doc.sh | ||
|
||
COPY composer.json . | ||
RUN composer install -n | ||
|
||
COPY support support | ||
COPY tests tests | ||
COPY phpunit.xml . | ||
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64/ | ||
RUN bin/phpunit --stop-on-error --stop-on-failure | ||
|
||
COPY features features | ||
COPY behat.yml . | ||
RUN bin/behat --stop-on-failure --tags="~@skip-ci" | ||
|
||
RUN make clean \ | ||
&& make clean -C ext | ||
|
||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
all: build | ||
build: | ||
docker build . -t cassandra-php-driver | ||
run: | ||
docker run -v $$PWD/ext/doc:/tmp/cassandra-php-driver/ext/doc -it cassandra-php-driver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,5 @@ libtool | |
ltmain.sh | ||
missing | ||
/autom4te.cache/ | ||
ex*.php | ||
debug.ini | ||
cassandra.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/sh | ||
DIR=`dirname "$0"` | ||
php -d extension=cassandra.so -d extension_dir="$DIR/../modules" "$DIR/generate_doc.php" $DIR/.. | ||
php "$DIR/generate_doc.php" $DIR/.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.