Problem/Motivation

We have started testing on Gitlab CI, but PHPStan is currently disabled. When run through Gitlab CI it fails with the following eror:

$ php vendor/bin/phpstan analyze $_WEB_ROOT/modules/custom/$CI_PROJECT_NAME $PHPSTAN_CONFIGURATION --error-format=junit > junit.xml || true
Note: Using configuration file /builds/issue/project_browser-3415079/phpstan.neon.dist.
File '/builds/issue/project_browser-3415079/vendor/phpstan/phpstan/../../../core/phpstan.neon.dist' is missing or is not readable.

Steps to reproduce

Enable PHPStan in .gitlab-ci.yml and let run. Note PHPStan failure.

Proposed resolution

Fix it!

Needs to correct the path to the core phpstan.neon.dist file. As DrupalCI is still running, it would be nice to do this in a way that works on both.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lostcarpark created an issue. See original summary.

lostcarpark’s picture

In phpstan.neon.dist, the Drupal core phpstan config is referenced using the following path:

  • %rootDir%/../../../core/phpstan.neon.dist

For GitlabCI, this needs to be:

  • %rootDir%/../../../web/core/phpstan.neon.dist

However, changing it in the file causes DrupalCI to fail.

As we want to run DrupalCI and GitlabCI in parallel for now, I have added a before_script to change the path on the fly with sed.

Not sure if there's a better way - such as using a variable that GitlabCI and DrupalCI can set to different values.

lostcarpark’s picture

Of course, once we move off DrupalCI, we can put the correct path in the file and remove the script, so doing it the "best" way is not so important.

lostcarpark’s picture

Status: Active » Needs review

All tests are passing (except PHPCS in Gitlab CI, which is the subject of ongoing work).

fjgarlin’s picture

Status: Needs review » Reviewed & tested by the community

The changes on the MR look good. I also see that it's temporary whilst both DrupalCI and GitLab CI are in play.
RTBC.

chrisfromredfin made their first commit to this issue’s fork.

chrisfromredfin’s picture

Thanks for the eyes, Fran!

chrisfromredfin’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.