LoginSignup
2
0

More than 3 years have passed since last update.

GitHubActionsのデフォルトのPHPバージョンが8なの知らなくてテスト落ちまくった話

Last updated at Posted at 2021-03-05

使用したライブラリ

こちらのライブラリを使用しました。

composer require facebook/graph-sdkして、色々処理を書いてGitHubにpushすると、GitHubActionsでテスト落ちた...

静的解析とかテストとか全部同じエラーが出ていました。

Run composer install --prefer-dist -q --no-ansi --no-interaction --no-scripts --no-progress
composer install --prefer-dist -q --no-ansi --no-interaction --no-scripts --no-progress shell: /usr/bin/bash -e {0}

Your lock file does not contain a compatible set of packages. Please run composer update.
Error: Process completed with exit code 2.

composer installする所でエラー出ているようです。

.github/laravel.yml
 - name: Install Dependencies
        run: composer install --prefer-dist -q --no-ansi --no-interaction --no-scripts --no-progress

一度、composer.lockを削除してcomposer updateしましたが、直りません...涙

そもそもGitHubActions内のPHPのバージョンは??

PHP8でした...!

手元のプロジェクトではPHP7.4を使用していました。
手元のPHPのバージョンをPHP8にあげてみて、composer installを実行してみるとGitHubActionsのエラーを再現することができました。

このライブラリはPHP8をサポートしていなかったよ..

最終更新されたのが2年前で、PHP8のサポートもされていないことが原因でした。

GitHubActions内で使用するPHPバージョンを指定すると、通りました!

.github/laravel.yml
runs-on: ubuntu-latest
steps:
  - name: Checkout
    uses: actions/checkout@v2

# PHP7.4を使うように指定
  - name: Setup PHP 7.4
    run: sudo update-alternatives --set php /usr/bin/php7.4

参考文献

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0