phpscrutinizer

Scrutinizer: install custom composer packages?


I have a Github project in Scrutinizer, that has an optional recommended package in its composer.json.

I would like to install this optional package during the Scrutinizer build, but could not find any information on how to do so in the Scrutinizer config. While the package is optional, Scrutinizer detects a number of bugs because the dependency is not present, and some of the unit tests will only run if it is present.

Is it possible to run custom composer commands, or to have additional composer packages installed?

The related package is Mistralys/application-utils.


Solution

  • Looking through scrutinizer configurations of other projects, I was able to find out how to run custom composer commands.

    To require additional packages, these can be added in the dependencies:

    build:
        dependencies:
            before:
                - composer require vendor/package-name:version
    

    It is also possible to override scrutinizer's composer command entirely, for example to run a script:

    build:
        dependencies:
            override:
                - composer run-script scriptname
    

    In my case, because the suggested package also requires the source package back (cyclic dependency), I had to set the root version, like this:

    build:
        dependencies:
            override:
                - COMPOSER_ROOT_VERSION=dev-master composer require mistralys/application-localization:dev-master