Skip to content

Commit

Permalink
Merge pull request #111 from he4rt/feat/support-pie-extensions
Browse files Browse the repository at this point in the history
feature(pie): add initial support for PIE (PHP Extension Installed) and config.m4 support
  • Loading branch information
CodeLieutenant authored Jan 26, 2025
2 parents 4399856 + 8b0b6fc commit 204b2d8
Show file tree
Hide file tree
Showing 47 changed files with 3,618 additions and 5,900 deletions.
60 changes: 38 additions & 22 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@ on:
php:
description: "PHP Version"
required: true
zts:
description: "ZTS (Zend Thread Safety)"
default: '8.4'
threading:
type: string
description: "nts or zts"
required: true
default: "nts"
ubuntu_version:
type: string
description: 'Ubuntu Version'
required: false
default: '24.04'
debug:
type: string
description: "PHP Debug -> Options [yes, no]"
default: "no"
required: false
workflow_call:
inputs:
php:
Expand All @@ -24,13 +32,13 @@ on:
type: string
description: "PHP Debug -> Options [yes, no]"
required: false
zts:
threading:
type: string
description: "ZTS (Zend Thread Safety) -> Options [yes, no]"
description: "nts or zts"
required: true
ubuntu_version:
type: string
description: "Ubuntu Version -> Options [20.04, 22.04, 24.04]"
description: "Ubuntu Version -> Options [22.04, 24.04]"
required: false
default: "24.04"
secrets:
Expand All @@ -41,7 +49,7 @@ on:

jobs:
build-docker-image:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -56,19 +64,27 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract PHP Version and ZTS
id: version
run: |
export PHP_VERSION="$(echo ${{ inputs.php }} | grep -oP '^\d+\.\d+')"
PHP_ENDING="php-$PHP_VERSION"
[[ ${{ inputs.zts }} == "yes" ]] && PHP_ENDING="$PHP_ENDING-zts"
[[ ${{ inputs.debug }} == "yes" ]] && PHP_ENDING="$PHP_ENDING-debug"
echo "php_ending=$PHP_ENDING" >> $GITHUB_ENV
- name: Build and push API
id: docker_build
if: ${{ inputs.debug != 'yes' }}
uses: docker/build-push-action@v5
with:
file: ./docker/Dockerfile
context: .
push: true
pull: true
platforms: linux/amd64
target: final
tags: "malusevd99/scylladb-php-driver:ubuntu-${{ inputs.ubuntu_version }}-${{ inputs.php }}-${{ inputs.threading }}"
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
UBUNTU_VERSION=${{ inputs.ubuntu_version }}
PHP_VERSION=${{ inputs.php }}
PHP_THREAD_MODEL=${{ inputs.threading }}
PHP_DEBUG=no
PHP_MEM_SANITIZERS=no
- name: Build and push API
if: ${{ inputs.debug == 'yes' }}
uses: docker/build-push-action@v5
with:
file: ./docker/Dockerfile
Expand All @@ -77,12 +93,12 @@ jobs:
pull: true
platforms: linux/amd64
target: final
tags: malusevd99/scylladb-php-driver:ubuntu-${{ inputs.ubuntu_version }}-${{ steps.version.outputs.php_ending }}
tags: "malusevd99/scylladb-php-driver:ubuntu-${{ inputs.ubuntu_version }}-${{ inputs.php }}-${{ inputs.threading }}-debug"
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
UBUNTU_VERSION=${{ inputs.ubuntu_version }}
PHP_VERSION=${{ inputs.php }}
PHP_ZTS=${{ inputs.zts }}
PHP_DEBUG=${{ inputs.debug }}
PHP_MEM_SANITIZERS=${{ inputs.debug }}
PHP_THREAD_MODEL=${{ inputs.threading }}
PHP_DEBUG=yes
PHP_MEM_SANITIZERS=yes
22 changes: 22 additions & 0 deletions .github/workflows/dockerhub-description.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Update Docker Hub Description
on:
push:
branches:
- v1.3.x
paths:
- README.md
- .github/workflows/dockerhub-description.yml
jobs:
description:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: malusevd99/scylladb-php-driver
short-description: ${{ github.event.repository.description }}
enable-url-completion: true
35 changes: 11 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
tag:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.tag.outputs.tag }}
prerelease: ${{ (!!steps.prerelease.outputs.is_prerelease) || false }}
Expand All @@ -30,50 +30,37 @@ jobs:
id: prerelease

build:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: ['tag']
strategy:
matrix:
php: ['8.1', '8.1-zts', '8.2', '8.2-zts', '8.3', '8.3-zts']
os: ['ubuntu-20.04', 'ubuntu-24.04']
preset: ['CICassandra', 'CIScylla']
os: ['ubuntu-22.04', 'ubuntu-24.04']
driver: ['scylladb', 'cassandra']
fail-fast: true
container: malusevd99/scylladb-php-driver:${{ matrix.os }}-php-${{ matrix.php }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Extract PHP Version and ZTS
id: name
run: |
[ "CICassandra" = "${{ matrix.preset }}" ] && echo 'extension="cassandra-${{ matrix.os }}-${{ matrix.php }}"' >> $GITHUB_ENV
[ "CIScylla" = "${{ matrix.preset }}" ] && echo 'extension="scylla-${{ matrix.os }}-${{ matrix.php }}"' >> $GITHUB_ENV

- name: Build Driver
shell: bash
run: |
cmake --preset ${{ matrix.preset }} -DPHP_SCYLLADB_VERSION=${{ needs.tag.outputs.version }} || exit 1
cd out/${{ matrix.preset }} || exit 1
ninja build || exit 1
cd ../../
mv out/${{ matrix.preset }}/cassandra.so || exit 1
sed -i "s/extension = cassandra/extension = ${{ steps.name.outputs.extension }}/g" cassandra.ini || exit 1
tar czf ${{ steps.name.outputs.extension }}.tar.gz ${{ steps.name.outputs.extension }}.so cassandra.ini
./build.sh ${{ matrix.driver }} ${{ needs.tag.outputs.version }}
tar czf ${{ matrix.os }}-php-${{ matrix.php }}-${{ matrix.driver }}.tar.gz cassandra.so cassandra.ini
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.name.outputs.extension }}
path: ${{ steps.name.outputs.extension }}.tar.gz
name: ${{ matrix.os }}-php-${{ matrix.php }}-${{ matrix.driver }}.tar.gz
path: ${{ matrix.os }}-php-${{ matrix.php }}-${{ matrix.driver }}.tar.gz
if-no-files-found: error
retention-days: 5
overwrite: true

release:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: ["build", 'tag']
steps:
- uses: actions/download-artifact@v4
Expand All @@ -86,7 +73,7 @@ jobs:
with:
make_latest: ${{ !needs.tag.outputs.prerelease }}
name: "v${{ needs.tag.outputs.version }}"
tag_name: "v${{ needs.tag.outputs.version }}"
tag_name: "v${{ needs.tag.outputs.version }}"
generate_release_notes: true
append_body: true
prerelease: ${{ needs.tag.outputs.prerelease }}
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/test-images.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
name: "Build Docker Images"
name: 'Build Docker Images'

on:
schedule:
- cron: "0 0 1,15 * *"
- cron: '0 0 1,15 * *'
workflow_call:
workflow_dispatch:

jobs:
build:
strategy:
matrix:
tag: ["8.1.29", "8.2.20", "8.3.8"]
zts: ['yes', 'no']
tag: ['8.1', '8.2', '8.3', '8.4']
threading: ['zts', 'nts']
debug: ['yes', 'no']
ubuntu_version: ["20.04", "22.04", "24.04"]
uses: "./.github/workflows/docker-image.yml"
ubuntu_version: ['22.04', '24.04']
fail-fast: false
max-parallel: 6
uses: './.github/workflows/docker-image.yml'
with:
php: ${{ matrix.tag }}
zts: ${{ matrix.zts }}
threading: ${{ matrix.threading }}
ubuntu_version: ${{ matrix.ubuntu_version }}
debug: ${{ matrix.debug }}
secrets:
Expand Down
48 changes: 33 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,45 @@ jobs:
test:
strategy:
matrix:
php: ['8.1', '8.2', '8.3', '8.1-zts', '8.2-zts', '8.3-zts']
os: ['ubuntu-20.04', 'ubuntu-24.04']
preset: ['CICassandraDebug', 'CIScyllaDebug']
php: ['8.1', '8.2', '8.3', '8.4']
threading: ['zts', 'nts']
os: ['ubuntu-22.04', 'ubuntu-24.04']
driver: ['scylladb', 'cassandra']
fail-fast: false
runs-on: ubuntu-latest
container: malusevd99/scylladb-php-driver:${{ matrix.os }}-php-${{ matrix.php }}-debug
runs-on: ubuntu-24.04
container: malusevd99/scylladb-php-driver:${{ matrix.os }}-${{ matrix.php }}-${{ matrix.threading }}-debug
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Run tests
run: |
cmake --preset ${{ matrix.preset }} || exit 1
- name: Cache Vendor
uses: actions/cache@v3
with:
path: tests/vendor
key: ${{ runner.os }}-${{ matrix.php }}-vendor-${{ hashFiles('**/composer.lock') }}

cd out/${{ matrix.preset }} || exit 1
ninja install || exit 1
cd ../../
- name: Build
run: ./scripts/build.sh ${{ matrix.driver }}

cat cassandra.ini >> "$(php-config --ini-path | xargs -I {} printf '%s/php.ini' {})" || exit 1
- name: Install PHP Dependencies
working-directory: tests
shell: bash
run: |
php -d extension=cassandra /php/bin/composer \
--ignore-platform-reqs \
--no-ansi \
--prefer-dist \
--no-interaction \
--no-progress \
install
cd tests
composer install
php ./vendor/bin/pest
- name: Run tests
working-directory: tests
shell: bash
run: |
php -d extension=cassandra ./vendor/bin/pest \
--colors=always \
--fail-on-risky \
--fail-on-warning \
--fail-on-deprecation
10 changes: 0 additions & 10 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,8 @@
"cmake.buildDirectory": "${workspaceFolder}/out/Debug",
"cmake.allowCommentsInPresetsFile": true,
"cmake.buildTask": true,
"cmake.configureEnvironment": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
"PHP_SCYLLADB_LIBUV_STATIC": "ON",
"PHP_SCYLLADB_LIBSCYLLADB_STATIC": "ON",
"CASS_CPP_STANDARD": "17",
"CASS_USE_STATIC_LIBS": "ON",
"PHP_SCYLLADB_ENABLE_SANITIZERS": "ON"
},
"cmake.configureSettings": {},
"cmake.generator": "Ninja",
"cmake.installPrefix": "${workspaceFolder}/out/Debug/install",
"cmake.loggingLevel": "debug",
"cmake.configureArgs": [],
"cmake.sourceDirectory": "${workspaceFolder}/.",
Expand Down
Loading

0 comments on commit 204b2d8

Please sign in to comment.