Skip to content

Conversation

@martin-georgiev
Copy link
Owner

@martin-georgiev martin-georgiev commented Oct 21, 2025

Summary by CodeRabbit

  • Chores
    • Prevent redundant CI runs on non-primary branches and group concurrent workflow jobs.
    • Add matrix-aware dependency caching across PHP/PostgreSQL/PostGIS and other build dimensions to speed builds.
    • Make test coverage opt-in per matrix entry and conditional at runtime to reduce unnecessary coverage work.
    • Simplify and standardize test CLI scripts.

@coderabbitai
Copy link

coderabbitai bot commented Oct 21, 2025

Walkthrough

Added concurrency blocks to CI workflows, introduced a matrix-driven boolean flag to conditionally enable code coverage, expanded cache keys to include matrix dimensions (PHP, DB, dependency variants), and updated Composer scripts to invoke phpunit directly while removing the top-level phpunit script.

Changes

Cohort / File(s) Summary
CI workflow concurrency
.github/workflows/ci.yml, .github/workflows/integration-tests.yml, .github/workflows/unit-tests.yml
Added concurrency blocks grouping by ${{ github.workflow }}-${{ github.ref }} and setting cancel-in-progress behavior (not cancel on main).
Matrix-driven coverage & runtime flags
.github/workflows/integration-tests.yml, .github/workflows/unit-tests.yml
Introduced matrix.calculate-code-coverage; set coverage tool to xdebug when true and none when false; test steps toggle XDEBUG_MODE=coverage or use --no-coverage; coverage upload gated on the flag.
Expanded caching keys
.github/workflows/integration-tests.yml, .github/workflows/unit-tests.yml
Expanded cache keys and restore-keys to include matrix dimensions (PHP + PostgreSQL/PostGIS for integration, PHP + Doctrine variants for unit tests) for finer-grained caching.
Composer scripts updated
composer.json
Removed top-level phpunit script; updated phpunit:unit and phpunit:integration to call phpunit --configuration=... directly (removed @phpunit wrapper).
Scrutinizer coverage prefix
.scrutinizer.yml
Prefixed unit test command with XDEBUG_MODE=coverage to collect coverage data during test execution.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant GH as GitHub Actions
    participant WF as Workflow (ci/integration/unit)
    participant Matrix as Matrix Engine
    participant Cache as Actions Cache
    participant Runner as Job Runner
    participant PHPUnit as phpunit

    note over GH,WF #E8F8F5: Trigger (push/PR)
    GH->>WF: start workflow
    WF->>Matrix: expand matrix (includes calculate-code-coverage)
    Matrix-->>WF: matrix jobs

    par for each matrix job
        WF->>Cache: compute/restore cache key (includes PHP/DB/deps)
        Cache-->>Runner: hit/miss
        WF->>Runner: run tests
        alt calculate-code-coverage = true
            Runner->>Runner: export XDEBUG_MODE=coverage
            Runner->>PHPUnit: phpunit --configuration=... (collect coverage)
            Runner->>WF: upload coverage artifact
        else calculate-code-coverage = false
            Runner->>PHPUnit: phpunit --configuration=... --no-coverage
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through CI lanes so spry,

Caches snug beneath the sky,
Matrices whisper "cover me",
Concurrency keeps runs tidy,
A rabbit cheers — builds fly high.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "ci: optimize CI workflow performance" accurately reflects the primary focus of the changeset. The majority of the changes involve optimizations to CI workflows: adding concurrency blocks to cancel redundant runs on non-main branches (reducing unnecessary compute), expanding cache keys for better granularity across PHP/PostgreSQL/PostGIS versions, and making code coverage conditional rather than always enabling xdebug. While the PR also includes updates to composer.json scripts (removing the @phpunit wrapper), these are relatively minor in scope compared to the CI workflow optimizations. The title clearly captures the main objective and is specific enough for a teammate to understand the primary change.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sloth

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3cafe33 and cf3b9bf.

📒 Files selected for processing (1)
  • .scrutinizer.yml (1 hunks)
🔇 Additional comments (1)
.scrutinizer.yml (1)

11-11: Environment variable correctly enables coverage collection.

The addition of XDEBUG_MODE=coverage aligns with the PR objective of optimizing CI workflows by enabling code coverage collection when needed. The fact that coverage is successfully reported (95.7%) in the PR confirms that the composer script is generating the coverage file at the expected path. The change is clean and follows standard practices for enabling Xdebug coverage mode.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 21, 2025
- Remove XDEBUG_MODE from composer scripts to avoid redundancy
- Update workflows to explicitly set XDEBUG_MODE=coverage when coverage is needed
- Use --no-coverage flag when xdebug is not installed to prevent warnings
- This fixes 'No code coverage driver available' warning causing CI failures
coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 21, 2025
@coveralls
Copy link

coveralls commented Oct 21, 2025

Coverage Status

coverage: 95.7%. first build
when pulling cf3b9bf on sloth
into 118bfa3 on main.

- Scrutinizer needs XDEBUG_MODE=coverage to generate coverage reports
- This aligns with the GitHub Actions workflow approach
@martin-georgiev martin-georgiev merged commit 976647b into main Oct 21, 2025
73 of 74 checks passed
@martin-georgiev martin-georgiev deleted the sloth branch October 21, 2025 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants