Skip to content

fix: CIパイプラインの全面修正#3

Merged
kackey621 merged 1 commit intomainfrom
claude/fix-moodle-plugin-ci-BhJOl
Apr 12, 2026
Merged

fix: CIパイプラインの全面修正#3
kackey621 merged 1 commit intomainfrom
claude/fix-moodle-plugin-ci-BhJOl

Conversation

@kackey621
Copy link
Copy Markdown
Owner

Summary

PR #2 でマージされたCIパイプラインが全PHPバージョン(8.0/8.1/8.2)で失敗していた根本原因を特定し、包括的に修正しました。

根本原因分析

# 原因 影響範囲
1 composer.jsonlicense フィールド欠落、非推奨 version フィールド存在 composer validate --strict が全バージョンで失敗
2 composer.lock が PHPUnit 10.5 (PHP>=8.1必須) を固定 PHP 8.0 で composer install が失敗
3 phpunit.xml.dist が PHPUnit 9 形式の <coverage> を使用 PHPUnit 10+ で deprecation 警告

修正内容

  • composer.json: license 追加、php>=8.1 明示、PHPUnit ^10.0 || ^11.0 に更新、非推奨 version 削除
  • composer.lock: バージョン管理から除外(プラグインの標準慣行)、.gitignore に追加
  • CI workflow: PHP マトリクスを 8.1/8.2/8.3/8.4 に更新、composer update に変更
  • phpunit.xml.dist: <coverage><source> に移行(PHPUnit 10+ 推奨形式)
  • テストコード: @dataProvider#[DataProvider] 属性、プロバイダを static に変更

Test plan

  • composer validate --strict → valid
  • composer update → 正常完了
  • vendor/bin/phpunit --testdox → 53 tests, 77 assertions, 0 errors, 0 deprecations
  • GitHub Actions CI → 全PHPバージョン (8.1/8.2/8.3/8.4) でグリーン

https://claude.ai/code/session_01NKu4ADGFCQfxeaQXmPTFwG

## 根本原因と修正

### 1. composer.json の strict validation 失敗を修正
- `license` フィールド追加(strict モードで必須)
- `require.php` を `>=8.1` で明示(依存関係の実態に合わせる)
- 非推奨の `version` フィールドを削除
- 存在しない `eccube/plugin-installer` を allow-plugins から削除

### 2. composer.lock による PHP バージョン不整合を解消
- composer.lock をバージョン管理から除外(プラグインの標準的慣行)
- .gitignore に追加
- CI で `composer update` を使用し各PHP環境に適した依存を解決

### 3. CI マトリクスを現行PHPバージョンに更新
- PHP 8.0 を削除(2023年11月にEOL、PHPUnit 10+ は 8.1+ 必須)
- PHP 8.3, 8.4 を追加
- キャッシュキーを composer.json ベースに変更

### 4. PHPUnit 設定とテストの近代化
- phpunit.xml.dist: `<coverage>` → `<source>` に移行(PHPUnit 10+ 推奨形式)
- テスト: `@dataProvider` アノテーション → `#[DataProvider]` 属性に移行
- データプロバイダメソッドを static に変更(PHPUnit 11 で必須)

https://claude.ai/code/session_01NKu4ADGFCQfxeaQXmPTFwG
Copilot AI review requested due to automatic review settings April 12, 2026 12:36
@kackey621 kackey621 merged commit e39e4ea into main Apr 12, 2026
10 checks passed
Copy link
Copy Markdown

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

CI パイプラインが全 PHP バージョンで失敗していた原因(composer メタデータ不備、PHPUnit/PHP バージョン整合、PHPUnit 設定形式)を解消し、CI とテスト設定を現行(PHP 8.1+ / PHPUnit 10+)に合わせる PR です。

Changes:

  • composer.json を strict validate に通るよう整備し、PHP 8.1+ と PHPUnit 10/11 を明示
  • composer.lock をリポジトリ管理から外し、CI を composer update ベースへ変更
  • PHPUnit 設定とテスト(DataProvider 属性)を PHPUnit 10+ 形式へ移行

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
composer.json license/require-dev 等の整理、PHP 8.1+・PHPUnit 10/11 に更新
.github/workflows/ci.yml PHP マトリクス更新、依存導入を composer update に変更、cache key を composer.json ベースへ
phpunit.xml.dist <coverage> から <source> へ移行(PHPUnit 10+ 推奨形式)
Tests/Unit/Controller/MpbControllerTest.php @dataProvider#[DataProvider] 属性へ変更、プロバイダを static 化
.gitignore composer.lock を ignore 対象に追加
composer.lock 追跡対象から削除

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

Comment thread composer.json
"version": "1.0.0",
"description": "Make Product By Customer for EC-CUBE 4.3",
"type": "eccube-plugin",
"license": "proprietary",
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

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

composer.json の "license" が "proprietary" になっていますが、リポジトリ直下の LICENSE ファイルは MIT License になっています(LICENSE:1)。配布形態が OSS のままなら composer.json の license を "MIT"(SPDX)に合わせるか、逆に proprietary が正しいなら LICENSE ファイル側も整合する内容に更新してください。

Suggested change
"license": "proprietary",
"license": "MIT",

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
Comment on lines 50 to 52
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction
run: composer update --prefer-dist --no-progress --no-interaction

Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

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

CI で composer.lock をコミットしない方針の場合でも、workflow が毎回 composer update を実行すると依存関係が実行のたびに変わり得て、過去に通ったコミットが将来落ちる(非決定的)状態になります。再現性を重視するなら lock をコミットして composer install に戻す、ライブラリ運用として lock を置かないなら少なくとも --prefer-lowest/--prefer-stable を組み合わせたジョブを追加する等、依存解決の戦略を明示するのが安全です。

Copilot uses AI. Check for mistakes.
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