-
Notifications
You must be signed in to change notification settings - Fork 331
feat(php): implement initial version of PHP SDK #3235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
59440d9
Add PHP SDK coverage for Apache Iggy
countradooku 0311699
Make foreign SDK test servers reachable in Compose
countradooku aec2983
Update .gitignore
countradooku f162f52
Reduce PHP SDK PR to reviewable blocking client
countradooku 6aabe53
Keep PHP SDK PR scoped to PHP
countradooku 64d3315
Avoid leaking PHP extension path into Iggy config
countradooku ef1f121
Merge branch 'master' into add-php-sdk
countradooku 0c1b05b
Merge branch 'master' into add-php-sdk
countradooku 9cb8224
Merge branch 'master' into add-php-sdk
countradooku e2e91ed
Address PHP adapter review feedback
countradooku 687e483
Merge branch 'master' into add-php-sdk
countradooku a64bd8c
Merge branch 'master' into add-php-sdk
countradooku 78b7171
Merge branch 'master' into add-php-sdk
countradooku 4363343
Harden PHP SDK review follow-ups
countradooku ccbc79b
Keep PHP SDK branch mergeable with current master
countradooku 2cc80e6
Install PHP test dependencies in CI
countradooku db04154
Harden the PHP SDK before exposing its public API
countradooku e585a68
Keep generated PHP stubs license-compliant
countradooku d79ce21
Merge branch 'master' into add-php-sdk
countradooku 3f6d2d4
fix(php): preserve generated stub header format
countradooku 07df956
Merge branch 'master' into add-php-sdk
countradooku 76e3436
Clarify PHP SDK support boundaries
countradooku 106c075
Merge branch 'master' into add-php-sdk
countradooku 6405b3c
Merge branch 'master' into add-php-sdk
hubcio 302ea97
Honor PHP caller intent for identifiers
countradooku 6168bb1
Merge branch 'master' into add-php-sdk
countradooku 22263c4
Merge branch 'master' into add-php-sdk
hubcio b8e1e3b
Merge branch 'master' into add-php-sdk
hubcio 67acc72
Merge branch 'master' into add-php-sdk
spetz bb7c5c3
Merge branch 'master' into add-php-sdk
hubcio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,153 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| name: php-pre-merge | ||
| description: PHP pre-merge testing github iggy actions | ||
|
|
||
| inputs: | ||
| task: | ||
| description: "Task to run (lint, test, build)" | ||
| required: true | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Install PHP build dependencies | ||
| shell: bash | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y --no-install-recommends \ | ||
| clang \ | ||
| composer \ | ||
| libclang-dev \ | ||
| libhwloc-dev \ | ||
| libssl-dev \ | ||
| php-cli \ | ||
| php-dev \ | ||
| php-mbstring \ | ||
| php-xml \ | ||
| pkg-config \ | ||
| unzip | ||
|
|
||
| echo "PHP=$(command -v php)" >> "$GITHUB_ENV" | ||
| echo "PHP_CONFIG=$(command -v php-config)" >> "$GITHUB_ENV" | ||
| php --version | ||
| php-config --version | ||
| composer --version | ||
|
|
||
| - name: Setup Rust with cache | ||
| uses: ./.github/actions/utils/setup-rust-with-cache | ||
| with: | ||
| shared-key: dev | ||
| save-cache: "false" | ||
|
|
||
| - name: Use shared Cargo target directory | ||
| shell: bash | ||
| run: echo "CARGO_TARGET_DIR=${GITHUB_WORKSPACE}/target" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Validate task | ||
| shell: bash | ||
| run: | | ||
| case "${{ inputs.task }}" in | ||
| lint|test|build) ;; | ||
| *) | ||
| echo "Unknown PHP SDK task: ${{ inputs.task }}" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| - name: Lint | ||
| if: inputs.task == 'lint' | ||
| shell: bash | ||
| run: | | ||
| php -r 'json_decode(file_get_contents("foreign/php/composer.json"), true, 512, JSON_THROW_ON_ERROR);' | ||
| cargo fmt --manifest-path foreign/php/Cargo.toml -- --check | ||
| cargo install cargo-php --locked | ||
| cargo build --manifest-path foreign/php/Cargo.toml | ||
| extension="$(find "${CARGO_TARGET_DIR}/debug" -maxdepth 1 -name 'libiggy_php.so' -print -quit)" | ||
| if [ -z "$extension" ]; then | ||
| echo "PHP extension was not produced" | ||
| exit 1 | ||
| fi | ||
| raw_stubs="$(mktemp)" | ||
| cargo php stubs "$extension" -o "$raw_stubs" | ||
| { | ||
| printf '<?php\n' | ||
| awk 'NF { print "// " $0; next } { print "//" }' ASF_LICENSE.txt | ||
| printf '\n' | ||
| tail -n +2 "$raw_stubs" | ||
| } > foreign/php/iggy-php.stubs.php | ||
| rm -f "$raw_stubs" | ||
| git diff --exit-code -- foreign/php/iggy-php.stubs.php | ||
| find foreign/php \ | ||
| -path foreign/php/vendor -prune -o \ | ||
| -name '*.php' -print0 \ | ||
| | xargs -0 -n1 php -l | ||
|
|
||
| - name: Build PHP extension | ||
| if: inputs.task == 'build' | ||
| shell: bash | ||
| run: | | ||
| cargo build --release --manifest-path foreign/php/Cargo.toml | ||
| extension="$(find "${CARGO_TARGET_DIR}/release" -maxdepth 1 -name 'libiggy_php.so' -print -quit)" | ||
| if [ -z "$extension" ]; then | ||
| echo "PHP extension was not produced" | ||
| exit 1 | ||
| fi | ||
| ls -lh "$extension" | ||
|
|
||
| - name: Build PHP extension for tests | ||
| if: inputs.task == 'test' | ||
| shell: bash | ||
| run: | | ||
| cargo build --manifest-path foreign/php/Cargo.toml | ||
|
countradooku marked this conversation as resolved.
|
||
| extension="$(find "${CARGO_TARGET_DIR}/debug" -maxdepth 1 -name 'libiggy_php.so' -print -quit)" | ||
| if [ -z "$extension" ]; then | ||
| echo "PHP extension was not produced" | ||
| exit 1 | ||
| fi | ||
| echo "PHP_IGGY_EXTENSION=$(realpath "$extension")" >> "$GITHUB_ENV" | ||
| ls -lh "$extension" | ||
|
|
||
| - name: Install PHP test dependencies | ||
| if: inputs.task == 'test' | ||
| shell: bash | ||
| working-directory: foreign/php | ||
| run: composer install --no-interaction --prefer-dist --no-progress | ||
|
|
||
|
countradooku marked this conversation as resolved.
|
||
| - name: Start Iggy server | ||
| if: inputs.task == 'test' | ||
| id: iggy | ||
| uses: ./.github/actions/utils/server-start | ||
|
|
||
| - name: Run PHP SDK tests | ||
|
countradooku marked this conversation as resolved.
|
||
| if: inputs.task == 'test' | ||
| shell: bash | ||
| working-directory: foreign/php | ||
| env: | ||
| IGGY_HOST: 127.0.0.1 | ||
| IGGY_PORT: 8090 | ||
| IGGY_USERNAME: iggy | ||
| IGGY_PASSWORD: iggy | ||
| run: ./scripts/test.sh | ||
|
|
||
| - name: Stop Iggy server | ||
| if: always() && inputs.task == 'test' | ||
| uses: ./.github/actions/utils/server-stop | ||
| with: | ||
| pid-file: ${{ steps.iggy.outputs.pid_file }} | ||
| log-file: ${{ steps.iggy.outputs.log_file }} | ||
|
countradooku marked this conversation as resolved.
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -75,6 +75,7 @@ jobs: | |
| mcp | ||
| node | ||
| partitions | ||
| php | ||
| proc | ||
| pr_template | ||
| python | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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,22 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| [target.aarch64-apple-darwin] | ||
| rustflags = ["-C", "link-arg=-Wl,-undefined,dynamic_lookup"] | ||
|
|
||
| [target.x86_64-apple-darwin] | ||
| rustflags = ["-C", "link-arg=-Wl,-undefined,dynamic_lookup"] |
This file contains hidden or 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,4 @@ | ||
| /target | ||
| /vendor | ||
| Cargo.lock | ||
| composer.lock |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.