-
Notifications
You must be signed in to change notification settings - Fork 348
feat(php): wire release pipeline #3500
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
Open
countradooku
wants to merge
7
commits into
apache:master
Choose a base branch
from
countradooku:feat/php-sdk-release-pipeline
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1c87103
feat(php): wire release pipeline
rdiaconu-spec 0814756
fix(php): address release workflow review nits
countradooku 08907c3
Merge branch 'master' into feat/php-sdk-release-pipeline
countradooku 8689752
fix(php): include sdk in version bump script
countradooku 58b20cc
chore(ci): rerun checks
countradooku d88a150
fix(php): align release pipeline with review feedback
countradooku 78d8a87
fix(php): sync rust sdk dependency version
countradooku 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,193 @@ | ||
| # 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-post-merge | ||
| description: PHP post-merge GitHub release publishing with pre-built PIE extension archives | ||
|
|
||
| inputs: | ||
| version: | ||
| description: "Version for publishing" | ||
| required: true | ||
| tag: | ||
| description: "Git tag that identifies this PHP SDK release" | ||
| required: true | ||
| commit: | ||
| description: "Commit SHA being published" | ||
| required: true | ||
| dry_run: | ||
| description: "Dry run mode" | ||
| required: false | ||
| default: "false" | ||
| packages_artifact: | ||
| description: "Name of the artifact containing PHP extension archives" | ||
| required: false | ||
| default: "php-extensions-all" | ||
| packages_path: | ||
| description: "Path where PHP packages should be downloaded" | ||
| required: false | ||
| default: "dist" | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Validate version format | ||
| run: | | ||
| VERSION="${{ inputs.version }}" | ||
|
|
||
| if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$'; then | ||
| echo "Invalid PHP SDK version format: $VERSION" | ||
| echo "Expected Composer/Cargo-compatible SemVer: X.Y.Z[-prerelease][+build]" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Version format valid: $VERSION" | ||
| shell: bash | ||
|
|
||
| - name: Download pre-built PHP packages | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| name: ${{ inputs.packages_artifact }} | ||
| path: ${{ inputs.packages_path }} | ||
|
|
||
| - name: Validate downloaded PHP packages | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| PACKAGES_PATH="${{ inputs.packages_path }}" | ||
| VERSION="${{ inputs.version }}" | ||
|
|
||
| if [ ! -d "$PACKAGES_PATH" ]; then | ||
| echo "PHP packages directory not found: $PACKAGES_PATH" | ||
| exit 1 | ||
| fi | ||
|
|
||
| expected=( | ||
| "php_iggy_php-${VERSION}_php8.3-x86_64-linux-glibc-nts.zip" | ||
| "php_iggy_php-${VERSION}_php8.4-x86_64-linux-glibc-nts.zip" | ||
| "php_iggy_php-${VERSION}_php8.3-arm64-linux-glibc-nts.zip" | ||
| "php_iggy_php-${VERSION}_php8.4-arm64-linux-glibc-nts.zip" | ||
| "php_iggy_php-${VERSION}_php8.3-x86_64-linux-musl-nts.zip" | ||
| "php_iggy_php-${VERSION}_php8.4-x86_64-linux-musl-nts.zip" | ||
| "php_iggy_php-${VERSION}_php8.3-arm64-linux-musl-nts.zip" | ||
| "php_iggy_php-${VERSION}_php8.4-arm64-linux-musl-nts.zip" | ||
| "php_iggy_php-${VERSION}_php8.3-x86_64-darwin-bsdlibc-nts.zip" | ||
| "php_iggy_php-${VERSION}_php8.4-x86_64-darwin-bsdlibc-nts.zip" | ||
| "php_iggy_php-${VERSION}_php8.3-arm64-darwin-bsdlibc-nts.zip" | ||
| "php_iggy_php-${VERSION}_php8.4-arm64-darwin-bsdlibc-nts.zip" | ||
| "apache-iggy-php-${VERSION}-source.tar.gz" | ||
| ) | ||
|
|
||
| missing=0 | ||
| for filename in "${expected[@]}"; do | ||
| if [ ! -f "$PACKAGES_PATH/$filename" ]; then | ||
| echo "Missing expected package: $filename" | ||
| missing=1 | ||
| fi | ||
| done | ||
| if [ "$missing" -ne 0 ]; then | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Validating PHP extension archive contents:" | ||
| for archive in "$PACKAGES_PATH"/*.zip; do | ||
| filename="$(basename "$archive")" | ||
| echo " - $filename" | ||
| members="$(unzip -Z1 "$archive")" | ||
| for member in iggy_php.so LICENSE NOTICE LICENSE-binary; do | ||
| if ! grep -qx "$member" <<< "$members"; then | ||
| echo "Archive $filename is missing $member" | ||
| exit 1 | ||
| fi | ||
| done | ||
| done | ||
|
|
||
| echo "" | ||
| echo "Packages ready for publishing:" | ||
| find "$PACKAGES_PATH" -maxdepth 1 -type f -print | sort | while IFS= read -r file; do | ||
| size="$(du -h "$file" | cut -f1)" | ||
| echo " - $(basename "$file") ($size)" | ||
| done | ||
| shell: bash | ||
|
|
||
| - name: Display publishing information (dry run) | ||
| if: inputs.dry_run == 'true' | ||
| run: | | ||
| PACKAGES_PATH="${{ inputs.packages_path }}" | ||
| VERSION="${{ inputs.version }}" | ||
| TAG="${{ inputs.tag }}" | ||
|
|
||
| echo "DRY RUN - Would publish PHP SDK:" | ||
| echo "" | ||
| echo "Package: apache/iggy-php" | ||
| echo "Version: $VERSION" | ||
| echo "Tag: $TAG" | ||
| echo "Registry: GitHub Releases" | ||
| echo "" | ||
| echo "Release assets that would be uploaded:" | ||
| find "$PACKAGES_PATH" -maxdepth 1 -type f -print | sort | sed 's|.*/| - |' | ||
| echo "" | ||
| echo "Packagist publishing requires a split repository with composer.json at the repository root." | ||
| shell: bash | ||
|
|
||
| - name: Publish GitHub release assets | ||
| if: inputs.dry_run == 'false' | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| PACKAGES_PATH="${{ inputs.packages_path }}" | ||
| VERSION="${{ inputs.version }}" | ||
| TAG="${{ inputs.tag }}" | ||
| COMMIT="${{ inputs.commit }}" | ||
|
|
||
| if [ -z "$TAG" ]; then | ||
| echo "PHP release tag input is empty" | ||
| exit 1 | ||
| fi | ||
| if ! git ls-remote --tags --exit-code origin "refs/tags/${TAG}" >/dev/null 2>&1; then | ||
| echo "PHP release tag $TAG does not exist on origin" | ||
| echo "Create the annotated PHP SDK tag before publishing GitHub release assets." | ||
| exit 1 | ||
| fi | ||
|
|
||
| release_notes="$(mktemp)" | ||
| trap 'rm -f "$release_notes"' EXIT | ||
| { | ||
| echo "Apache Iggy PHP SDK ${VERSION}" | ||
| echo "" | ||
| echo "This GitHub release contains downstream convenience binaries for the PHP extension." | ||
| echo "The canonical Apache source release remains the ASF release artifact." | ||
| } > "$release_notes" | ||
|
|
||
| prerelease_flag=() | ||
| if [ "$(scripts/extract-version.sh sdk-php --is-pre-release)" = "true" ]; then | ||
| prerelease_flag=(--prerelease) | ||
| fi | ||
|
|
||
| if gh release view "$TAG" >/dev/null 2>&1; then | ||
| echo "GitHub release $TAG exists, uploading assets with clobber" | ||
| gh release upload "$TAG" "$PACKAGES_PATH"/* --clobber | ||
| else | ||
| echo "Creating GitHub release $TAG" | ||
| gh release create "$TAG" "$PACKAGES_PATH"/* \ | ||
| --target "$COMMIT" \ | ||
| --title "$TAG" \ | ||
| --notes-file "$release_notes" \ | ||
| "${prerelease_flag[@]}" | ||
| fi | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
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,100 @@ | ||
| # 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-setup-release-tools | ||
| description: Install release helpers and resolve the PHP SDK version | ||
|
|
||
| inputs: | ||
| version: | ||
| description: "Explicit PHP SDK version. When empty, the version is read from publish config." | ||
| required: false | ||
| default: "" | ||
|
|
||
| outputs: | ||
| version: | ||
| description: "Resolved PHP SDK version" | ||
| value: ${{ steps.version.outputs.version }} | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Setup yq | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| if command -v yq >/dev/null 2>&1; then | ||
| yq --version | ||
| exit 0 | ||
| fi | ||
|
|
||
| YQ_VERSION="v4.47.1" | ||
| case "$(uname -s)-$(uname -m)" in | ||
| Linux-x86_64) | ||
| YQ_BINARY="yq_linux_amd64" | ||
| YQ_CHECKSUM="0fb28c6680193c41b364193d0c0fc4a03177aecde51cfc04d506b1517158c2fb" | ||
| ;; | ||
| Linux-aarch64) | ||
| YQ_BINARY="yq_linux_arm64" | ||
| YQ_CHECKSUM="b7f7c991abe262b0c6f96bbcb362f8b35429cefd59c8b4c2daa4811f1e9df599" | ||
| ;; | ||
| Darwin-x86_64) | ||
| YQ_BINARY="yq_darwin_amd64" | ||
| YQ_CHECKSUM="a9b5ca36f7750576c6ace3cc7193349cd676b3a6bf30193fb2773ff45f5af5c2" | ||
| ;; | ||
| Darwin-arm64) | ||
| YQ_BINARY="yq_darwin_arm64" | ||
| YQ_CHECKSUM="99aae3a7c9ddfe76bb339f0e7acd8224324b6527436fb6a5d890079bf5fcc590" | ||
| ;; | ||
| *) | ||
| echo "Unsupported yq platform: $(uname -s)-$(uname -m)" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| yq_tmp="$(mktemp -d)" | ||
| trap 'rm -rf "$yq_tmp"' EXIT | ||
| curl -sSL -o "${yq_tmp}/${YQ_BINARY}" "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY}" | ||
| if command -v sha256sum >/dev/null 2>&1; then | ||
| echo "${YQ_CHECKSUM} ${yq_tmp}/${YQ_BINARY}" | sha256sum -c - | ||
| else | ||
| echo "${YQ_CHECKSUM} ${yq_tmp}/${YQ_BINARY}" | shasum -a 256 -c - | ||
| fi | ||
|
|
||
| mkdir -p "${RUNNER_TEMP}/yq-bin" | ||
| chmod +x "${yq_tmp}/${YQ_BINARY}" | ||
| mv "${yq_tmp}/${YQ_BINARY}" "${RUNNER_TEMP}/yq-bin/yq" | ||
| echo "${RUNNER_TEMP}/yq-bin" >> "$GITHUB_PATH" | ||
|
|
||
| - name: Resolve version | ||
| id: version | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| if [ -d "${RUNNER_TEMP}/yq-bin" ]; then | ||
| export PATH="${RUNNER_TEMP}/yq-bin:${PATH}" | ||
| fi | ||
|
|
||
| if [ -n "${{ inputs.version }}" ]; then | ||
| version="${{ inputs.version }}" | ||
| else | ||
| chmod +x scripts/extract-version.sh | ||
| version="$(scripts/extract-version.sh sdk-php)" | ||
| fi | ||
|
|
||
| echo "version=${version}" >> "$GITHUB_OUTPUT" |
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
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.