Skip to content

Conversation

@huangdijia
Copy link
Contributor

@huangdijia huangdijia commented Feb 10, 2026

Summary

  • Use proper GitHub Actions if condition at the step level instead of using expression syntax inside shell scripts
  • Fixes CI errors when conditionally installing ParaTest for PHP 8.1

Problem

The original implementation used ${{ matrix.php }} inside the shell script:

run: |
  if [ "${{ matrix.php }}" = "8.1" ]; then
    composer require brianium/paratest:~7.3.1 --dev --no-update
  fi
  composer update -o

This caused CI failures because GitHub Actions expressions don't get properly evaluated when embedded in shell scripts.

Solution

Use GitHub Actions' if condition at the step level:

- name: Setup ParaTest for PHP 8.1
  if: ${{ matrix.php == '8.1' }}
  run: composer require brianium/paratest:~7.3.1 --dev --no-update
- name: Setup Packages
  run: composer update -o

This way the condition is evaluated by GitHub Actions before the step executes.

Test plan

  • Local lint passes
  • CI workflow runs successfully

Summary by CodeRabbit

发布说明

  • Chores
    • 在 PHP 8.1 环境下为持续集成新增条件步骤以安装并启用额外的测试工具,提升在该版本上的测试覆盖与兼容性。
    • 优化依赖安装步骤以采用更全面的更新策略,确保在各测试与代码检查流程中使用更一致的依赖版本。

Use `if: ${{ matrix.php == '8.1' }}` at the step level instead of
using `${{ matrix.php }}` inside the shell script, which doesn't get
properly evaluated.

This fixes the CI errors that occurred when trying to conditionally
install paratest for PHP 8.1.
Copilot AI review requested due to automatic review settings February 10, 2026 10:28
@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

Warning

Rate limit exceeded

@huangdijia has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 35 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

在 GitHub Actions 工作流 .github/workflows/tests.yaml 中,向 cs-fixtests 两个 job 的矩阵为 php == '8.1' 的情况下新增了名为 “Setup Pest for PHP 8.1” 的步骤(通过 composer require 安装 pest 相关包),并将部分步骤的 composer update -o 改为 composer update -o --with-all-dependencies

Changes

Cohort / File(s) Summary
CI 工作流
\.github/workflows/tests.yaml
cs-fixtests 两个 job 中各新增一个条件步骤(条件:matrix.php == '8.1'),步骤运行 composer require pestphp/pest pestphp/pest-plugin-faker phpunit/phpunit --dev。同时将 Setup Packages / Setup Dependencies 步骤中的 composer update -o 修改为 composer update -o --with-all-dependencies。无其它移除或功能更改。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 分钟

Poem

我是小兔子,跳过代码丛,
在八点一的矩阵里装入新宠,
pest 与 faker 一同到场,
测试脚步轻快蹦跶,
CI 花园再次欢腾 🐇✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning 标题提到了ParaTest安装,但实际变更主要是Pest和PHPUnit依赖的更新,以及composer命令的修改,与ParaTest无直接关系。 标题应反映主要变更内容。建议改为:'Update Pest and PHPUnit dependencies, enhance composer commands for PHP 8.1' 或类似的描述实际变更的标题。
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/paratest-workflow-syntax

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the CI workflow to conditionally install ParaTest using GitHub Actions step-level if expressions, avoiding invalid expression syntax inside shell scripts and fixing PHP 8.1 CI failures.

Changes:

  • Add a dedicated “Setup ParaTest for PHP 8.1” step guarded by if: ${{ matrix.php == '8.1' }} in the workflow jobs.
  • Keep package installation (composer update -o) as a separate, unconditional step.

tools: phpize
coverage: none
- name: Setup ParaTest for PHP 8.1
if: ${{ matrix.php == '8.1' }}
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

In the cs-fix job the matrix only includes PHP 8.1 (php: ['8.1']), so this step’s if: ${{ matrix.php == '8.1' }} condition is always true and adds unnecessary noise. Consider removing the if (or expanding the matrix if the condition is meant to support additional PHP versions later).

Suggested change
if: ${{ matrix.php == '8.1' }}

Copilot uses AI. Check for mistakes.
Comment on lines 42 to 47
- name: Setup ParaTest for PHP 8.1
if: ${{ matrix.php == '8.1' }}
run: |
composer require pestphp/pest:~2.8.0 --dev --no-update
composer require pestphp/pest-plugin-faker:~2.0 --dev --no-update
composer require brianium/paratest:~7.3.1 --dev --no-update

This comment was marked as outdated.

Comment on lines 45 to 46
composer require pestphp/pest:~2.8.0 --dev --no-update
composer require pestphp/pest-plugin-faker:~2.0 --dev --no-update

This comment was marked as outdated.

Comment on lines 87 to 92
- name: Setup ParaTest for PHP 8.1
if: ${{ matrix.php == '8.1' }}
run: |
composer require pestphp/pest:^2.35.0 --dev --no-update
composer require pestphp/pest-plugin-faker:^2.0 --dev --no-update
composer require brianium/paratest:~7.3.1 --dev --no-update

This comment was marked as outdated.

Comment on lines 42 to 47
- name: Setup ParaTest for PHP 8.1
if: ${{ matrix.php == '8.1' }}
run: |
composer require pestphp/pest:~2.8.0 --dev --no-update
composer require pestphp/pest-plugin-faker:~2.0 --dev --no-update
composer require brianium/paratest:~7.3.1 --dev --no-update

This comment was marked as outdated.

@huangdijia
Copy link
Contributor Author

@copilot fix the errors in CI

Copy link
Contributor

Copilot AI commented Feb 10, 2026

@huangdijia I've opened a new pull request, #1062, to work on those changes. Once the pull request is ready, I'll request review from you.

@huangdijia huangdijia merged commit 15d5ca9 into main Feb 10, 2026
23 checks passed
@huangdijia huangdijia deleted the fix/paratest-workflow-syntax branch February 10, 2026 11:44
huangdijia added a commit that referenced this pull request Feb 10, 2026
…1061)

* fix: use proper GitHub Actions conditional for ParaTest installation

Use `if: ${{ matrix.php == '8.1' }}` at the step level instead of
using `${{ matrix.php }}` inside the shell script, which doesn't get
properly evaluated.

This fixes the CI errors that occurred when trying to conditionally
install paratest for PHP 8.1.

* fix: update ParaTest setup to include Pest and its Faker plugin for PHP 8.1

* fix: add Pest type coverage plugin to ParaTest setup

* fix: update Pest and its plugins version in ParaTest setup for PHP 8.1

* fix: update Pest and its Faker plugin versions in ParaTest setup for PHP 8.1

* fix: update Pest and its Faker plugin versions in ParaTest setup for consistency

* fix: add ParaTest dependency to setup for consistency

* fix: update ParaTest version in workflow setup to 7.3.0

* fix: update ParaTest version in workflow setup to 7.3.0

* fix: update Pest version constraint in ParaTest setup for consistency

* fix: add PHPUnit dependency to ParaTest setup for compatibility

* fix: comment out ParaTest setup for PHP 8.1 in workflow

* fix: update ParaTest setup for PHP 8.1 to require specific Pest versions

* fix: update setup for Pest in workflow for PHP 8.1

* fix: update Pest setup in workflow to use composer require for PHP 8.1

* fix: update Pest and ParaTest setup in workflow for PHP 8.1 to require specific versions

* fix: update composer update command in workflow to remove --with-all-dependencies flag

* fix: add audit configuration to composer.json to block insecure plugins

* fix: reorder audit configuration in composer.json for clarity

* fix: comment out Pest setup for PHP 8.1 in workflow

* fix: 注释掉 PHP 8.1 的 Pest 设置以简化工作流

---------

Co-authored-by: Deeka Wong <[email protected]>
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.

2 participants