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 48ee3a9

Browse files
committed
feat: add php 8.1 support
1 parent 9495c13 commit 48ee3a9

File tree

100 files changed

+941
-5208
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+941
-5208
lines changed

‎.devcontainer/devcontainer.json

Lines changed: 0 additions & 32 deletions
This file was deleted.

‎.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**/.git
2+
Dockerfile
3+
Makefile
4+
ext/configure.ac
5+
.github
6+
bin
7+
vendor

‎.github/workflows/build.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: build
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
env:
8+
BUILDKIT_PROGRESS: plain
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
submodules: true
16+
- run: make

‎.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
/vendor/
88
/venv/
99

10+
1011
# Files to ignore
1112
/cassandra.log
13+
/composer.phar
14+
/composer.lock
1215
/tmp/*
13-
*.ac
14-
.phpunit.result.cache

‎.travis.yml

Lines changed: 5 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,9 @@
11
language: php
2-
dist: trusty
3-
sudo: true
4-
addons:
5-
apt:
6-
packages:
7-
- libssl-dev
8-
- oracle-java8-installer
9-
cache:
10-
ccache: true
11-
directories:
12-
- ${HOME}/dependencies
13-
php:
14-
- 5.6
15-
- 7.0
16-
- 7.1
17-
- 7.2
18-
- 7.3
19-
2+
dist: xenial
3+
services:
4+
- docker
205
env:
216
global:
22-
# Configure the .phpt tests to be Travis friendly
23-
- REPORT_EXIT_STATUS=1
24-
- TEST_PHP_ARGS="-q -s output.txt -g XFAIL,FAIL,BORK,WARN,LEAK,SKIP -x --show-diff"
25-
# Add the pip installation folder to the PATH, until https://github.com/travis-ci/travis-ci/issues/3563 is fixed
26-
- PATH=${HOME}/.local/bin:${PATH}
27-
# Indicate the cached dependencies directory
28-
- CACHED_DEPENDENCIES_DIRECTORY=${HOME}/dependencies
29-
# Add libuv source build for container based TravisCI
30-
- LIBUV_VERSION=1.14.1
31-
- LIBUV_ROOT_DIR=${CACHED_DEPENDENCIES_DIRECTORY}/libuv/${LIBUV_VERSION}
32-
- PHP_DRIVER_BUILD_DIRECTORY=/tmp/php-driver/build
33-
- CPP_DRIVER_SOURCE_DIRECTORY=${TRAVIS_BUILD_DIR}/lib/cpp-driver
34-
- CPP_DRIVER_BUILD_DIRECTORY=${PHP_DRIVER_BUILD_DIRECTORY}/cpp-driver
35-
- CPP_DRIVER_INSTALL_DIRECTORY=${CACHED_DEPENDENCIES_DIRECTORY}/cpp-driver
36-
37-
before_install:
38-
# Configure, build, install (or used cached libuv)
39-
- if [ ! -d "${LIBUV_ROOT_DIR}" ]; then
40-
pushd /tmp;
41-
wget -q http://dist.libuv.org/dist/v${LIBUV_VERSION}/libuv-v${LIBUV_VERSION}.tar.gz;
42-
tar xzf libuv-v${LIBUV_VERSION}.tar.gz;
43-
pushd /tmp/libuv-v${LIBUV_VERSION};
44-
sh autogen.sh;
45-
./configure --prefix=${LIBUV_ROOT_DIR};
46-
make -j$(nproc) install;
47-
popd;
48-
popd;
49-
else echo "Using Cached libuv v${LIBUV_VERSION}. Dependency does not need to be re-compiled";
50-
fi
51-
### Build and configure the PHP driver extension ###
52-
- mkdir -p ${PHP_DRIVER_BUILD_DIRECTORY}
53-
# Determine the version number for the C/C++ driver dependency
54-
- export CPP_DRIVER_VERSION_MAJOR=$(grep CASS_VERSION_MAJOR ${CPP_DRIVER_SOURCE_DIRECTORY}/include/cassandra.h | sed 's/[^0-9]*//g')
55-
- export CPP_DRIVER_VERSION_MINOR=$(grep CASS_VERSION_MINOR ${CPP_DRIVER_SOURCE_DIRECTORY}/include/cassandra.h | sed 's/[^0-9]*//g')
56-
- export CPP_DRIVER_VERSION_PATCH=$(grep CASS_VERSION_PATCH ${CPP_DRIVER_SOURCE_DIRECTORY}/include/cassandra.h | sed 's/[^0-9]*//g')
57-
- export CPP_DRIVER_VERSION=${CPP_DRIVER_VERSION_MAJOR}.${CPP_DRIVER_VERSION_MINOR}.${CPP_DRIVER_VERSION_PATCH}
58-
- pushd lib/cpp-driver; export CPP_DRIVER_VERSION_SHA=$(git rev-parse --short HEAD); popd
59-
# Build the C/C++ driver dependency (or used cached C/C++ driver)
60-
- if [ ! -d "${CPP_DRIVER_INSTALL_DIRECTORY}/${CPP_DRIVER_VERSION}/${CPP_DRIVER_VERSION_SHA}" ]; then
61-
mkdir -p ${CPP_DRIVER_BUILD_DIRECTORY};
62-
pushd ${CPP_DRIVER_BUILD_DIRECTORY};
63-
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};
64-
make -j$(nproc) install;
65-
pushd ${CPP_DRIVER_INSTALL_DIRECTORY}/${CPP_DRIVER_VERSION}/${CPP_DRIVER_VERSION_SHA}/lib;
66-
rm -f libcassandra.{dylib,so};
67-
mv libcassandra_static.a libcassandra.a;
68-
popd;
69-
popd;
70-
else echo "Using Cached C/C++ driver v${CPP_DRIVER_VERSION}-${CPP_DRIVER_VERSION_SHA}. Dependency does not need to be re-compiled";
71-
fi
72-
# PHPize the extension for configuration and building
73-
- pushd ${TRAVIS_BUILD_DIR}/ext && phpize && popd
74-
# Configure, build, and install the extension
75-
- pushd ${PHP_DRIVER_BUILD_DIRECTORY}
76-
- 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}
77-
- make -j$(nproc) install
78-
- popd
79-
# Enable the extension
80-
- echo "extension=cassandra.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
81-
### Install CCM for Behat testing ###
82-
- pip install --user ccm
83-
84-
before_script:
85-
# Install composer dependencies
86-
- composer self-update
87-
- composer install -n
88-
# Use the BEHAT_EXTRA_OPTIONS to supply options to Behat runs
89-
- BEHAT_EXTRA_OPTIONS=
90-
# Use the BEHAT_SKIP_TAGS to skip tests on TravisCI
91-
- BEHAT_SKIP_TAGS=~@skip-ci
92-
- export BEHAT_EXTRA_OPTIONS BEHAT_SKIP_TAGS
93-
# Switch to Java 8 for non-java projects
94-
- if [ $(uname -a | grep x86_64 >/dev/null) ]; then
95-
ARCH_SUFFIX=amd64;
96-
else ARCH_SUFFIX=i386;
97-
fi
98-
- if [ -d "/usr/lib/jvm/java-8-oracle-$ARCH_SUFFIX" ]; then
99-
export JAVA_HOME="/usr/lib/jvm/java-8-oracle-$ARCH_SUFFIX";
100-
else export JAVA_HOME="/usr/lib/jvm/java-8-oracle";
101-
fi
102-
- export PATH=${JAVA_HOME}/bin:${PATH}
103-
7+
- BUILDKIT_PROGRESS=plain
1048
script:
105-
# Execute .phpt tests
106-
- pushd ${PHP_DRIVER_BUILD_DIRECTORY} && make test && popd
107-
# Execute the unit tests
108-
- ./bin/phpunit --testsuite unit
109-
# Execute the Behat tests
110-
- ./bin/behat --tags="${BEHAT_SKIP_TAGS}" ${BEHAT_EXTRA_OPTIONS}
9+
- make

‎.vscode/c_cpp_properties.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

‎.vscode/settings.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎.vscode/tasks.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎Dockerfile

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,48 @@
1-
FROM php:8.0
1+
FROM php:8.1
2+
WORKDIR /tmp/cassandra-php-driver
23

3-
ENV EXT_CASSANDRA_VERSION=master
4-
5-
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
6-
php composer-setup.php && php -r "unlink('composer-setup.php');" \
7-
mv composer.phar /bin/composer
4+
RUN apt update -y \
5+
&& 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 \
6+
&& pip install git+git://github.com/riptano/ccm.git@master
87

98
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin
10-
119
RUN docker-php-source extract \
12-
&& apt update -y \
13-
&& apt install python3 pip cmake unzip mlocate build-essential git libuv1-dev libssl-dev libgmp-dev openssl zlib1g-dev libpcre3-dev -y \
14-
&& git clone --branch $EXT_CASSANDRA_VERSION --depth 1 https://github.com/nano-interactive/php-driver.git /usr/src/php/ext/cassandra \
15-
&& cd /usr/src/php/ext/cassandra && git submodule update --init \
16-
&& mkdir -p /usr/src/php/ext/cassandra/lib/cpp-driver/build \
17-
&& 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 /usr/src/php/ext/cassandra/lib/cpp-driver \
18-
&& make -j8 \
19-
&& make install \
20-
&& install-php-extensions intl zip pcntl gmp ast xdebug
21-
22-
RUN cd /usr/src/php/ext/cassandra/ext \
23-
&& phpize \
24-
&& LDFLAGS="-L/usr/local/lib" LIBS="-lssl -lz -luv -lm -lgmp -lstdc++" ./configure --with-cassandra=/usr/local \
25-
&& make -j8 && make install && updatedb && pip install ccm
10+
&& install-php-extensions @composer intl zip pcntl gmp ast xdebug yaml
11+
12+
COPY lib lib
13+
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 \
14+
&& make -j$(nproc) \
15+
&& make install
16+
17+
RUN docker-php-source extract
18+
19+
COPY ext ext
20+
ENV NO_INTERACTION true
21+
RUN cd ext \
22+
&& phpize \
23+
&& LDFLAGS="-L/usr/local/lib" LIBS="-lssl -lz -luv -lm -lgmp -lstdc++" ./configure --with-cassandra=/usr/local \
24+
&& make -j$(nproc) \
25+
&& make test \
26+
&& make install \
27+
&& mv cassandra.ini /usr/local/etc/php/conf.d/docker-php-ext-cassandra.ini \
28+
&& cd ..
29+
30+
RUN ext/doc/generate_doc.sh
31+
32+
COPY composer.json .
33+
RUN composer install -n
34+
35+
COPY support support
36+
COPY tests tests
37+
COPY phpunit.xml .
38+
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64/
39+
RUN bin/phpunit --stop-on-error --stop-on-failure
40+
41+
COPY features features
42+
COPY behat.yml .
43+
RUN bin/behat --stop-on-failure --tags="~@skip-ci"
2644

45+
RUN make clean \
46+
&& make clean -C ext
2747

2848
CMD ["bash"]

‎Makefile

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
1-
LDFLAGS ?= -L/usr/local/lib
2-
LIBS ?= -lssl -lz -luv -lm -lgmp -lstdc++
3-
4-
all: build copy
5-
6-
.PHONY: build
1+
all: build
72
build:
8-
cd ext && phpize
9-
cd ext && ./configure --with-cassandra=/usr/local
10-
cd ext && make -j8
11-
cd ext && make install
12-
13-
config:
14-
cp ./ext/cassandra.ini /usr/local/etc/php/conf.d/cassandra.ini
15-
16-
clean:
17-
cd ext && $(MAKE) clean
3+
docker build . -t cassandra-php-driver
4+
run:
5+
docker run -v $$PWD/ext/doc:/tmp/cassandra-php-driver/ext/doc -it cassandra-php-driver

0 commit comments

Comments
(0)

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