Skip to content

PHPLARA-258 Mutualize PHP + MongoDB extension setup in CI - #3562

Merged
GromNaN merged 5 commits into
mongodb:5.xfrom
GromNaN:PHPLARA-258
Aug 3, 2026
Merged

PHPLARA-258 Mutualize PHP + MongoDB extension setup in CI#3562
GromNaN merged 5 commits into
mongodb:5.xfrom
GromNaN:PHPLARA-258

Conversation

@GromNaN

@GromNaN GromNaN commented Jul 31, 2026

Copy link
Copy Markdown
Member
  1. Cache the mongodb extension in the PHP setup, via a shared composite action reused by all workflows.
  2. Resolve the latest release from the GitHub API (mongodb/mongo-php-driver), which also gives a stable cache key.
  3. Use until loops to wait for the MongoDB cluster to be ready, to reduce recurring startup failures.

Ref: https://jira.mongodb.org/browse/PHPLARA-258

Add a composite action .github/actions/setup-php that resolves the
latest stable mongodb PHP extension for a given driver major via the
GitHub API, then chains cache-extensions + actions/cache + setup-php.

The actions/cache step was missing in build-ci.yml, build-ci-atlas.yml
and static-analysis.yml, so the extension was recompiled on every run.
Routing all workflows through the composite action fixes that and
keeps the resolved version fresh without hardcoded env vars.
Comment thread .github/actions/setup-php/action.yml
Comment thread .github/actions/setup-php/action.yml
Comment thread .github/actions/setup-php/action.yml
@GromNaN
GromNaN marked this pull request as ready for review July 31, 2026 13:14
@GromNaN
GromNaN requested a review from a team as a code owner July 31, 2026 13:14
@GromNaN
GromNaN requested review from Copilot and paulinevos July 31, 2026 13:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors GitHub Actions CI workflows to centralize PHP + MongoDB extension installation (including extension version resolution and caching) into a reusable composite action at .github/actions/setup-php, improving CI consistency and performance.

Changes:

  • Added a composite action to resolve the latest stable mongodb PHP extension for a given major (1 or 2) and install it with caching.
  • Updated CI workflows to use the composite action and removed now-obsolete env-based extension/version configuration.
  • Improved Atlas Local readiness waiting logic and added a timeout to the replica-set bootstrap step.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.github/actions/setup-php/action.yml New composite action to resolve mongodb extension version and install/cached-build it via setup-php + cache-extensions + actions/cache.
.github/workflows/build-ci.yml Switches test matrix to use composite setup-php action and adds a timeout to replica set creation.
.github/workflows/build-ci-atlas.yml Uses composite setup-php action and adjusts Atlas Local readiness loops.
.github/workflows/static-analysis.yml Uses composite setup-php action for PHPStan runs and removes old env-based extension configuration.
.github/workflows/coding-standards.yml Uses composite setup-php action for PHPCS workflow and removes old driver env config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/coding-standards.yml
Comment thread .github/actions/setup-php/action.yml Outdated
Comment thread .github/workflows/build-ci-atlas.yml Outdated
@kevinAlbs
kevinAlbs requested review from kevinAlbs and removed request for paulinevos August 3, 2026 13:42
- php: '8.2'
laravel: 12.*
mongodb: '4.4'
driver: 2

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will remove this option when removing support for v1.x PHPLARA-255

@GromNaN
GromNaN merged commit 23a1638 into mongodb:5.x Aug 3, 2026
30 checks passed
@GromNaN
GromNaN deleted the PHPLARA-258 branch August 3, 2026 20:12
GromNaN added a commit to zigzagdev/laravel-mongodb that referenced this pull request Aug 24, 2026
* PHPLARA-258 mutualize PHP + MongoDB extension setup in CI

Add a composite action .github/actions/setup-php that resolves the
latest stable mongodb PHP extension for a given driver major via the
GitHub API, then chains cache-extensions + actions/cache + setup-php.

The actions/cache step was missing in build-ci.yml, build-ci-atlas.yml
and static-analysis.yml, so the extension was recompiled on every run.
Routing all workflows through the composite action fixes that and
keeps the resolved version fresh without hardcoded env vars.

* PHPLARA-258 set driver=2 on matrix include entries

* PHPLARA-258 harden MongoDB startup in CI (wait for primary, timeouts)

* PHPLARA-258 address Copilot review (paginate releases, drop redundant collection)

* PHPLARA-258 resolve mongodb release via GraphQL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants