-
Notifications
You must be signed in to change notification settings - Fork 1.4k
PHPLARA-258 Mutualize PHP + MongoDB extension setup in CI #3562
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 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ec1c533
PHPLARA-258 mutualize PHP + MongoDB extension setup in CI
GromNaN 6bf2eca
PHPLARA-258 set driver=2 on matrix include entries
GromNaN eaeb175
PHPLARA-258 harden MongoDB startup in CI (wait for primary, timeouts)
GromNaN 8ae27e8
PHPLARA-258 address Copilot review (paginate releases, drop redundant…
GromNaN 3265574
PHPLARA-258 resolve mongodb release via GraphQL
GromNaN 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
Some comments aren't visible on the classic Files Changed page.
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,72 @@ | ||
| name: Setup PHP with MongoDB extension | ||
| description: Resolve the latest stable mongodb PHP extension for the requested major, install PHP with a cached build of that extension. | ||
|
|
||
| inputs: | ||
| php-version: | ||
| description: PHP version (e.g. 8.4) | ||
| required: true | ||
| driver: | ||
| description: Major version of the mongodb extension to install (1 or 2) | ||
| required: true | ||
| extensions: | ||
| description: Comma-separated list of extra PHP extensions to install alongside mongodb (the mongodb extension is appended automatically) | ||
| required: false | ||
| default: '' | ||
| coverage: | ||
| description: Coverage driver passed to shivammathur/setup-php (e.g. xdebug, none) | ||
| required: false | ||
| default: none | ||
| tools: | ||
| description: Tools passed to shivammathur/setup-php | ||
| required: false | ||
| default: composer | ||
|
|
||
| outputs: | ||
| extension-version: | ||
| description: Resolved mongodb extension version (e.g. 2.3.3) | ||
| value: ${{ steps.resolve.outputs.version }} | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Resolve latest mongodb extension release | ||
| id: resolve | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| DRIVER_MAJOR: ${{ inputs.driver }} | ||
| run: | | ||
| set -euo pipefail | ||
| version=$(gh api repos/mongodb/mongo-php-driver/releases \ | ||
| --jq "[.[] | select(.prerelease==false) | .tag_name | select(startswith(\"${DRIVER_MAJOR}.\"))] | .[0] // empty") | ||
| if [ -z "${version}" ]; then | ||
| echo "Could not resolve latest mongodb extension for major ${DRIVER_MAJOR}" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "Resolved mongodb-${version}" | ||
| echo "version=${version}" >> "$GITHUB_OUTPUT" | ||
| echo "spec=mongodb-${version}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Setup cache environment | ||
| id: extcache | ||
| uses: shivammathur/cache-extensions@v1 | ||
|
GromNaN marked this conversation as resolved.
|
||
| with: | ||
| php-version: ${{ inputs.php-version }} | ||
| extensions: ${{ steps.resolve.outputs.spec }} | ||
| key: extcache-php${{ inputs.php-version }}-${{ steps.resolve.outputs.spec }} | ||
|
|
||
| - name: Cache extensions | ||
| uses: actions/cache@v6 | ||
|
GromNaN marked this conversation as resolved.
|
||
| with: | ||
| path: ${{ steps.extcache.outputs.dir }} | ||
| key: ${{ steps.extcache.outputs.key }} | ||
| restore-keys: ${{ steps.extcache.outputs.key }} | ||
|
|
||
| - name: Install PHP | ||
| uses: shivammathur/setup-php@v2 | ||
|
GromNaN marked this conversation as resolved.
|
||
| with: | ||
| php-version: ${{ inputs.php-version }} | ||
| extensions: ${{ inputs.extensions != '' && format('{0},{1}', inputs.extensions, steps.resolve.outputs.spec) || steps.resolve.outputs.spec }} | ||
|
|
||
| coverage: ${{ inputs.coverage }} | ||
| tools: ${{ inputs.tools }} | ||
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
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.